2022-07-30 12:24:03 -04:00
|
|
|
#ifndef __CCKEYBOARD_DISPATCHER_H__
|
|
|
|
#define __CCKEYBOARD_DISPATCHER_H__
|
|
|
|
|
|
|
|
#include "CCKeyboardDelegate.h"
|
2022-10-17 08:46:36 -04:00
|
|
|
#include "../../cocoa/CCArray.h"
|
2022-07-30 12:24:03 -04:00
|
|
|
|
|
|
|
RT_ADD(
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
|
|
|
class CC_DLL CCKeyboardDispatcher : public CCObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CCKeyboardDispatcher();
|
|
|
|
virtual ~CCKeyboardDispatcher();
|
|
|
|
|
|
|
|
void addDelegate(CCKeyboardDelegate* pDelegate);
|
|
|
|
void removeDelegate(CCKeyboardDelegate* pDelegate);
|
|
|
|
|
|
|
|
void forceAddDelegate(CCKeyboardDelegate* pDelegate);
|
|
|
|
void forceRemoveDelegate(CCKeyboardDelegate* pDelegate);
|
|
|
|
|
2023-12-22 08:38:11 -05:00
|
|
|
static enumKeyCodes convertKeyCode(enumKeyCodes key);
|
2022-07-30 12:24:03 -04:00
|
|
|
|
2024-02-12 08:53:14 -05:00
|
|
|
bool dispatchKeyboardMSG(enumKeyCodes key, bool isKeyDown, bool isKeyRepeat);
|
|
|
|
|
2022-09-28 15:38:30 -04:00
|
|
|
inline bool getAltKeyPressed() const {
|
|
|
|
return m_bAltPressed;
|
|
|
|
}
|
|
|
|
inline bool getCommandKeyPressed() const {
|
|
|
|
return m_bCommandPressed;
|
|
|
|
}
|
|
|
|
inline bool getControlKeyPressed() const {
|
|
|
|
return m_bControlPressed;
|
|
|
|
}
|
|
|
|
inline bool getShiftKeyPressed() const {
|
|
|
|
return m_bShiftPressed;
|
|
|
|
}
|
|
|
|
|
2023-02-01 17:03:01 -05:00
|
|
|
static GEODE_DLL CCKeyboardDispatcher* get();
|
2022-07-30 12:24:03 -04:00
|
|
|
|
|
|
|
const char* keyToString(enumKeyCodes key);
|
|
|
|
|
|
|
|
void updateModifierKeys(bool shft, bool ctrl, bool alt, bool cmd);
|
|
|
|
|
2024-02-12 08:53:14 -05:00
|
|
|
inline bool getBlockRepeat() const {
|
|
|
|
return m_bBlockRepeat;
|
|
|
|
}
|
2023-12-20 21:14:53 -05:00
|
|
|
|
2024-02-12 08:53:14 -05:00
|
|
|
inline void setBlockRepeat(bool blockRepeat) {
|
|
|
|
this->m_bBlockRepeat = blockRepeat;
|
|
|
|
}
|
2023-12-20 21:14:53 -05:00
|
|
|
|
2022-07-30 12:24:03 -04:00
|
|
|
protected:
|
2024-02-12 08:53:14 -05:00
|
|
|
CCArray* m_pDelegates; // 0x34
|
|
|
|
bool m_bUnknown38; // 0x38
|
|
|
|
bool m_bUnknown39; // 0x39
|
|
|
|
bool m_bUnknown3a; // 0x3a
|
|
|
|
ccCArray* m_pUnknown3c; // 0x3c
|
|
|
|
ccCArray* m_pUnknown40; // 0x40
|
|
|
|
bool m_bShiftPressed; // 0x44
|
|
|
|
bool m_bControlPressed; // 0x45
|
|
|
|
bool m_bAltPressed; // 0x46
|
|
|
|
bool m_bCommandPressed; // 0x47
|
|
|
|
bool m_bBlockRepeat; // 0x48
|
|
|
|
|
|
|
|
// ~~there's more here, check the initializer~~ no there's not??
|
2022-07-30 12:24:03 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
NS_CC_END
|
|
|
|
)
|
|
|
|
|
|
|
|
#endif
|