annotate TaskManager/Test/test_render/main.cpp @ 132:e7c80537b6aa

add XML
author gongo@charles.cr.ie.u-ryukyu.ac.jp
date Tue, 25 Nov 2008 18:19:53 +0900
parents 5c194c71eca8
children 949af5ee555e
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 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
8 void init(int argc, char *argc[]);
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
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
14 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
15 init(int argc, char *argv[])
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
16 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
17 int bpp = 0;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
18 int width = 640;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
19 int height = 480;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
20 int spenum = 1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
21 char *xml = "xml_file/cube.xml";
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
22 video_type vtype = VTYPE_SDL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
23
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
24 for(int i = 1; argv[i]; ++i)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
25 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
26 if (strcmp(argv[i], "-bpp") == 0) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
27 bpp = atoi(argv[++i]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
28 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
29 if (strcmp(argv[i], "-width") == 0) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
30 width = atoi(argv[++i]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
31 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
32 if (strcmp(argv[i], "-height") == 0) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
33 height = atoi(argv[++i]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
34 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
35 if (strcmp(argv[i], "-xml") == 0) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
36 xml = argv[++i];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
37 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
38 if (strcmp(argv[i], "-cpu") == 0) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
39 spenum = atoi(argv[++i]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
40 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
41 if (strcmp(argv[i], "-video") == 0) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
42 if (strcmp(argv[i+1], "sdl") == 0) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
43 vtype = VTYPE_SDL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
44 } else if (strcmp(argv[i+1], "fb") == 0) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
45 vtype = VTYPE_FB;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
46 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
47 i++;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
48 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
49 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
50
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
51 if (vtype == VTYPE_SDL) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
52 screen = new ViewerSDL(bpp, width, height, spenum);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
53 } else if (vtype == VTYPE_FB) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
54 screen = new ViewerFB(bpp, width, height, spenum);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
55 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
56
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
57 screen->video_init();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
58 screen->run_init(xml);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
59 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
60
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
61 int
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
62 cerium_main(int argc, char *argv[])
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
63 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
64 task_initialize();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
65
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
66 init(argc, argv);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
67
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
68 return 0;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
69 }