view stage_init.cc @ 19:632ce41a842a

testing game task with pad's input
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Thu, 26 Aug 2010 03:37:36 +0900
parents 2c188b2becec
children fd9deaa67de9
line wrap: on
line source

#include "dandy.h"

void
create_title(SchedTask *s, void *charactor_, void *b)
{
    ObjPropertyPtr charactor = (ObjPropertyPtr)charactor_;

    if (charactor->flag == 1) {
      /* タイトルが終わり、次はココにゲームの準備をする処理を書く */
      printf("Title finished");
    }
}

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

    back = sgroot->createSceneGraph();
    charactor[0].x = w/2;
    charactor[0].y = h/2;
    charactor[0].vx = 1.0;
    charactor[0].vy = 1.0;
    charactor[0].flag = 0;
    charactor[0].parent = (void*)back;
    
    SceneGraphPtr title = (SceneGraphPtr)charactor[0].root;
    title->xyz[0] = charactor[0].x;
    title->xyz[1] = charactor[0].y;
    
    int size = sizeof(ObjProperty);
    back->addChild(title);
    sgroot->setSceneData(back);  
    sgroot->set_pad_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);
}