view stage_init.cc @ 7:c015109a6041

schedule add. 10% done.
author tkaito
date Tue, 29 Jun 2010 04:25:32 +0900
parents 661ec1e92042
children 7c60ef3fca5b
line wrap: on
line source

#include "dandy.h"

void
back_move(SceneGraphPtr node, void *sgroot_, int w, int h)
{
  schedule(node, sgroot_, w, h);
  node->frame += 1;
}

void
back_coll(SceneGraphPtr node, void *sgroot_, int w, int h, SceneGraphPtr tree)
{
}

void
create_title(SchedTask *s, void *charactor_, void *b)
{
  ObjPropertyPtr charactor = (ObjPropertyPtr)charactor_; 
  SceneGraphPtr back1, title;
  back1 = (SceneGraphPtr)charactor[0].parent;
  title = (SceneGraphPtr)charactor[0].root;
  
  title->xyz[0] = charactor[0].x;
  title->xyz[1] = charactor[0].y;

  back1->addChild(title);

}

void
create_back(void *sgroot_, int w, int h) 
{
  Viewer *sgroot = (Viewer *)sgroot_;
  SceneGraphPtr back;

  back = sgroot->createSceneGraph();
  back->set_move_collision(back_move, back_coll);
  sgroot->setSceneData(back);

  charactor[0].x  = w/2;
  charactor[0].y  = h/2;
  charactor[0].parent = (void*)back;
  
  int size = sizeof(ObjPropertyPtr)*16;

  /* set_game_task(int id, ObjProperty property, int size, PostFunction post_func) */
  sgroot->set_game_task(TITLE_MOVE, charactor, size, create_title);

}


void
create_stage(void *sgroot_, int w, int h, ObjPropertyPtr charactor) 
{
  SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_;

  SceneGraphPtr stage = sgroot->createSceneGraph();
  SceneGraphPtr mydandy = sgroot->createSceneGraph("mydandy");

  //mydandy->set_move_collision(dandy_move, dandy_coll);
  //stage->set_move_collision(stage_move, stage_coll);
  
  mydandy->xyz[0] = w/2;
  mydandy->xyz[1] = h*0.9;
  mydandy->xyz[2] = 0.0f;
  
  stage->addChild(mydandy);
  sgroot->setSceneData(stage);
}