1 #ifndef __INPUT_
2 #define __INPUT_
3 
4 #include "Types.h"
5 #include "SDL_events.h"
6 #include "SDL_keyboard.h"
7 
8 #include <string_theory/string>
9 
10 
11 #define KEY_DOWN									0x0001
12 #define KEY_UP										0x0002
13 #define KEY_REPEAT								0x0004
14 #define TEXT_INPUT								0x0006
15 #define LEFT_BUTTON_DOWN					0x0008
16 #define LEFT_BUTTON_UP						0x0010
17 #define LEFT_BUTTON_DBL_CLK				0x0020
18 #define LEFT_BUTTON_REPEAT				0x0040
19 #define RIGHT_BUTTON_DOWN					0x0080
20 #define RIGHT_BUTTON_UP						0x0100
21 #define RIGHT_BUTTON_REPEAT				0x0200
22 #define MOUSE_POS									0x0400
23 #define MOUSE_WHEEL_UP      0x0800
24 #define MOUSE_WHEEL_DOWN    0x1000
25 #define MOUSE_EVENTS        0xFFF8
26 
27 #define MIDDLE_BUTTON_DOWN		0x2000
28 #define MIDDLE_BUTTON_UP		0x4000
29 #define MIDDLE_BUTTON_REPEAT	0x8000
30 
31 #define SHIFT_DOWN								0x01
32 #define CTRL_DOWN									0x02
33 #define ALT_DOWN									0x04
34 
35 #define DBL_CLK_TIME							300     // Increased by Alex, Jun-10-97, 200 felt too short
36 #define BUTTON_REPEAT_TIMEOUT			250
37 #define BUTTON_REPEAT_TIME				50
38 
39 struct InputAtom
40 {
41 	UINT16 usKeyState;
42 	UINT16 usEvent;
43 	UINT32 usParam;
44 	ST::utf32_buffer codepoints;
45 };
46 
47 
48 extern BOOLEAN			DequeueEvent(InputAtom *Event);
49 
50 void MouseButtonDown(const SDL_MouseButtonEvent*);
51 void MouseButtonUp(const SDL_MouseButtonEvent*);
52 void MouseWheelScroll(const SDL_MouseWheelEvent*);
53 
54 void KeyDown(const SDL_Keysym*);
55 void KeyUp(  const SDL_Keysym*);
56 void TextInput(  const SDL_TextInputEvent*);
57 
58 extern void					GetMousePos(SGPPoint *Point);
59 
60 extern BOOLEAN DequeueSpecificEvent(InputAtom *Event, UINT32 uiMaskFlags );
61 
62 extern void					RestrictMouseToXYXY(UINT16 usX1, UINT16 usY1, UINT16 usX2, UINT16 usY2);
63 void RestrictMouseCursor(const SGPRect* pRectangle);
64 extern void					SetSafeMousePosition(int x, int y);
65 extern void					FreeMouseCursor(void);
66 extern BOOLEAN			IsCursorRestricted( void );
67 extern void					GetRestrictedClipCursor( SGPRect *pRectangle );
68 
69 
70 void SimulateMouseMovement( UINT32 uiNewXPos, UINT32 uiNewYPos );
71 
72 void DequeueAllKeyBoardEvents(void);
73 
74 
75 extern UINT16    gusMouseXPos;       // X position of the mouse on screen
76 extern UINT16    gusMouseYPos;       // y position of the mouse on screen
77 extern BOOLEAN   gfLeftButtonState;  // TRUE = Pressed, FALSE = Not Pressed
78 extern BOOLEAN   gfRightButtonState; // TRUE = Pressed, FALSE = Not Pressed
79 extern BOOLEAN   gfMiddleButtonState;
80 
81 bool _KeyDown(SDL_Keycode);
82 #define _LeftButtonDown    gfLeftButtonState
83 #define _RightButtonDown   gfRightButtonState
84 #define _MiddleButtonDown   gfMiddleButtonState
85 
86 #endif
87