22 #ifndef ULTIMA_SHARED_ENGINE_EVENTS_H 23 #define ULTIMA_SHARED_ENGINE_EVENTS_H 25 #include "common/scummsys.h" 26 #include "common/events.h" 27 #include "common/stack.h" 28 #include "gui/debugger.h" 29 #include "graphics/screen.h" 30 #include "ultima/shared/core/rect.h" 35 #define GAME_FRAME_RATE (1000 / 50) 36 #define GAME_FRAME_TIME 50 37 #define SCREEN_UPDATE_TIME 10 38 #define BUTTON_MASK(MB) (1 << ((int)(MB) - 1)) 39 #define DOUBLE_CLICK_TIME 100 50 MK_LBUTTON = 1, MK_RBUTTON = 2, MK_MBUTTON = 4, MK_SHIFT = 8, MK_CONTROL = 0x10
76 virtual void leftButtonDoubleClick(
const Common::Point &mousePos) {
78 virtual void middleButtonDown(
const Common::Point &mousePos) {
82 virtual void middleButtonDoubleClick(
const Common::Point &mousePos) {
88 virtual void mouseWheel(
const Common::Point &mousePos,
bool wheelUp) {
107 void leftButtonDown(
const Common::Point &mousePos)
override {
110 void middleButtonDown(
const Common::Point &mousePos)
override {
113 void rightButtonDown(
const Common::Point &mousePos)
override {
143 uint32 _frameCounter;
144 uint32 _priorFrameTime;
145 uint32 _priorFrameCounterTime;
149 uint _specialButtons;
155 bool checkForNextFrameCounter();
161 return _eventTargets.top();
172 void setButtonDown(MouseButton button,
bool isDown);
177 virtual void nextFrame();
188 _eventTargets.push(target);
215 void pollEventsAndWait();
221 return _frameCounter;
227 uint32 getTicksCount()
const;
232 void sleep(uint time);
237 bool waitForPress(uint expiry);
242 void setMousePos(
const Point &pt);
247 bool isSpecialPressed(SpecialButtons btn)
const {
248 return (_specialButtons & btn) != 0;
255 return _specialButtons;
261 virtual void setCursor(
int cursorId) {
277 bool isCursorVisible();
283 return _frameCounter;
304 return (_buttonsDown & BUTTON_MASK(button)) != 0;
311 return isButtonDown(BUTTON_LEFT) || isButtonDown(BUTTON_RIGHT) || isButtonDown(BUTTON_MIDDLE);
virtual ~EventsCallback()
Definition: events.h:129
uint32 playTime() const
Definition: events.h:289
virtual void mouseMove(const Common::Point &mousePos)
Definition: events.h:70
EventType
Definition: events.h:49
void removeTarget()
Definition: events.h:194
bool isButtonDown() const
Definition: events.h:310
Definition: detection.h:27
bool isButtonDown(MouseButton button) const
Definition: events.h:303
MouseButton
Definition: events.h:183
uint32 getFrameCounter() const
Definition: events.h:220
uint32 getTicks()
Definition: events.h:282
byte getButtonState() const
Definition: events.h:317
Definition: keyboard.h:294
virtual void onIdle()
Definition: events.h:64
virtual Graphics::Screen * getScreen() const
Definition: events.h:134
void addTarget(EventTarget *target)
Definition: events.h:187
void setPlayTime(uint32 time)
Definition: events.h:296
uint getSpecialButtons() const
Definition: events.h:254
Common::Point getMousePos() const
Definition: events.h:324