SDXFrameWork 0.13 SDXFrameWork

- Main Page
- Related Pages
- Classes

All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Key.h
1 //Copyright © 2014 SDXFramework
2 //[License]GNU Affero General Public License, version 3
3 //[Contact]http://sourceforge.jp/projects/dxframework/
4 #pragma once
5 #include <Multimedia/SDX.h>
6
7 namespace SDX
8 {
11 class Key
12 {
13 public:
14 bool on = false;
15 bool off = false;
16 bool hold = false;
17 unsigned int holdCount = 0;
18
20 void Reset()
21 {
22 on = false;
23 off = false;
24 hold = false;
25 holdCount = 0;
26 }
27
29 void Update(bool 押下フラグ)
30 {
31 on = (!hold && 押下フラグ);
32 off = (hold && !押下フラグ);
33
34 hold = 押下フラグ;
35
36 if (押下フラグ)
37 {
38 holdCount++;
39 }
40 else
41 {
42 holdCount = 0;
43 }
44 }
45 };
46 }
SDX::Key::off
bool off
離した瞬間
Definition: Key.h:15
SDX::Key::holdCount
unsigned int holdCount
押されている時間
Definition: Key.h:17
SDX::Key::Reset
void Reset()
キーのリセット.
Definition: Key.h:20
SDX::Key::on
bool on
押した瞬間
Definition: Key.h:14
SDX::Key::Update
void Update(bool 押下フラグ)
押下状態の更新.
Definition: Key.h:29
SDX::Key
各ボタンとキーを表すクラス.
Definition: Key.h:11
SDX::Key::hold
bool hold
押されている
Definition: Key.h:16