annotate IO/Keyboard.h @ 2575:a76d408c5132 tip

DrawTranslucent -> DrawTextureGrayShade Removed old texture drawing stuff
author a.parshin
date Wed, 09 Mar 2016 01:39:52 +0200
parents a77c34acdbc9
children
rev   line source
2502
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
1 #pragma once
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
2
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
3
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
4 /* 284 */
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
5 enum InputAction : __int32
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
6 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
7 INPUT_MoveForward = 0x0,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
8 INPUT_MoveBackwards = 0x1,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
9 INPUT_TurnLeft = 0x2,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
10 INPUT_TurnRight = 0x3,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
11 INPUT_Yell = 0x4,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
12 INPUT_Jump = 0x5,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
13 INPUT_Combat = 0x6,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
14 INPUT_CastReady = 0x7,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
15 INPUT_Attack = 0x8,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
16 INPUT_EventTrigger = 0x9,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
17 INPUT_Cast = 0xA,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
18 INPUT_Pass = 0xB,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
19 INPUT_CharCycle = 0xC,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
20 INPUT_Quest = 0xD,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
21 INPUT_QuickRef = 0xE,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
22 INPUT_Rest = 0xF,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
23 INPUT_TimeCal = 0x10,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
24 INPUT_Autonotes = 0x11,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
25 INPUT_Mapbook = 0x12,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
26 INPUT_AlwaysRun = 0x13,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
27 INPUT_LookUp = 0x14,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
28 INPUT_LookDown = 0x15,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
29 INPUT_CenterView = 0x16,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
30 INPUT_ZoomIn = 0x17,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
31 INPUT_ZoomOut = 0x18,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
32 INPUT_FlyUp = 0x19,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
33 INPUT_FlyDown = 0x1A,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
34 INPUT_Land = 0x1B,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
35 INPUT_StrafeLeft = 0x1C,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
36 INPUT_StrafeRight = 0x1D,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
37 };
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
38
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
39
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
40
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
41 enum KeyToggleType : __int32
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
42 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
43 TOGGLE_Continuously = 0x0,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
44 TOGGLE_OneTimePress = 0x1,
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
45 };
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
46
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
47 #pragma pack(push, 1)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
48 struct KeyboardActionMapping
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
49 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
50 KeyboardActionMapping();
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
51
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
52 void SetKeyMapping(int uAction, int vKey, KeyToggleType type);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
53 unsigned int GetActionVKey(enum InputAction eAction);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
54 const char *GetVKeyDisplayName(unsigned char a1);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
55 const unsigned __int8 TranslateKeyNameToKeyCode(const char *Str);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
56 void ReadMappings();
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
57 void StoreMappings();
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
58 bool ProcessTextInput(unsigned int a2);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
59 void SetWindowInputStatus(int a2);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
60 void EnterText(int a2, int max_string_len, struct GUIWindow *pWindow);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
61 void ResetKeys();
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
62 void SetDefaultMapping();
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
63
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
64 unsigned int uLastKeyPressed;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
65 int field_4;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
66 int field_8;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
67 unsigned int pVirtualKeyCodesMapping[30];
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
68 KeyToggleType pToggleTypes[30];
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
69 int max_input_string_len;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
70 __int8 pPressedKeysBuffer[257];
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
71 unsigned __int8 uNumKeysPressed;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
72 char field_202;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
73 char field_203;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
74 int field_204;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
75 struct GUIWindow *pWindow;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
76 };
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
77 #pragma pack(pop)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
78
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
79 #pragma pack(push, 1)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
80 class Keyboard
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
81 {
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
82 public:
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
83 inline Keyboard():
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
84 bUsingAsynKeyboard(false)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
85 {}
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
86 bool WasKeyPressed(int vKey);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
87 static bool IsKeyBeingHeld(int vKey);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
88 static void ProcessInputActions();
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
89 bool IsShiftHeld();
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
90 void EnterCriticalSection();
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
91
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
92 void ( ***vdestructor_ptr)(Keyboard *, bool);
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
93 unsigned int bUsingAsynKeyboard;
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
94 };
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
95 #pragma pack(pop)
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
96
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
97
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
98
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
99 void OnPressSpace();
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
100
a77c34acdbc9 Media folder
Ritor1
parents:
diff changeset
101 extern struct KeyboardActionMapping *pKeyActionMap;