annotate TaskManager/Test/test_render/main.cpp @ 217:bfdd037aee21 draft

fix
author gongo@localhost.localdomain
date Wed, 04 Feb 2009 22:50:42 +0900
parents 1fd0107ebb25
children 3220ff9fbc5a f05d6c185f55
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
1 #include "TaskManager.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
2 #include "viewer.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
3 #include "viewerSDL.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
4 #include "viewerFB.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
5 #include "Func.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
6
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
7 /* prototype */
217
gongo@localhost.localdomain
parents: 199
diff changeset
8 static int init(int argc, char *argv[]);
gongo@localhost.localdomain
parents: 199
diff changeset
9 static void TMend(void);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
10
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
11 extern void task_initialize();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
12
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
13 Viewer *screen;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
14
144
gongo@localhost.localdomain
parents: 109
diff changeset
15 static int sg_number = 0;
gongo@localhost.localdomain
parents: 109
diff changeset
16
180
e3b7776b1420 いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents: 179
diff changeset
17 static const char *help_str = "Usage: ./test_nogl [OPTION]\n\
144
gongo@localhost.localdomain
parents: 109
diff changeset
18 -cpu Number of SPE (default 1)\n\
gongo@localhost.localdomain
parents: 109
diff changeset
19 -width, -height window size (default 640x480)\n\
gongo@localhost.localdomain
parents: 109
diff changeset
20 -sg Draw SceneGraph\n\
145
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 144
diff changeset
21 0: Joystick の 丸ボタン(Keyboard だとx) を押すと、キューブが二つに分かれる\n\
144
gongo@localhost.localdomain
parents: 109
diff changeset
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
gongo@localhost.localdomain
parents: 109
diff changeset
28
gongo@localhost.localdomain
parents: 109
diff changeset
29 int
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
30 init(int argc, char *argv[])
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
31 {
179
6e62f8cfbfe3 SDL_SetVideoMode に渡す bpp が 0 になってた (環境依存になってしまう)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 160
diff changeset
32 int bpp = 32;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
33 int width = 640;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
34 int height = 480;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
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
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
37 video_type vtype = VTYPE_SDL;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
38
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
39 for(int i = 1; argv[i]; ++i)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
40 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
41 if (strcmp(argv[i], "-bpp") == 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
42 bpp = atoi(argv[++i]);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
43 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
44 if (strcmp(argv[i], "-width") == 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
45 width = atoi(argv[++i]);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
46 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
47 if (strcmp(argv[i], "-height") == 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
48 height = atoi(argv[++i]);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
49 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
50 if (strcmp(argv[i], "-xml") == 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
51 xml = argv[++i];
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
52 }
144
gongo@localhost.localdomain
parents: 109
diff changeset
53 if (strcmp(argv[i], "-sg") == 0) {
gongo@localhost.localdomain
parents: 109
diff changeset
54 sg_number = (atoi)(argv[++i]);
gongo@localhost.localdomain
parents: 109
diff changeset
55 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
56 if (strcmp(argv[i], "-cpu") == 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
57 spenum = atoi(argv[++i]);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
58 }
144
gongo@localhost.localdomain
parents: 109
diff changeset
59 if (strcmp(argv[i], "-help") == 0) {
gongo@localhost.localdomain
parents: 109
diff changeset
60 printf("%s\n", help_str);
gongo@localhost.localdomain
parents: 109
diff changeset
61 return -1;
gongo@localhost.localdomain
parents: 109
diff changeset
62 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
63 if (strcmp(argv[i], "-video") == 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
64 if (strcmp(argv[i+1], "sdl") == 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
65 vtype = VTYPE_SDL;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
66 } else if (strcmp(argv[i+1], "fb") == 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
67 vtype = VTYPE_FB;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
68 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
69 i++;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
70 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
71 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
72
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
73 if (vtype == VTYPE_SDL) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
74 screen = new ViewerSDL(bpp, width, height, spenum);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
75 } else if (vtype == VTYPE_FB) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
76 screen = new ViewerFB(bpp, width, height, spenum);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
77 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
78
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
79 screen->video_init();
144
gongo@localhost.localdomain
parents: 109
diff changeset
80 screen->run_init(xml, sg_number);
gongo@localhost.localdomain
parents: 109
diff changeset
81
217
gongo@localhost.localdomain
parents: 199
diff changeset
82 manager->set_TMend(TMend);
gongo@localhost.localdomain
parents: 199
diff changeset
83
144
gongo@localhost.localdomain
parents: 109
diff changeset
84 return 0;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
85 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
86
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
87 int
217
gongo@localhost.localdomain
parents: 199
diff changeset
88 TMmain(int argc, char *argv[])
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
89 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
90 task_initialize();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
91
144
gongo@localhost.localdomain
parents: 109
diff changeset
92 return init(argc, argv);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
93
144
gongo@localhost.localdomain
parents: 109
diff changeset
94 //return 0;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
95 }
217
gongo@localhost.localdomain
parents: 199
diff changeset
96
gongo@localhost.localdomain
parents: 199
diff changeset
97 void
gongo@localhost.localdomain
parents: 199
diff changeset
98 TMend(void)
gongo@localhost.localdomain
parents: 199
diff changeset
99 {
gongo@localhost.localdomain
parents: 199
diff changeset
100 printf("test_nogl end\n");
gongo@localhost.localdomain
parents: 199
diff changeset
101 }