Mercurial > hg > Game > Cerium
view TaskManager/Test/test_render/main.cc @ 537:577043af6684 draft
get linda server addr from command line arg
author | kazz@e065701.local |
---|---|
date | Fri, 23 Oct 2009 14:13:03 +0900 |
parents | 0d2dc1869cbe |
children |
line wrap: on
line source
#include "TaskManager.h" #include "viewer.h" #include "viewerSDL.h" #include "viewerFB.h" #include "Func.h" /* prototype */ static int init(TaskManager *manager, int argc, char *argv[]); static void TMend(TaskManager *manager); extern void task_initialize(); // 帯域変数は禁止 //static Viewer *screen; static int sg_number = 0; const char *usr_help_str = "Usage: ./test_nogl [OPTION]\n\ -cpu Number of SPE (default 1)\n\ -width, -height window size (default 640x480)\n\ -sg Draw SceneGraph\n\ 0: Joystick の 丸ボタン(Keyboard だとx) を押すと、キューブが二つに分かれる\n\ 1: 0 のキューブが大きい版\n\ 2: テクスチャテスト:576x384\n\ 3: テクスチャテスト:1024x768\n\ 4: テクスチャテスト:2048x1536\n\ 5: 地球が動き、その周りを月が自転、公転する\n\ 6 以降: キューブが跳ね返りながら、勝手にキューブが増えて行く\n"; int init(TaskManager *manager, int argc, char *argv[]) { int bpp = 32; int width = 640; int height = 480; int spenum = 1; const char *xml = "xml_file/cube.xml"; const char *linda_serv = "localhost"; video_type vtype = VTYPE_SDL; for(int i = 1; argv[i]; ++i) { if (strcmp(argv[i], "-bpp") == 0) { bpp = atoi(argv[++i]); } if (strcmp(argv[i], "-width") == 0) { width = atoi(argv[++i]); } if (strcmp(argv[i], "-height") == 0) { height = atoi(argv[++i]); } if (strcmp(argv[i], "-xml") == 0) { xml = argv[++i]; } if (strcmp(argv[i], "-linda") == 0) { linda_serv = argv[++i]; } if (strcmp(argv[i], "-sg") == 0) { sg_number = (atoi)(argv[++i]); } if (strcmp(argv[i], "-cpu") == 0) { spenum = atoi(argv[++i]); } if (strcmp(argv[i], "-video") == 0) { if (strcmp(argv[i+1], "sdl") == 0) { vtype = VTYPE_SDL; } else if (strcmp(argv[i+1], "fb") == 0) { vtype = VTYPE_FB; } i++; } } Viewer *screen; if (vtype == VTYPE_SDL) { screen = new ViewerSDL(manager, bpp, width, height, spenum); } else if (vtype == VTYPE_FB) { screen = new ViewerFB(manager, bpp, width, height, spenum); }else{ screen = new ViewerSDL(manager, bpp, width, height, spenum); } screen->video_init(manager); screen->run_init(manager, xml, sg_number, linda_serv); manager->set_TMend(TMend); return 0; } int TMmain(TaskManager *manager, int argc, char *argv[]) { task_initialize(); return init(manager, argc, argv); //return 0; } void TMend(TaskManager *manager) { printf("test_nogl end\n"); }