您的位置:首页 > 其它

hge source explor 0x4 input module

2016-05-21 18:29 316 查看
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中的关于按键的键码  

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",
"?", "?", "?", "?", "?", "?", "?", "?", "?", "?",
"?", "?", "?", "?", "?", "?", "?", "?", "?", "?",
"?", "?", "?", "?", "?", "?", "?", "?", "?", "?",
"?", "?", "?"
};


KeyNames
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: