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