2
|
1 #include <math.h>
|
|
2 #include "SceneGraphRoot.h"
|
|
3 #include "dandy.h"
|
|
4
|
|
5 void
|
|
6 title_idle(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h)
|
|
7 {
|
|
8
|
|
9 }
|
|
10
|
7
|
11 void
|
|
12 init_charactor(Viewer *sgroot)
|
|
13 {
|
|
14 sgroot->createFromXMLfile("xml/mydandy.xml");
|
|
15 sgroot->createFromXMLfile("xml/gameover.xml");
|
8
|
16 sgroot->createFromXMLfile("xml/greencrab.xml");
|
7
|
17 sgroot->createFromXMLfile("xml/bluebullet.xml");
|
|
18 sgroot->createFromXMLfile("xml/redbullet.xml");
|
|
19
|
|
20 }
|
|
21
|
2
|
22 MainLoopPtr
|
|
23 dandy::init(Viewer *sgroot, int w, int h)
|
|
24 {
|
|
25 SceneGraphPtr back, title;
|
7
|
26 sgroot->createFromXMLfile("xml/title2.xml");
|
|
27
|
|
28 init_charactor(sgroot);
|
2
|
29
|
|
30 back = sgroot->createSceneGraph();
|
|
31 title = sgroot->createSceneGraph("title001");
|
|
32 title->xyz[0] = w/2;
|
|
33 title->xyz[1] = h/2;
|
|
34 title->set_move_collision(title_idle, title_collision);
|
|
35 back->addChild(title);
|
|
36
|
|
37 sgroot->setSceneData(back);
|
|
38
|
|
39 //mydandy = sgroot->getSgid("mydandy01");
|
|
40 //enemy = sgroot->getSgid("ENEMY");
|
|
41
|
|
42 return sgroot;
|
|
43 }
|
|
44
|
|
45 extern Application *
|
|
46 application() {
|
|
47 return new dandy();
|
|
48 }
|
|
49
|
|
50 const char *usr_help_str = "Usage: ./test_nogl [OPTION]\n";
|
|
51
|
|
52 extern int init(TaskManager *manager, int argc, char *argv[]);
|
|
53 extern void task_initialize();
|
|
54 static void TMend(TaskManager *manager);
|
|
55
|
|
56 int
|
|
57 TMmain(TaskManager *manager, int argc, char *argv[])
|
|
58 {
|
|
59 task_initialize();
|
|
60 manager->set_TMend(TMend);
|
|
61 return init(manager, argc, argv);
|
|
62
|
|
63 }
|
|
64
|
|
65 void
|
|
66 TMend(TaskManager *manager)
|
|
67 {
|
|
68 printf("game end\n");
|
|
69 }
|