hge source explor 0x4 input module
Posted YORU
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了hge source explor 0x4 input module相关的知识,希望对你有一定的参考价值。
Input Module |
hge中的输入并没有用到Direct Input,在window消息构造输入信息。
对于鼠标和键盘,输入信息用一个结构来处理,hge中的信息事件的结构
/* ** HGE Input Event structure */ struct hgeInputEvent { int type; // event type int key; // key code int flags; // event flags int chr; // character code int wheel; // wheel shift float x; // mouse cursor x-coordinate float y; // mouse cursor y-coordinate }; |
从结构中可以看到一个事件中同时包含了鼠标和键盘的属性,其中flags表示的标志。这个flags的标志为所有的功能键的集合,flags整数,每一位代表一个功能键。在hge.h中列出了功能键的集合。
/* ** HGE Input Event flags */ #define HGEINP_SHIFT 1 #define HGEINP_CTRL 2 #define HGEINP_ALT 4 #define HGEINP_CAPSLOCK 8 #define HGEINP_SCROLLLOCK 16 #define HGEINP_NUMLOCK 32 #define HGEINP_REPEAT 64 |
在hge中对于鼠标和键盘的信息还保存在引擎中
hge_impl.h |
int VKey; int Char; int Zpos; float Xpos; float Ypos; bool bMouseOver; bool bCaptured; char keyz[256]; CInputEventList* queue; |
再有在hge.h中的关于按键的键码
/* ** HGE Virtual-key codes */ #define HGEK_LBUTTON 0x01 #define HGEK_RBUTTON 0x02 #define HGEK_MBUTTON 0x04 #define HGEK_ESCAPE 0x1B #define HGEK_BACKSPACE 0x08 #define HGEK_TAB 0x09 #define HGEK_ENTER 0x0D #define HGEK_SPACE 0x20 #define HGEK_SHIFT 0x10 #define HGEK_CTRL 0x11 #define HGEK_ALT 0x12 #define HGEK_LWIN 0x5B #define HGEK_RWIN 0x5C #define HGEK_APPS 0x5D #define HGEK_PAUSE 0x13 #define HGEK_CAPSLOCK 0x14 #define HGEK_NUMLOCK 0x90 #define HGEK_SCROLLLOCK 0x91 #define HGEK_PGUP 0x21 #define HGEK_PGDN 0x22 #define HGEK_HOME 0x24 #define HGEK_END 0x23 #define HGEK_INSERT 0x2D #define HGEK_DELETE 0x2E #define HGEK_LEFT 0x25 #define HGEK_UP 0x26 #define HGEK_RIGHT 0x27 #define HGEK_DOWN 0x28 #define HGEK_0 0x30 #define HGEK_1 0x31 #define HGEK_2 0x32 #define HGEK_3 0x33 #define HGEK_4 0x34 #define HGEK_5 0x35 #define HGEK_6 0x36 #define HGEK_7 0x37 #define HGEK_8 0x38 #define HGEK_9 0x39 #define HGEK_A 0x41 #define HGEK_B 0x42 #define HGEK_C 0x43 #define HGEK_D 0x44 #define HGEK_E 0x45 #define HGEK_F 0x46 #define HGEK_G 0x47 #define HGEK_H 0x48 #define HGEK_I 0x49 #define HGEK_J 0x4A #define HGEK_K 0x4B #define HGEK_L 0x4C #define HGEK_M 0x4D #define HGEK_N 0x4E #define HGEK_O 0x4F #define HGEK_P 0x50 #define HGEK_Q 0x51 #define HGEK_R 0x52 #define HGEK_S 0x53 #define HGEK_T 0x54 #define HGEK_U 0x55 #define HGEK_V 0x56 #define HGEK_W 0x57 #define HGEK_X 0x58 #define HGEK_Y 0x59 #define HGEK_Z 0x5A #define HGEK_GRAVE 0xC0 #define HGEK_MINUS 0xBD #define HGEK_EQUALS 0xBB #define HGEK_BACKSLASH 0xDC #define HGEK_LBRACKET 0xDB #define HGEK_RBRACKET 0xDD #define HGEK_SEMICOLON 0xBA #define HGEK_APOSTROPHE 0xDE #define HGEK_COMMA 0xBC #define HGEK_PERIOD 0xBE #define HGEK_SLASH 0xBF #define HGEK_NUMPAD0 0x60 #define HGEK_NUMPAD1 0x61 #define HGEK_NUMPAD2 0x62 #define HGEK_NUMPAD3 0x63 #define HGEK_NUMPAD4 0x64 #define HGEK_NUMPAD5 0x65 #define HGEK_NUMPAD6 0x66 #define HGEK_NUMPAD7 0x67 #define HGEK_NUMPAD8 0x68 #define HGEK_NUMPAD9 0x69 #define HGEK_MULTIPLY 0x6A #define HGEK_DIVIDE 0x6F #define HGEK_ADD 0x6B #define HGEK_SUBTRACT 0x6D #define HGEK_DECIMAL 0x6E #define HGEK_F1 0x70 #define HGEK_F2 0x71 #define HGEK_F3 0x72 #define HGEK_F4 0x73 #define HGEK_F5 0x74 #define HGEK_F6 0x75 #define HGEK_F7 0x76 #define HGEK_F8 0x77 #define HGEK_F9 0x78 #define HGEK_F10 0x79 #define HGEK_F11 0x7A #define HGEK_F12 0x7B
在input.cpp中有按键的名称
char *KeyNames[] = { "?", "Left Mouse Button", "Right Mouse Button", "?", "Middle Mouse Button", "?", "?", "?", "Backspace", "Tab", "?", "?", "?", "Enter", "?", "?", "Shift", "Ctrl", "Alt", "Pause", "Caps Lock", "?", "?", "?", "?", "?", "?", "Escape", "?", "?", "?", "?", "Space", "Page Up", "Page Down", "End", "Home", "Left Arrow", "Up Arrow", "Right Arrow", "Down Arrow", "?", "?", "?", "?", "Insert", "Delete", "?", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "?", "?", "?", "?", "?", "?", "?", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "Left Win", "Right Win", "Application", "?", "?", "NumPad 0", "NumPad 1", "NumPad 2", "NumPad 3", "NumPad 4", "NumPad 5", "NumPad 6", "NumPad 7", "NumPad 8", "NumPad 9", "Multiply", "Add", "?", "Subtract", "Decimal", "Divide", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "Num Lock", "Scroll Lock", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "Semicolon", "Equals", "Comma", "Minus", "Period", "Slash", "Grave", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "Left bracket", "Backslash", "Right bracket", "Apostrophe", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?" };
以上是关于hge source explor 0x4 input module的主要内容,如果未能解决你的问题,请参考以下文章
hge source explor 0x6 input module
hge source explor 0x3 windows module
hge source explor 0xB graphics Ⅱ