# HG changeset patch # User Shinji KONO # Date 1291947732 -32400 # Node ID 0263721e7df81d6980ac57a5932917e724fb37aa # Parent 34fde39c0a31de78c440557d4ddea9ac992fa2b2 undelete main.cc diff -r 34fde39c0a31 -r 0263721e7df8 main.cc --- /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"); +} diff -r 34fde39c0a31 -r 0263721e7df8 schedule.o Binary file schedule.o has changed diff -r 34fde39c0a31 -r 0263721e7df8 stage_init.o Binary file stage_init.o has changed