annotate Renderer/test_render/camera_action.cpp @ 503:516d5c91d5b4 draft double-linked-task-list

comment
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 11 Oct 2009 19:35:33 +0900
parents 15bfacccde99
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
1 #include "SceneGraphRoot.h"
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
2 #include "SGList.h"
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
3 #include "camera_action.h"
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
4
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
5 #define MOVE_SPEED 0.10
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
6
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
7 void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
8 camera_init(SceneGraphPtr node, int screen_w, int screen_h)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
9 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
10 node->xyz[0] = screen_w/2;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
11 node->xyz[1] = screen_h/2 + 50;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
12 node->xyz[2] = 0;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
13 node->angle[0] = 120;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
14 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
15
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
16 void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
17 c_move(SceneGraphPtr node, int screen_w, int screen_h)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
18 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
19 Pad *pad = sgroot->getController();
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
20
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
21 if(pad->right.isHold())
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
22 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
23 if(node->xyz[0]>screen_w/2 - 50)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
24 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
25 node->xyz[0]-=MOVE_SPEED;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
26 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
27 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
28
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
29 if(pad->left.isHold())
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
30 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
31 if(node->xyz[0]<screen_w/2 + 50)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
32 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
33 node->xyz[0]+=MOVE_SPEED;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
34 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
35 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
36
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
37 if(pad->down.isHold())
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
38 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
39 if(node->xyz[2]>-25)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
40 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
41 node->xyz[2]-=MOVE_SPEED;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
42 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
43 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
44
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
45 if(pad->up.isHold())
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
46 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
47 if(node->xyz[2]<25)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
48 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
49 node->xyz[2]+=MOVE_SPEED;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
50 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
51 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
52
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
53 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
54
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
55 void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
56 camera_collision(SceneGraphPtr node, int screen_w, int screen_h,SceneGraphPtr tree)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
57 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
58 }