view dandy.cc @ 6:581fa1888e2e

add bullet
author tkaito
date Mon, 07 Jun 2010 18:58:59 +0900
parents e089ac9ea221
children b0248931e40f
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)
{

}

MainLoopPtr
dandy::init(Viewer *sgroot, int w, int h)
{
  SceneGraphPtr back, title;

  sgroot->createFromXMLfile("xml/mydandy.xml");
  sgroot->createFromXMLfile("xml/title2.xml");
  sgroot->createFromXMLfile("xml/gameover.xml");
  sgroot->createFromXMLfile("xml/enemy_greenclab.xml");
  sgroot->createFromXMLfile("xml/bluebullet.xml");
  sgroot->createFromXMLfile("xml/redbullet.xml");
  

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