109
|
1 #include "TaskManager.h"
|
|
2 #include "viewer.h"
|
|
3 #include "viewerSDL.h"
|
|
4 #include "viewerFB.h"
|
|
5 #include "Func.h"
|
|
6
|
|
7 /* prototype */
|
144
|
8 int init(int argc, char *argc[]);
|
109
|
9
|
|
10 extern void task_initialize();
|
|
11
|
|
12 Viewer *screen;
|
|
13
|
144
|
14 static int sg_number = 0;
|
|
15
|
|
16 static char *help_str = "Usage: ./test_nogl [OPTION]\n\
|
|
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\
|
|
22 2: スネークさんが写るだけ\n\
|
|
23 3: キューブが跳ね返りながら、勝手にキューブが増えて行く";
|
|
24
|
|
25 int
|
109
|
26 init(int argc, char *argv[])
|
|
27 {
|
|
28 int bpp = 0;
|
|
29 int width = 640;
|
|
30 int height = 480;
|
|
31 int spenum = 1;
|
|
32 char *xml = "xml_file/cube.xml";
|
|
33 video_type vtype = VTYPE_SDL;
|
|
34
|
|
35 for(int i = 1; argv[i]; ++i)
|
|
36 {
|
|
37 if (strcmp(argv[i], "-bpp") == 0) {
|
|
38 bpp = atoi(argv[++i]);
|
|
39 }
|
|
40 if (strcmp(argv[i], "-width") == 0) {
|
|
41 width = atoi(argv[++i]);
|
|
42 }
|
|
43 if (strcmp(argv[i], "-height") == 0) {
|
|
44 height = atoi(argv[++i]);
|
|
45 }
|
|
46 if (strcmp(argv[i], "-xml") == 0) {
|
|
47 xml = argv[++i];
|
|
48 }
|
144
|
49 if (strcmp(argv[i], "-sg") == 0) {
|
|
50 sg_number = (atoi)(argv[++i]);
|
|
51 }
|
109
|
52 if (strcmp(argv[i], "-cpu") == 0) {
|
|
53 spenum = atoi(argv[++i]);
|
|
54 }
|
144
|
55 if (strcmp(argv[i], "-help") == 0) {
|
|
56 printf("%s\n", help_str);
|
|
57 return -1;
|
|
58 }
|
109
|
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
|
|
78 return 0;
|
109
|
79 }
|
|
80
|
|
81 int
|
|
82 cerium_main(int argc, char *argv[])
|
|
83 {
|
|
84 task_initialize();
|
|
85
|
144
|
86 return init(argc, argv);
|
109
|
87
|
144
|
88 //return 0;
|
109
|
89 }
|