diff TaskManager/Test/test_render/main.cpp @ 109:028ffc9c0375 draft

Cerium cvs version
author gongo@gendarme.local
date Wed, 12 Nov 2008 17:39:33 +0900
parents
children 594093237a15
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TaskManager/Test/test_render/main.cpp	Wed Nov 12 17:39:33 2008 +0900
@@ -0,0 +1,69 @@
+#include "TaskManager.h"
+#include "viewer.h"
+#include "viewerSDL.h"
+#include "viewerFB.h"
+#include "Func.h"
+
+/* prototype */
+void init(int argc, char *argc[]);
+
+extern void task_initialize();
+
+Viewer *screen;
+
+void
+init(int argc, char *argv[])
+{
+    int bpp    = 0;
+    int width  = 640;
+    int height = 480;
+    int spenum = 1;
+    char *xml  = "xml_file/cube.xml";
+    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], "-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++;
+	}
+    }
+
+    if (vtype == VTYPE_SDL) {
+	screen = new ViewerSDL(bpp, width, height, spenum);
+    } else if (vtype == VTYPE_FB) {
+	screen = new ViewerFB(bpp, width, height, spenum);
+    }
+
+    screen->video_init();
+    screen->run_init(xml);
+}
+
+int
+cerium_main(int argc, char *argv[])
+{
+    task_initialize();
+
+    init(argc, argv);
+
+    return 0;
+}