43 lines
734 B
C++
43 lines
734 B
C++
|
|
#ifndef PLATFORM_UNIX_X11MOUSE_H
|
|
#define PLATFORM_UNIX_X11MOUSE_H
|
|
|
|
#include <Spectre/Input/Mouse.h>
|
|
#include <X11/Xlib.h>
|
|
|
|
namespace sp {
|
|
|
|
class X11Mouse : public Mouse
|
|
{
|
|
public :
|
|
X11Mouse();
|
|
~X11Mouse();
|
|
|
|
virtual void init();
|
|
|
|
// Get mouse position
|
|
virtual Vector2f getPosition() const;
|
|
|
|
virtual Vector2f getAbsPosition() const;
|
|
|
|
virtual bool isButtonDown(Mouse::Button button) const;
|
|
|
|
// Translate a XEvent to sp::Event, Called from X11EventQueue
|
|
static bool handleMessage(XEvent* xevent, Event& event);
|
|
|
|
protected :
|
|
|
|
virtual void update(InputModule *input);
|
|
|
|
protected :
|
|
::Display* m_disp;
|
|
::Window m_win;
|
|
|
|
Vector2f m_position;
|
|
|
|
unsigned int m_btn_state;
|
|
};
|
|
|
|
} // namespace sp
|
|
|
|
#endif /* PLATFORM_UNIX_X11MOUSE_H */
|