Mercurial > hg > Game > Cerium
annotate TaskManager/Test/test_render/main.cc @ 537:577043af6684 draft
get linda server addr from command line arg
author | kazz@e065701.local |
---|---|
date | Fri, 23 Oct 2009 14:13:03 +0900 |
parents | 0d2dc1869cbe |
children |
rev | line source |
---|---|
109 | 1 #include "TaskManager.h" |
2 #include "viewer.h" | |
3 #include "viewerSDL.h" | |
4 #include "viewerFB.h" | |
5 #include "Func.h" | |
6 | |
7 /* prototype */ | |
397
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
282
diff
changeset
|
8 static int init(TaskManager *manager, int argc, char *argv[]); |
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
282
diff
changeset
|
9 static void TMend(TaskManager *manager); |
109 | 10 |
11 extern void task_initialize(); | |
12 | |
397
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
282
diff
changeset
|
13 // 帯域変数は禁止 |
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
282
diff
changeset
|
14 //static Viewer *screen; |
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
282
diff
changeset
|
15 static int sg_number = 0; |
109 | 16 |
144 | 17 |
281 | 18 const char *usr_help_str = "Usage: ./test_nogl [OPTION]\n\ |
144 | 19 -cpu Number of SPE (default 1)\n\ |
20 -width, -height window size (default 640x480)\n\ | |
21 -sg Draw SceneGraph\n\ | |
145 | 22 0: Joystick の 丸ボタン(Keyboard だとx) を押すと、キューブが二つに分かれる\n\ |
144 | 23 1: 0 のキューブが大きい版\n\ |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
180
diff
changeset
|
24 2: テクスチャテスト:576x384\n\ |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
180
diff
changeset
|
25 3: テクスチャテスト:1024x768\n\ |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
180
diff
changeset
|
26 4: テクスチャテスト:2048x1536\n\ |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
180
diff
changeset
|
27 5: 地球が動き、その周りを月が自転、公転する\n\ |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
180
diff
changeset
|
28 6 以降: キューブが跳ね返りながら、勝手にキューブが増えて行く\n"; |
144 | 29 |
30 int | |
397
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
282
diff
changeset
|
31 init(TaskManager *manager, int argc, char *argv[]) |
109 | 32 { |
179
6e62f8cfbfe3
SDL_SetVideoMode に渡す bpp が 0 になってた (環境依存になってしまう)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
160
diff
changeset
|
33 int bpp = 32; |
109 | 34 int width = 640; |
35 int height = 480; | |
36 int spenum = 1; | |
180
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
179
diff
changeset
|
37 const char *xml = "xml_file/cube.xml"; |
537
577043af6684
get linda server addr from command line arg
kazz@e065701.local
parents:
404
diff
changeset
|
38 const char *linda_serv = "localhost"; |
109 | 39 video_type vtype = VTYPE_SDL; |
40 | |
41 for(int i = 1; argv[i]; ++i) | |
42 { | |
43 if (strcmp(argv[i], "-bpp") == 0) { | |
44 bpp = atoi(argv[++i]); | |
45 } | |
46 if (strcmp(argv[i], "-width") == 0) { | |
47 width = atoi(argv[++i]); | |
48 } | |
49 if (strcmp(argv[i], "-height") == 0) { | |
50 height = atoi(argv[++i]); | |
51 } | |
52 if (strcmp(argv[i], "-xml") == 0) { | |
53 xml = argv[++i]; | |
54 } | |
537
577043af6684
get linda server addr from command line arg
kazz@e065701.local
parents:
404
diff
changeset
|
55 if (strcmp(argv[i], "-linda") == 0) { |
577043af6684
get linda server addr from command line arg
kazz@e065701.local
parents:
404
diff
changeset
|
56 linda_serv = argv[++i]; |
577043af6684
get linda server addr from command line arg
kazz@e065701.local
parents:
404
diff
changeset
|
57 } |
144 | 58 if (strcmp(argv[i], "-sg") == 0) { |
59 sg_number = (atoi)(argv[++i]); | |
60 } | |
109 | 61 if (strcmp(argv[i], "-cpu") == 0) { |
62 spenum = atoi(argv[++i]); | |
63 } | |
64 if (strcmp(argv[i], "-video") == 0) { | |
65 if (strcmp(argv[i+1], "sdl") == 0) { | |
66 vtype = VTYPE_SDL; | |
67 } else if (strcmp(argv[i+1], "fb") == 0) { | |
68 vtype = VTYPE_FB; | |
69 } | |
70 i++; | |
71 } | |
72 } | |
73 | |
397
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
282
diff
changeset
|
74 Viewer *screen; |
109 | 75 if (vtype == VTYPE_SDL) { |
397
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
282
diff
changeset
|
76 screen = new ViewerSDL(manager, bpp, width, height, spenum); |
109 | 77 } else if (vtype == VTYPE_FB) { |
397
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
282
diff
changeset
|
78 screen = new ViewerFB(manager, bpp, width, height, spenum); |
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
282
diff
changeset
|
79 }else{ |
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
282
diff
changeset
|
80 screen = new ViewerSDL(manager, bpp, width, height, spenum); |
109 | 81 } |
82 | |
397
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
282
diff
changeset
|
83 screen->video_init(manager); |
537
577043af6684
get linda server addr from command line arg
kazz@e065701.local
parents:
404
diff
changeset
|
84 screen->run_init(manager, xml, sg_number, linda_serv); |
144 | 85 |
217 | 86 manager->set_TMend(TMend); |
87 | |
144 | 88 return 0; |
109 | 89 } |
90 | |
91 int | |
397
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
282
diff
changeset
|
92 TMmain(TaskManager *manager, int argc, char *argv[]) |
109 | 93 { |
94 task_initialize(); | |
397
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
282
diff
changeset
|
95 return init(manager, argc, argv); |
109 | 96 |
144 | 97 //return 0; |
109 | 98 } |
217 | 99 |
100 void | |
397
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
282
diff
changeset
|
101 TMend(TaskManager *manager) |
217 | 102 { |
103 printf("test_nogl end\n"); | |
104 } |