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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
140
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
1 #include <SDL.h>
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
2 #include "Keyboard.h"
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
3
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
4 void
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
5 Keyboard::check(void)
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
6 {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
7 Uint8 *keys = SDL_GetKeyState(NULL);
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
8
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
9 if (keys[SDLK_UP] == SDL_PRESSED) {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
10 up.push_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
11 } else {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
12 up.release_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
13 }
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
14
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
15 if (keys[SDLK_DOWN] == SDL_PRESSED) {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
16 down.push_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
17 } else {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
18 down.release_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
19 }
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
20
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
21 if (keys[SDLK_RIGHT] == SDL_PRESSED) {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
22 right.push_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
23 } else {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
24 right.release_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
25 }
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
26
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
27 if (keys[SDLK_LEFT] == SDL_PRESSED) {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
28 left.push_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
29 } else {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
30 left.release_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
31 }
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
32
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
33 if (keys[SDLK_RETURN] == SDL_PRESSED) {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
34 start.push_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
35 } else {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
36 start.release_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
37 }
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
38
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
39 if (keys[SDLK_ESCAPE] == SDL_PRESSED) {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
40 select.push_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
41 } else {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
42 select.release_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
43 }
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
44
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
45 if (keys[SDLK_a] == SDL_PRESSED) {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
46 square.push_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
47 } else {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
48 square.release_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
49 }
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
50
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
51 if (keys[SDLK_s] == SDL_PRESSED) {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
52 triangle.push_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
53 } else {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
54 triangle.release_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
55 }
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
56
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
57 if (keys[SDLK_z] == SDL_PRESSED) {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
58 cross.push_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
59 } else {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
60 cross.release_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
61 }
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
62
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
63 if (keys[SDLK_x] == SDL_PRESSED) {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
64 circle.push_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
65 } else {
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
66 circle.release_work();
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
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
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
92 }