view stage_init.cc @ 13:401cd8a186e9

bug fix . But title not done.
author tkaito
date Wed, 04 Aug 2010 03:36:10 +0900
parents aecc2199251e
children e95c5c280f47
line wrap: on
line source

#include "dandy.h"


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

}

ObjProperty back_property;

void
create_title_back(Viewer *sgroot_, int w, int h) 
{
  
  Viewer *sgroot = sgroot_;
  SceneGraphPtr back;
  back_property.flag = 0;

  back = sgroot->createSceneGraph();
  sgroot->setSceneData(back);

  SceneGraphPtr title = (SceneGraphPtr)charactor[0].root;
  charactor[0].x = w/2;
  charactor[0].y = h/2;
  charactor[0].root = (void*)title;
  charactor[0].parent = (void*)back;
  int size = sizeof(ObjProperty);
  //printf("size = %d\n", size);
  sgroot->set_move_task(title, TITLE_MOVE, (void*)&charactor[0], 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);
}