annotate TaskManager/Test/test_render/Application/camera_action.cc @ 431:b40a9b901d71 draft

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