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