ScummVM API documentation
legacy-sdl-events.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef BACKEND_EVENTS_SDL_LEGACY_H
23 #define BACKEND_EVENTS_SDL_LEGACY_H
24 
25 #include "backends/events/sdl/sdl-events.h"
26 
27 // multiplier used to increase resolution for keyboard/joystick mouse
28 #define MULTIPLIER 16
29 
31 public:
33 
34  bool pollEvent(Common::Event &event) override;
35 
36  void checkScreenChange();
37 
38 protected:
45 
46  struct KbdMouse {
47  int32 x, y;
48  int16 x_vel, y_vel, x_max, y_max, x_down_count, y_down_count, joy_x, joy_y;
49  uint32 last_time, delay_time, x_down_time, y_down_time;
50  bool modifier;
51  };
52  KbdMouse _km;
53 
54  virtual void updateKbdMouse();
55  virtual bool handleKbdMouse(Common::Event &event);
56 
58 
59  bool handleMouseMotion(SDL_Event &ev, Common::Event &event) override;
60  bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event) override;
61  bool handleMouseButtonUp(SDL_Event &ev, Common::Event &event) override;
62  bool handleJoyAxisMotion(SDL_Event &ev, Common::Event &event) override;
63 
64 #if SDL_VERSION_ATLEAST(2, 0, 0)
65  bool handleControllerButton(const SDL_Event &ev, Common::Event &event, bool buttonUp) override;
66  bool handleControllerAxisMotion(const SDL_Event &ev, Common::Event &event) override;
67 #endif
68 
72  virtual bool handleAxisToMouseMotion(int16 xAxis, int16 yAxis);
73 
78  int16 computeJoystickMouseSpeedFactor() const;
79 
83  void resetKeyboardEmulation(int16 x_max, int16 y_max);
84 
85 };
86 
87 #endif
Definition: sdl-events.h:40
virtual bool handleAxisToMouseMotion(int16 xAxis, int16 yAxis)
Definition: legacy-sdl-events.h:46
void resetKeyboardEmulation(int16 x_max, int16 y_max)
int16 computeJoystickMouseSpeedFactor() const
Definition: legacy-sdl-events.h:30
Definition: events.h:199
bool pollEvent(Common::Event &event) override