Mercurial > hg > Members > tkaito > task_dandy
view stage_init.cc @ 23:3fb8a6a34e24
debug and keep up with task_array
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 26 Oct 2010 17:28:56 +0900 |
parents | fd9deaa67de9 |
children | a131729d6e4d 6bea374ee604 |
line wrap: on
line source
#include "dandy.h" void create_crab(SchedTask *s, void *charactor_, void *b) { ObjPropertyPtr charactor = (ObjPropertyPtr)charactor_; SceneGraphPtr crab = (SceneGraphPtr)charactor->root; crab->xyz[0] = charactor->x; crab->xyz[1] = charactor->y; } void create_title(SchedTask *s, void *charactor_, void *b) { ObjPropertyPtr charactor = (ObjPropertyPtr)charactor_; SceneGraphPtr title = (SceneGraphPtr)charactor->root; if (charactor->flag == 1) { title->remove(); charactor->flag = 0; } } void create_title_back(Viewer *sgroot_, int w, int h) { Viewer *sgroot = sgroot_; SceneGraphPtr root = sgroot->createSceneGraph(); SceneGraphPtr title = (SceneGraphPtr)charactor[0].root; charactor[0].x = w/2; charactor[0].y = h/2; charactor[0].vx = 0.0; charactor[0].vy = 0.0; charactor[0].flag = 0; charactor[0].parent = (void*)root; title->xyz[0] = charactor[0].x; title->xyz[1] = charactor[0].y; SceneGraphPtr crab = (SceneGraphPtr)charactor[1].root; charactor[1].x = w/2; charactor[1].y = h/2; charactor[1].vx = 1.0; charactor[1].vy = 1.0; charactor[1].flag = 0; charactor[1].parent = (void*)root; crab->xyz[0] = charactor[1].x; crab->xyz[1] = charactor[1].y; crab->flag_drawable = 0; int size = sizeof(ObjProperty); sgroot->task_array_init(TITLE_MOVE, TASK_NUM, PARAMETER, INDATA_NUM, OUTDATA_NUM); sgroot->set_pad_task(title, TITLE_MOVE, (void*)&charactor[0], size, create_title); sgroot->set_pad_task(crab, CRAB_MOVE, (void*)&charactor[1], size, create_crab); root->addChild(title); root->addChild(crab); sgroot->setSceneData(root); } 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); }