annotate TaskManager/Test/test_render/Keyboard.cpp @ 174:559b48b69b76

getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
author gongo@localhost.localdomain
date Fri, 12 Dec 2008 12:23:20 +0900
parents 861271089c43
children 72dcf908ec52
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 }
861271089c43 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
68 }