annotate TaskManager/Test/test_render/main.cpp @ 145:a5138d6e8996 draft

fix
author gongo@gendarme.cr.ie.u-ryukyu.ac.jp
date Tue, 02 Dec 2008 12:46:54 +0900
parents 594093237a15
children 70146cdec3d4
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 */
144
gongo@localhost.localdomain
parents: 109
diff changeset
8 int init(int argc, char *argc[]);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
9
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
10 extern void task_initialize();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
11
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
12 Viewer *screen;
028ffc9c0375 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\
gongo@localhost.localdomain
parents: 109
diff changeset
22 2: スネークさんが写るだけ\n\
gongo@localhost.localdomain
parents: 109
diff changeset
23 3: キューブが跳ね返りながら、勝手にキューブが増えて行く";
gongo@localhost.localdomain
parents: 109
diff changeset
24
gongo@localhost.localdomain
parents: 109
diff changeset
25 int
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
26 init(int argc, char *argv[])
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
27 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
28 int bpp = 0;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
29 int width = 640;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
30 int height = 480;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
31 int spenum = 1;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
32 char *xml = "xml_file/cube.xml";
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
33 video_type vtype = VTYPE_SDL;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
34
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
35 for(int i = 1; argv[i]; ++i)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
36 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
37 if (strcmp(argv[i], "-bpp") == 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
38 bpp = atoi(argv[++i]);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
39 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
40 if (strcmp(argv[i], "-width") == 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
41 width = atoi(argv[++i]);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
42 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
43 if (strcmp(argv[i], "-height") == 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
44 height = atoi(argv[++i]);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
45 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
46 if (strcmp(argv[i], "-xml") == 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
47 xml = argv[++i];
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
48 }
144
gongo@localhost.localdomain
parents: 109
diff changeset
49 if (strcmp(argv[i], "-sg") == 0) {
gongo@localhost.localdomain
parents: 109
diff changeset
50 sg_number = (atoi)(argv[++i]);
gongo@localhost.localdomain
parents: 109
diff changeset
51 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
52 if (strcmp(argv[i], "-cpu") == 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
53 spenum = atoi(argv[++i]);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
54 }
144
gongo@localhost.localdomain
parents: 109
diff changeset
55 if (strcmp(argv[i], "-help") == 0) {
gongo@localhost.localdomain
parents: 109
diff changeset
56 printf("%s\n", help_str);
gongo@localhost.localdomain
parents: 109
diff changeset
57 return -1;
gongo@localhost.localdomain
parents: 109
diff changeset
58 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
59 if (strcmp(argv[i], "-video") == 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
60 if (strcmp(argv[i+1], "sdl") == 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
61 vtype = VTYPE_SDL;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
62 } else if (strcmp(argv[i+1], "fb") == 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
63 vtype = VTYPE_FB;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
64 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
65 i++;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
66 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
67 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
68
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
69 if (vtype == VTYPE_SDL) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
70 screen = new ViewerSDL(bpp, width, height, spenum);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
71 } else if (vtype == VTYPE_FB) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
72 screen = new ViewerFB(bpp, width, height, spenum);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
73 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
74
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
75 screen->video_init();
144
gongo@localhost.localdomain
parents: 109
diff changeset
76 screen->run_init(xml, sg_number);
gongo@localhost.localdomain
parents: 109
diff changeset
77
gongo@localhost.localdomain
parents: 109
diff changeset
78 return 0;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
79 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
80
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
81 int
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
82 cerium_main(int argc, char *argv[])
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
83 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
84 task_initialize();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
85
144
gongo@localhost.localdomain
parents: 109
diff changeset
86 return init(argc, argv);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
87
144
gongo@localhost.localdomain
parents: 109
diff changeset
88 //return 0;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
89 }