Mercurial > hg > Members > tkaito > task_dandy
diff main.cc @ 28:0263721e7df8
undelete main.cc
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 10 Dec 2010 11:22:12 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cc Fri Dec 10 11:22:12 2010 +0900 @@ -0,0 +1,78 @@ +#include "dandy.h" + +#define ENEMY_STATUS(charano,score,hardness) {charano,score,hardness} +const state status[50] = ENEMY_STATUS_TABLE; + +extern void task_init(void); + +TaskManager *manager; +ObjPropertyPtr charactor; + +const char *usr_help_str = "Usage: ./twice [-length data_length] [-count task_num]\n\ + -length Number of data (default DATA_NUM (Func.h))\n\ + -count Number of task (default 1)\n"; + +int +init(int argc, char **argv) +{ + for (int i = 1; argv[i]; ++i) { + if (strcmp(argv[i], "-length") == 0) { + //length = atoi(argv[++i]); + } else if (strcmp(argv[i], "-count") == 0) { + //task = atoi(argv[++i]); + } + } + + return 0; +} + +void +init_charactor(Viewer *sgroot, int w, int h) +{ + sgroot->createFromXMLfile("xml/mydandy.xml"); + sgroot->createFromXMLfile("xml/greencrab.xml"); + sgroot->createFromXMLfile("xml/gameover.xml"); + sgroot->createFromXMLfile("xml/greencrab.xml"); + sgroot->createFromXMLfile("xml/bluebullet.xml"); + sgroot->createFromXMLfile("xml/redbullet.xml"); + sgroot->createFromXMLfile("xml/title2.xml"); + + for (int i = 0; i < ENEMY_NUM; i++) { + charactor[i].root = (void*)sgroot->createSceneGraph(status[i].charano); + charactor[i].score = status[i].score; + charactor[i].vital = status[i].vital; + } + create_title_back(sgroot, w, h); +} + +MainLoopPtr +Dandy::init(Viewer *sgroot, int w, int h) +{ + charactor = (ObjPropertyPtr)sgroot->manager->allocate(sizeof(ObjProperty)*ENEMY_NUM); + init_charactor(sgroot, w, h); + return sgroot; +} + +extern Application * +application() { + return new Dandy(); +} + +extern int init(TaskManager *manager, int argc, char *argv[]); +extern void task_initialize(); +static void TMend(TaskManager *manager); + +int +TMmain(TaskManager *manager,int argc, char *argv[]) +{ + task_init(); + task_initialize(); + manager->set_TMend(TMend); + return init(manager,argc, argv); +} + +void +TMend(TaskManager *manager) +{ + printf("game end\n"); +}