5 |
6 | using namespace gainput;
7 |
8 | const unsigned ButtonCount = 15;
9 |
10 | TEST_CASE("InputState", "")
11 | {
12 | InputState state(GetDefaultAllocator(), ButtonCount);
13 | InputState state2(GetDefaultAllocator(), ButtonCount);
14 |
15 | for (unsigned i = 0; i < ButtonCount; ++i)
16 | {
17 | REQUIRE(!state.GetBool(i));
18 | REQUIRE(state.GetFloat(i) == 0.0f);
19 | }
20 |
21 | for (unsigned i = 0; i < ButtonCount; ++i)
22 | {
23 | const bool s = i & 1;
24 | state.Set(i, s);
25 | REQUIRE(state.GetBool(i) == s);
26 | }
27 |
28 | state2 = state;
29 | for (unsigned i = 0; i < ButtonCount; ++i)
30 | {
31 | REQUIRE(state2.GetBool(i) == state.GetBool(i));
32 | }
33 |
34 | float s = 0.0f;
35 | for (unsigned i = 0; i < ButtonCount; ++i)
36 | {
37 | state.Set(i, s);
38 | REQUIRE(state.GetFloat(i) == s);
39 | s += float(i)*0.0354f;
40 | }
41 |
42 | state2 = state;
43 | for (unsigned i = 0; i < ButtonCount; ++i)
44 | {
45 | REQUIRE(state2.GetFloat(i) == state.GetFloat(i));
46 | }
47 | }
48 |
49 |
--------------------------------------------------------------------------------
/tools/html5client/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Gainput Javascript touch client
4 |
11 |
12 |
13 |
14 |