Mercurial > hg > Members > kono > Cerium
annotate TaskManager/Test/test_render/Keyboard.cpp @ 215:7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
author | gongo@gendarme.local |
---|---|
date | Sun, 01 Feb 2009 22:14:44 +0900 |
parents | eb20274baa7c |
children | 0f1ff7b06157 |
rev | line source |
---|---|
140 | 1 #include <SDL.h> |
2 #include "Keyboard.h" | |
3 | |
4 void | |
5 Keyboard::check(void) | |
6 { | |
7 Uint8 *keys = SDL_GetKeyState(NULL); | |
8 | |
9 if (keys[SDLK_UP] == SDL_PRESSED) { | |
10 up.push_work(); | |
11 } else { | |
12 up.release_work(); | |
13 } | |
14 | |
15 if (keys[SDLK_DOWN] == SDL_PRESSED) { | |
16 down.push_work(); | |
17 } else { | |
18 down.release_work(); | |
19 } | |
20 | |
21 if (keys[SDLK_RIGHT] == SDL_PRESSED) { | |
22 right.push_work(); | |
23 } else { | |
24 right.release_work(); | |
25 } | |
26 | |
27 if (keys[SDLK_LEFT] == SDL_PRESSED) { | |
28 left.push_work(); | |
29 } else { | |
30 left.release_work(); | |
31 } | |
32 | |
33 if (keys[SDLK_RETURN] == SDL_PRESSED) { | |
34 start.push_work(); | |
35 } else { | |
36 start.release_work(); | |
37 } | |
38 | |
39 if (keys[SDLK_ESCAPE] == SDL_PRESSED) { | |
40 select.push_work(); | |
41 } else { | |
42 select.release_work(); | |
43 } | |
44 | |
45 if (keys[SDLK_a] == SDL_PRESSED) { | |
46 square.push_work(); | |
47 } else { | |
48 square.release_work(); | |
49 } | |
50 | |
51 if (keys[SDLK_s] == SDL_PRESSED) { | |
52 triangle.push_work(); | |
53 } else { | |
54 triangle.release_work(); | |
55 } | |
56 | |
57 if (keys[SDLK_z] == SDL_PRESSED) { | |
58 cross.push_work(); | |
59 } else { | |
60 cross.release_work(); | |
61 } | |
62 | |
63 if (keys[SDLK_x] == SDL_PRESSED) { | |
64 circle.push_work(); | |
65 } else { | |
66 circle.release_work(); | |
67 } | |
215
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
68 |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
69 if (keys[SDLK_k] == SDL_PRESSED) { |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
70 l1.push_work(); |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
71 } else { |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
72 l1.release_work(); |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
73 } |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
74 |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
75 if (keys[SDLK_o] == SDL_PRESSED) { |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
76 l2.push_work(); |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
77 } else { |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
78 l2.release_work(); |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
79 } |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
80 |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
81 if (keys[SDLK_l] == SDL_PRESSED) { |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
82 r1.push_work(); |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
83 } else { |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
84 r1.release_work(); |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
85 } |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
86 |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
87 if (keys[SDLK_o] == SDL_PRESSED) { |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
88 r2.push_work(); |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
89 } else { |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
90 r2.release_work(); |
7ca6a2ef5be9
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
199
diff
changeset
|
91 } |
140 | 92 } |