Mercurial > hg > Game > Cerium
annotate Renderer/Engine/main.cc @ 606:242a9db53612 draft
32bit/64bit ABI (64 bit is not tested yet).
64bit ABI requires 64bit SDL library etc.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 07 Nov 2009 18:05:52 +0900 |
parents | 12135dde3b87 |
children | c7afc21e448d |
rev | line source |
---|---|
539 | 1 #include "TaskManager.h" |
2 #include "viewer.h" | |
3 #include "viewerSDL.h" | |
4 #include "viewerFB.h" | |
541
1a31b8820a4d
Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
539
diff
changeset
|
5 #include "Application.h" |
539 | 6 |
7 /* prototype */ | |
556 | 8 extern int init(TaskManager *manager, int argc, char *argv[]); |
539 | 9 |
10 extern void task_initialize(); | |
541
1a31b8820a4d
Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
539
diff
changeset
|
11 extern Application *application(); |
556 | 12 extern int init(TaskManager *manager, int argc, char *argv[]); |
539 | 13 |
556 | 14 // 大域変数は禁止 |
539 | 15 //static Viewer *screen; |
16 | |
556 | 17 /* |
539 | 18 const char *usr_help_str = "Usage: ./test_nogl [OPTION]\n\ |
19 -cpu Number of SPE (default 1)\n\ | |
20 -width, -height window size (default 640x480)\n\ | |
21 -sg Draw SceneGraph\n\ | |
22 0: Joystick の 丸ボタン(Keyboard だとx) を押すと、キューブが二つに分かれる\n\ | |
23 1: 0 のキューブが大きい版\n\ | |
24 2: テクスチャテスト:576x384\n\ | |
25 3: テクスチャテスト:1024x768\n\ | |
26 4: テクスチャテスト:2048x1536\n\ | |
27 5: 地球が動き、その周りを月が自転、公転する\n\ | |
28 6 以降: キューブが跳ね返りながら、勝手にキューブが増えて行く\n"; | |
556 | 29 */ |
539 | 30 |
31 int | |
32 init(TaskManager *manager, int argc, char *argv[]) | |
33 { | |
34 int bpp = 32; | |
35 int width = 640; | |
36 int height = 480; | |
37 int spenum = 1; | |
38 video_type vtype = VTYPE_SDL; | |
39 | |
40 for(int i = 1; argv[i]; ++i) | |
41 { | |
42 if (strcmp(argv[i], "-bpp") == 0) { | |
43 bpp = atoi(argv[++i]); | |
44 } | |
45 if (strcmp(argv[i], "-width") == 0) { | |
46 width = atoi(argv[++i]); | |
47 } | |
48 if (strcmp(argv[i], "-height") == 0) { | |
49 height = atoi(argv[++i]); | |
50 } | |
51 if (strcmp(argv[i], "-cpu") == 0) { | |
52 spenum = atoi(argv[++i]); | |
53 } | |
54 if (strcmp(argv[i], "-video") == 0) { | |
55 if (strcmp(argv[i+1], "sdl") == 0) { | |
56 vtype = VTYPE_SDL; | |
57 } else if (strcmp(argv[i+1], "fb") == 0) { | |
58 vtype = VTYPE_FB; | |
59 } | |
60 i++; | |
61 } | |
62 } | |
63 | |
64 Viewer *screen; | |
65 if (vtype == VTYPE_SDL) { | |
66 screen = new ViewerSDL(manager, bpp, width, height, spenum); | |
67 } else if (vtype == VTYPE_FB) { | |
68 screen = new ViewerFB(manager, bpp, width, height, spenum); | |
69 }else{ | |
70 screen = new ViewerSDL(manager, bpp, width, height, spenum); | |
71 } | |
72 | |
73 screen->video_init(manager); | |
541
1a31b8820a4d
Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
539
diff
changeset
|
74 screen->run_init(manager, application()); |
539 | 75 |
76 | |
77 return 0; | |
78 } | |
79 | |
556 | 80 #if 0 |
606
242a9db53612
32bit/64bit ABI (64 bit is not tested yet).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
556
diff
changeset
|
81 |
242a9db53612
32bit/64bit ABI (64 bit is not tested yet).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
556
diff
changeset
|
82 // These are defined in Application |
242a9db53612
32bit/64bit ABI (64 bit is not tested yet).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
556
diff
changeset
|
83 |
539 | 84 int |
85 TMmain(TaskManager *manager, int argc, char *argv[]) | |
86 { | |
87 task_initialize(); | |
556 | 88 manager->set_TMend(TMend); |
539 | 89 return init(manager, argc, argv); |
90 | |
91 } | |
92 | |
93 void | |
94 TMend(TaskManager *manager) | |
95 { | |
96 printf("test_nogl end\n"); | |
97 } | |
556 | 98 |
99 #endif | |
606
242a9db53612
32bit/64bit ABI (64 bit is not tested yet).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
556
diff
changeset
|
100 |
242a9db53612
32bit/64bit ABI (64 bit is not tested yet).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
556
diff
changeset
|
101 /* end */ |