SDXFrameWork 0.09 SDXFrameWork

- Main Page
- Related Pages
- Classes

All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Joypad.h
1 #pragma once//☀SDL
2 #include <Multimedia/SDX.h>
3 #include <Multimedia/Key.h>
4 #include <Multimedia/InputEnum.h>
5
6 namespace SDX
7 {
10 class Joypad
11 {
12 private:
13 PadType inputType = PadType::KeyAndPad1;
14 StickHandle handle;
15 Joypad(const Joypad &joypad){};
16 Joypad operator =(const Joypad &joypad) = delete;
17 public:
18 int StickX = 0;
19 int StickY = 0;
20
21 bool press[32];
22
23 Key Down;
24 Key Left;
25 Key Right;
26 Key Up;
27 Key Button1;
28 Key Button2;
29 Key Button3;
30 Key Button4;
31 Key Button5;
32 Key Button6;
33 Key Button7;
34 Key Button8;
35 Key Button9;
36 Key Button10;
37 Key Button11;
38 Key Button12;
39 Key Button13;
40 Key Button14;
41 Key Button15;
42 Key Button16;
43 Key Button17;
44 Key Button18;
45 Key Button19;
46 Key Button20;
47 Key Button21;
48 Key Button22;
49 Key Button23;
50 Key Button24;
51 Key Button25;
52 Key Button26;
53 Key Button27;
54 Key Button28;
55
56 Joypad(){}
57
58 void Open()
59 {
60 handle = SDL_JoystickOpen(0);
61 }
62
64 void Make(PadType パッドタイプ)
65 {
66 inputType = パッドタイプ;
67 }
68
70 void Reset()
71 {
72 Up.Reset();
73 Down.Reset();
74 Left.Reset();
75 Right.Reset();
76 Button1.Reset();
77 Button2.Reset();
78 Button3.Reset();
79 Button4.Reset();
80 Button5.Reset();
81 Button6.Reset();
82 Button7.Reset();
83 Button8.Reset();
84 Button9.Reset();
85 Button10.Reset();
86 Button11.Reset();
87 Button12.Reset();
88 Button13.Reset();
89 Button14.Reset();
90 Button15.Reset();
91 Button16.Reset();
92 Button17.Reset();
93 Button18.Reset();
94 Button19.Reset();
95 Button20.Reset();
96 Button21.Reset();
97 Button22.Reset();
98 Button23.Reset();
99 Button24.Reset();
100 Button25.Reset();
101 Button26.Reset();
102 Button27.Reset();
103 Button28.Reset();
104
105 StickX = 0;
106 StickY = 0;
107 }
108
110 void Update()
111 {
112 Down.Update( press[(int)PadCode::Down]);
113 Left.Update(press[(int)PadCode::Left]);
114 Right.Update(press[(int)PadCode::Right]);
115 Up.Update(press[(int)PadCode::Up]);
116 Button1.Update(press[(int)PadCode::Button1]);
117 Button2.Update(press[(int)PadCode::Button2]);
118 Button3.Update(press[(int)PadCode::Button3]);
119 Button4.Update(press[(int)PadCode::Button4]);
120 Button5.Update(press[(int)PadCode::Button5]);
121 Button6.Update(press[(int)PadCode::Button6]);
122 Button7.Update(press[(int)PadCode::Button7]);
123 Button8.Update(press[(int)PadCode::Button8]);
124 Button9.Update(press[(int)PadCode::Button9]);
125 Button10.Update(press[(int)PadCode::Button10]);
126 Button11.Update(press[(int)PadCode::Button11]);
127 Button12.Update(press[(int)PadCode::Button12]);
128 Button13.Update(press[(int)PadCode::Button13]);
129 Button14.Update(press[(int)PadCode::Button14]);
130 Button15.Update(press[(int)PadCode::Button15]);
131 Button16.Update(press[(int)PadCode::Button16]);
132 Button17.Update(press[(int)PadCode::Button17]);
133 Button18.Update(press[(int)PadCode::Button18]);
134 Button19.Update(press[(int)PadCode::Button19]);
135 Button20.Update(press[(int)PadCode::Button20]);
136 Button21.Update(press[(int)PadCode::Button21]);
137 Button22.Update(press[(int)PadCode::Button22]);
138 Button23.Update(press[(int)PadCode::Button23]);
139 Button24.Update(press[(int)PadCode::Button24]);
140 Button25.Update(press[(int)PadCode::Button25]);
141 Button26.Update(press[(int)PadCode::Button26]);
142 Button27.Update(press[(int)PadCode::Button27]);
143 Button28.Update(press[(int)PadCode::Button28]);
144 }
145
147 PadType GetInputType()
148 {
149 return inputType;
150 }
151
153 void SetInputType(PadType 入力タイプ)
154 {
155 inputType = 入力タイプ;
156 }
157
161 bool StartVibration(double 強さ,int 振動ミリ秒)
162 {
163 return false;
164 }
165
167 bool StopVibration()
168 {
169 return false;
170 }
171
173 static int GetCount()
174 {
175 return SDL_NumJoysticks();
176 }
177 };
178 }
SDX::Joypad::GetCount
static int GetCount()
接続中のパッド数を取得.
Definition: Joypad.h:173
SDX::PadType
PadType
ゲームパッドの種類.
Definition: InputEnum.h:7
SDX::Joypad::StopVibration
bool StopVibration()
パッドの振動を停止する[未実装].
Definition: Joypad.h:167
SDX::Joypad
ジョイパッドの状態を表すクラス.
Definition: Joypad.h:10
SDX::Key::Reset
void Reset()
キーのリセット.
Definition: Key.h:17
SDX::Key::Update
void Update(int 押下フラグ)
押下状態の更新.
Definition: Key.h:26
SDX::Joypad::GetInputType
PadType GetInputType()
パッドタイプの取得.
Definition: Joypad.h:147
SDX::Joypad::Reset
void Reset()
状態のリセット.
Definition: Joypad.h:70
SDX::Joypad::Make
void Make(PadType パッドタイプ)
パッドの作成.
Definition: Joypad.h:64
SDX::Key
各ボタンとキーを表すクラス.
Definition: Key.h:8
SDX::Joypad::Update
void Update()
状態の更新.
Definition: Joypad.h:110
SDX::Joypad::StartVibration
bool StartVibration(double 強さ, int 振動ミリ秒)
パッドを振動させる[未実装].
Definition: Joypad.h:161
SDX::Joypad::SetInputType
void SetInputType(PadType 入力タイプ)
パッドタイプの設定.
Definition: Joypad.h:153