283
|
1 #include "SceneGraphRoot.h"
|
|
2 #include "SGList.h"
|
|
3 #include "camera_action.h"
|
|
4
|
|
5 #define MOVE_SPEED 0.10
|
|
6
|
|
7 void
|
|
8 camera_init(SceneGraphPtr node, int screen_w, int screen_h)
|
|
9 {
|
|
10 node->xyz[0] = screen_w/2;
|
|
11 node->xyz[1] = screen_h/2 + 50;
|
|
12 node->xyz[2] = 0;
|
|
13 node->angle[0] = 120;
|
|
14 }
|
|
15
|
|
16 void
|
|
17 c_move(SceneGraphPtr node, int screen_w, int screen_h)
|
|
18 {
|
|
19 Pad *pad = sgroot->getController();
|
|
20
|
|
21 if(pad->right.isHold())
|
|
22 {
|
|
23 if(node->xyz[0]>screen_w/2 - 50)
|
|
24 {
|
|
25 node->xyz[0]-=MOVE_SPEED;
|
|
26 }
|
|
27 }
|
|
28
|
|
29 if(pad->left.isHold())
|
|
30 {
|
|
31 if(node->xyz[0]<screen_w/2 + 50)
|
|
32 {
|
|
33 node->xyz[0]+=MOVE_SPEED;
|
|
34 }
|
|
35 }
|
|
36
|
|
37 if(pad->down.isHold())
|
|
38 {
|
|
39 if(node->xyz[2]>-25)
|
|
40 {
|
|
41 node->xyz[2]-=MOVE_SPEED;
|
|
42 }
|
|
43 }
|
|
44
|
|
45 if(pad->up.isHold())
|
|
46 {
|
|
47 if(node->xyz[2]<25)
|
|
48 {
|
|
49 node->xyz[2]+=MOVE_SPEED;
|
|
50 }
|
|
51 }
|
|
52
|
|
53 }
|
|
54
|
|
55 void
|
|
56 camera_collision(SceneGraphPtr node, int screen_w, int screen_h,SceneGraphPtr tree)
|
|
57 {
|
|
58 }
|