view main.cc @ 8:7c60ef3fca5b

test
author tkaito
date Wed, 07 Jul 2010 03:11:52 +0900
parents c015109a6041
children 27d3291a7c82
line wrap: on
line source

#include "dandy.h"

extern void task_init(void);

//TaskManager *manager;

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;
}

#define ENEMY_STATUS(charano,score,hardness) {charano,score,hardness}
const state status[50] = ENEMY_STATUS_TABLE;

void
init_charactor(Viewer *sgroot)
{
  sgroot->createFromXMLfile("xml/mydandy.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 < 2; i++) {
    charactor[i].root  = (void*)sgroot->createSceneGraph(status[i].charano);
    charactor[i].score = status[i].score;
    charactor[i].vital = status[i].vital;
   }

}

ObjPropertyPtr charactor;

MainLoopPtr
dandy::init(Viewer *sgroot, int w, int h)
{
  charactor = (ObjPropertyPtr)sgroot->manager->allocate(sizeof(ObjPropertyPtr)*16);
  init_charactor(sgroot);
  create_back(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[])
{
  /*  
    if (init(argc, argv) < 0) {
	return -1;
    }
  */
    // Task Register
    //   ppe/task_init.cc
    task_init();
    /*
    for (int i = 0; i < task; ++i) {
	twice_init(manager);
    }
    */
    //create_title(sgroot, w, h);
    task_initialize();
    manager->set_TMend(TMend);
    return init(manager,argc, argv);
}

void
TMend(TaskManager *manager)
{
    printf("game end\n");
}