Mercurial > hg > Members > kono > Cerium
comparison Renderer/Test/create_task.cc @ 756:2575791a333a
add Test/create_task {spe, task}/Property
author | hiroki@henri.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Fri, 29 Jan 2010 11:34:43 +0900 |
parents | |
children | 5238f3e854fc |
comparison
equal
deleted
inserted
replaced
755:0a013d0935a9 | 756:2575791a333a |
---|---|
1 #include <math.h> | |
2 #include <stdlib.h> | |
3 #include "SceneGraphRoot.h" | |
4 #include "MainLoop.h" | |
5 #include "create_task.h" | |
6 #include "sys.h" | |
7 #include "Func.h" | |
8 | |
9 // prototype | |
10 static void move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h); | |
11 static void collision(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h, SceneGraphPtr tree); | |
12 | |
13 static void | |
14 move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) | |
15 { | |
16 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_; | |
17 TaskManager *manager = sgroot->tmanager; | |
18 HTaskPtr property_task = manager->create_task(PropertyTask); | |
19 | |
20 Property *property = (Property *)manager->allocate(sizeof(Property)); | |
21 Property *property_update = (Property *)manager->allocate(sizeof(Property)); | |
22 | |
23 property_task->add_inData(property, sizeof(Property)); | |
24 property_task->add_outData(property_update, sizeof(Property)); | |
25 property_task->set_cpu(SPE_ANY); | |
26 | |
27 property_task->spawn(); | |
28 } | |
29 | |
30 static void | |
31 collision(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h, | |
32 SceneGraphPtr tree) | |
33 { | |
34 } | |
35 | |
36 MainLoopPtr | |
37 create_task::init(Viewer *sgroot, int screen_w, int screen_h) | |
38 { | |
39 SceneGraphPtr ball; | |
40 | |
41 sgroot->createFromXMLfile("xml_file/Ball.xml"); | |
42 | |
43 ball = sgroot->createSceneGraph("Ball"); | |
44 ball->set_move_collision(move, collision); | |
45 | |
46 ball->xyz[0] = screen_w/2; | |
47 ball->xyz[1] = screen_h/2; | |
48 ball->xyz[2] = 30.0f; | |
49 | |
50 sgroot->setSceneData(ball); | |
51 | |
52 return sgroot; | |
53 } | |
54 | |
55 extern Application * | |
56 application() { | |
57 return new create_task(); | |
58 } | |
59 | |
60 const char *usr_help_str = "Usage: ./test_nogl [OPTION]\n"; | |
61 | |
62 extern int init(TaskManager *manager, int argc, char *argv[]); | |
63 extern void task_initialize(); | |
64 static void TMend(TaskManager *manager); | |
65 | |
66 int | |
67 TMmain(TaskManager *manager, int argc, char *argv[]) | |
68 { | |
69 task_initialize(); | |
70 manager->set_TMend(TMend); | |
71 return init(manager, argc, argv); | |
72 | |
73 } | |
74 | |
75 void | |
76 TMend(TaskManager *manager) | |
77 { | |
78 printf("test_nogl end\n"); | |
79 } | |
80 | |
81 /* end */ |