annotate TaskManager/Test/test_render/main.cpp @ 179:434846aef389

SDL_SetVideoMode に渡す bpp が 0 になってた (環境依存になってしまう)
author gongo@gendarme.cr.ie.u-ryukyu.ac.jp
date Fri, 19 Dec 2008 14:21:29 +0900
parents d5cca23ed50c
children 5cde66c926b4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
1 #include "TaskManager.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
2 #include "viewer.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
3 #include "viewerSDL.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
4 #include "viewerFB.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
5 #include "Func.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
6
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
7 /* prototype */
160
gongo@localhost.localdomain
parents: 153
diff changeset
8 int init(int argc, char *argv[]);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
9
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
10 extern void task_initialize();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
11
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
12 Viewer *screen;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
13
144
gongo@localhost.localdomain
parents: 109
diff changeset
14 static int sg_number = 0;
gongo@localhost.localdomain
parents: 109
diff changeset
15
gongo@localhost.localdomain
parents: 109
diff changeset
16 static char *help_str = "Usage: ./test_nogl [OPTION]\n\
gongo@localhost.localdomain
parents: 109
diff changeset
17 -cpu Number of SPE (default 1)\n\
gongo@localhost.localdomain
parents: 109
diff changeset
18 -width, -height window size (default 640x480)\n\
gongo@localhost.localdomain
parents: 109
diff changeset
19 -sg Draw SceneGraph\n\
145
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 144
diff changeset
20 0: Joystick の 丸ボタン(Keyboard だとx) を押すと、キューブが二つに分かれる\n\
144
gongo@localhost.localdomain
parents: 109
diff changeset
21 1: 0 のキューブが大きい版\n\
153
c8c8bb4e9e58 画像のサイズテストを加える -sg = [2,3,4]
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 145
diff changeset
22 2: スネークさんが写るだけ 576x384 版\n\
c8c8bb4e9e58 画像のサイズテストを加える -sg = [2,3,4]
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 145
diff changeset
23 3: スネークさんが写るだけ 800x600 版\n\
c8c8bb4e9e58 画像のサイズテストを加える -sg = [2,3,4]
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 145
diff changeset
24 4: 何かの画像 1920x1080\n\
c8c8bb4e9e58 画像のサイズテストを加える -sg = [2,3,4]
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 145
diff changeset
25 5 以降: キューブが跳ね返りながら、勝手にキューブが増えて行く";
144
gongo@localhost.localdomain
parents: 109
diff changeset
26
gongo@localhost.localdomain
parents: 109
diff changeset
27 int
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
28 init(int argc, char *argv[])
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
29 {
179
434846aef389 SDL_SetVideoMode に渡す bpp が 0 になってた (環境依存になってしまう)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 160
diff changeset
30 int bpp = 32;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
31 int width = 640;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
32 int height = 480;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
33 int spenum = 1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
34 char *xml = "xml_file/cube.xml";
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
35 video_type vtype = VTYPE_SDL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
36
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
37 for(int i = 1; argv[i]; ++i)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
38 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
39 if (strcmp(argv[i], "-bpp") == 0) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
40 bpp = atoi(argv[++i]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
41 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
42 if (strcmp(argv[i], "-width") == 0) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
43 width = atoi(argv[++i]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
44 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
45 if (strcmp(argv[i], "-height") == 0) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
46 height = atoi(argv[++i]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
47 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
48 if (strcmp(argv[i], "-xml") == 0) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
49 xml = argv[++i];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
50 }
144
gongo@localhost.localdomain
parents: 109
diff changeset
51 if (strcmp(argv[i], "-sg") == 0) {
gongo@localhost.localdomain
parents: 109
diff changeset
52 sg_number = (atoi)(argv[++i]);
gongo@localhost.localdomain
parents: 109
diff changeset
53 }
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
54 if (strcmp(argv[i], "-cpu") == 0) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
55 spenum = atoi(argv[++i]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
56 }
144
gongo@localhost.localdomain
parents: 109
diff changeset
57 if (strcmp(argv[i], "-help") == 0) {
gongo@localhost.localdomain
parents: 109
diff changeset
58 printf("%s\n", help_str);
gongo@localhost.localdomain
parents: 109
diff changeset
59 return -1;
gongo@localhost.localdomain
parents: 109
diff changeset
60 }
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
61 if (strcmp(argv[i], "-video") == 0) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
62 if (strcmp(argv[i+1], "sdl") == 0) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
63 vtype = VTYPE_SDL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
64 } else if (strcmp(argv[i+1], "fb") == 0) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
65 vtype = VTYPE_FB;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
66 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
67 i++;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
68 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
69 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
70
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
71 if (vtype == VTYPE_SDL) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
72 screen = new ViewerSDL(bpp, width, height, spenum);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
73 } else if (vtype == VTYPE_FB) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
74 screen = new ViewerFB(bpp, width, height, spenum);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
75 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
76
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
77 screen->video_init();
144
gongo@localhost.localdomain
parents: 109
diff changeset
78 screen->run_init(xml, sg_number);
gongo@localhost.localdomain
parents: 109
diff changeset
79
gongo@localhost.localdomain
parents: 109
diff changeset
80 return 0;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
81 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
82
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
83 int
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
84 cerium_main(int argc, char *argv[])
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
85 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
86 task_initialize();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
87
144
gongo@localhost.localdomain
parents: 109
diff changeset
88 return init(argc, argv);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
89
144
gongo@localhost.localdomain
parents: 109
diff changeset
90 //return 0;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
91 }