DIKeyState.h
资源名称:DXGuide.zip [点击查看]
上传用户:wymy58
上传日期:2007-01-07
资源大小:2086k
文件大小:1k
源码类别:
DirextX编程
开发平台:
Visual C++
- // Copyright (C) 1998-1999 DXGuide. All Rights Reserved.
- // File: DIKeyState.h
- #ifndef _DIKEYSTATE__H
- #define _DIKEYSTATE__H
- #if _MSC_VER >= 1000
- #pragma once
- #endif // _MSC_VER >= 1000
- class CDIKeyboard;
- class CDIKeyState
- {
- friend class CDXGUIManager;
- public:
- enum KB_MASK
- {
- KB_RSHIFTMASK = 0x0001,
- KB_LSHIFTMASK = 0x0002,
- KB_RCTRLMASK = 0x0004,
- KB_LCTRLMASK = 0x0008,
- KB_RALTMASK = 0x0010,
- KB_LALTMASK = 0x0020,
- KB_DBCSMASK = 0x8000,
- };
- enum KEY_STATE
- {
- KEY_NONE,
- KEY_DOWN,
- KEY_UP,
- };
- protected:
- CDIKeyState(void);
- ~CDIKeyState();
- protected:
- bool Create(CDIKeyboard* pKeyboard, DWORD dwBufferSize = 16);
- public:
- void Update(void);
- CDIKeyState::KEY_STATE GetKeyState(void);
- DWORD GetKeyCode(void) const;
- TCHAR GetChar(void) const;
- DWORD GetKeyTimeStamp(void) const;
- public:
- bool IsCtrlPressed(void) const;
- bool IsAltPressed(void) const;
- bool IsShiftPressed(void) const;
- bool IsDBCSKeyCode(void) const;
- void ClearDBCSFlag(void);
- void DisableCtrl(void);
- void DisableAlt(void);
- void DisableShift(void);
- void EnableCtrl(void);
- void EnableAlt(void);
- void EnableShift(void);
- protected:
- KEY_STATE m_KeyState;
- DWORD m_dwKeyCode;
- DWORD m_dwKeyTimeStamp;
- DWORD m_dwControlKeyState;
- DWORD m_dwDisableControlKeyFlag;
- public:
- void PostKeyInfo(DWORD dwKeyCode,
- DWORD dwControlKeyState);
- protected:
- CDIKeyboard* m_pKeyboard;
- };
- #include "DIKeyState.inl"
- #endif // _DIKEYSTATE__H