-
Notifications
You must be signed in to change notification settings - Fork 1
/
GeneralButtonManager.h
66 lines (57 loc) · 1.89 KB
/
GeneralButtonManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef INCLUDED_RTG_GENERALBUTTONMANAGER_H
#define INCLUDED_RTG_GENERALBUTTONMANAGER_H
#include "Defines.h"
#include "Keyboard.h"
#include "ReplayLoader.h"
namespace RTG
{
enum GeneralButton
{
GENERAL_BUTTON_UP = 0, // 上
GENERAL_BUTTON_DOWN = 1, // 下
GENERAL_BUTTON_RIGHT = 2, // 右
GENERAL_BUTTON_LEFT = 3, // 左
GENERAL_BUTTON_BARRIER = 4, // バリア(決定ボタン)
GENERAL_BUTTON_ROT_CW = 5, // 時計回り回転
GENERAL_BUTTON_ROT_CCW = 6, // 反時計周り回転
GENERAL_BUTTON_CANCEL = 7, // キャンセルボタン
GENERAL_BUTTON_SS = 8, // スクリーンショット
GENERAL_BUTTON_PAUSE = 9, // ポーズボタン
GENERAL_BUTTON_TERM = 10, // 強制終了
GENERAL_BUTTON_ENTER = 11, // 決定ボタン
};
enum InputDevice
{
INPUT_DEVICE_KEYBOARD = 0, // キーボード
INPUT_DEVICE_MOUSE = 1, // マウス
INPUT_DEVICE_GAMEPAD = 2, // ゲームパッド
INPUT_DEVICE_REPLAY = 3, // リプレイ数
};
const int GENERAL_BUTTON_TOTAL = 12; // ボタン数
const int INPUT_DEVICE_TOTAL = 4; // デバイスの種類数
class GeneralButtonManager
{
private:
unsigned short m_ButtonMaps[ GENERAL_BUTTON_TOTAL ]; // ボタンマップ(割り当ての状態を保持)、上位1byte->デバイス、下位1byte->ボタン
bool m_IsPushedOnce[ GENERAL_BUTTON_TOTAL ]; // ボタンは現在押されているか?
bool m_IsPushed[ GENERAL_BUTTON_TOTAL ]; // ボタンは前回も押されていたか?
Keyboard* m_pKeyboard;
ReplayEntry* m_pReplay;
int m_CurFrame; // 現在のフレーム
int repmode;
public:
GeneralButtonManager();
~GeneralButtonManager();
void Init( ReplayEntry* pReplayEntry );
void Assign( int button, int dev, int devButton );
int GetAssignedDev( int button );
int GetAssignedDevButton( int button );
void Update();
void SetReplay( int set );
bool IsPushedOnce( GeneralButton button ) const;
bool IsPushed( GeneralButton button ) const;
void Reset();
void CopyCurState( char* pPushed ) const;
};
}
#endif