view dandy.cc @ 8:b87dcc11a6d0

fix
author tkaito
date Mon, 14 Jun 2010 07:48:42 +0900
parents b0248931e40f
children
line wrap: on
line source

#include <math.h>
#include "SceneGraphRoot.h"
#include "dandy.h"

void
title_idle(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h)
{

}

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");

}

MainLoopPtr
dandy::init(Viewer *sgroot, int w, int h)
{
  SceneGraphPtr back, title;
  sgroot->createFromXMLfile("xml/title2.xml");  
  
  init_charactor(sgroot);

  back  = sgroot->createSceneGraph();
  title = sgroot->createSceneGraph("title001");
  title->xyz[0] = w/2;
  title->xyz[1] = h/2;
  title->set_move_collision(title_idle, title_collision);  
  back->addChild(title);

  sgroot->setSceneData(back);

  //mydandy = sgroot->getSgid("mydandy01");
  //enemy = sgroot->getSgid("ENEMY");
  
  return sgroot;
}

extern Application *
application() {
    return new dandy();
}

const char *usr_help_str = "Usage: ./test_nogl [OPTION]\n";

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_initialize();
    manager->set_TMend(TMend);
    return init(manager, argc, argv);

}

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