# HG changeset patch # User tkaito # Date 1276719089 -32400 # Node ID 6e1afe1016dca43d07b196ab29c07908599ddcb5 # Parent 7dc2d920fc7c313548b08fff490e5d726221d243 Task is not yet. diff -r 7dc2d920fc7c -r 6e1afe1016dc dandy.h --- a/dandy.h Tue Jun 15 11:14:36 2010 +0900 +++ b/dandy.h Thu Jun 17 05:11:29 2010 +0900 @@ -21,3 +21,37 @@ void *root; } *ObjPropertyPtr, ObjProperty; + +static const int ENEMY_NUM = 1; +extern ObjProperty charactor[ENEMY_NUM]; + +static const float player_speed = 10.0f; +static const float player_radius = 42.0f; + +static const float boss_radius_x = 65.4f; +static const float boss_radius_y = 130.8f; +static const float first_boss1_speed = 10.0; +static const float first_boss1_depth = 500.0; +static const float return_boss1_depth_speed = 10.0; + +static const float shot_speed = 30.0f; +static const float shot_radius = 42.4f; + +extern void title_move(SceneGraphPtr node, void *sgroot_, int w, int h); +extern void title_coll(SceneGraphPtr node, void *sgroot_, int w, int h, SceneGraphPtr tree); +extern void dandy_move(SceneGraphPtr node, void *sgroot_, int w, int h); +extern void dandy_coll(SceneGraphPtr node, void *sgroot_, int w, int h,SceneGraphPtr tree); +extern void create_title(void *sgroot, int w, int h); +extern void create_stage(void *sgroot, int w, int h); + +typedef struct enemy_state { + const char *charano; + int score; + int vital; + +} state; + +#define ENEMY_STATUS_TABLE { \ + ENEMY_STATUS("test00", 0, 0), \ + ENEMY_STATUS("greencrab", 330, 98) \ +} diff -r 7dc2d920fc7c -r 6e1afe1016dc main.cc --- a/main.cc Tue Jun 15 11:14:36 2010 +0900 +++ b/main.cc Thu Jun 17 05:11:29 2010 +0900 @@ -63,61 +63,47 @@ print_data(data, length, "before"); - /** - * Create Task - * create_task(Task ID); - */ twice = manager->create_task(TWICE_TASK); twice->set_cpu(SPE_ANY); - - /** - * Set of Input Data - * add_inData(address of input data, size of input data); - */ twice->add_inData(data, sizeof(int)*length); - /** - * Set of OutPut area - * add_outData(address of output area, size of output area); - */ twice->add_outData(data, sizeof(int)*length); - /** - * Set 32bits parameter - * add_param(32bit parameter); - */ twice->add_param((memaddr)length); - /* - * set_post() で ppe task を渡せるようにしたい - */ twice->set_post(twice_result, (void*)data, 0); - // add Active Queue twice->spawn(); } +#define ENEMY_STATUS(charano,score,hardness) {charano,score,hardness} +const state status[] = ENEMY_STATUS_TABLE; + +ObjProperty charactor[ENEMY_NUM]; + +void +init_charactor(Viewer *sgroot) +{ + sgroot->createFromXMLfile("xml/mydandy.xml"); + sgroot->createFromXMLfile("xml/gameover.xml"); + sgroot->createFromXMLfile("xml/greencrab.xml"); + sgroot->createFromXMLfile("xml/bluebullet.xml"); + sgroot->createFromXMLfile("xml/redbullet.xml"); + sgroot->createFromXMLfile("xml/title2.xml"); + + for (int i = 0; i < ENEMY_NUM; i++) { + charactor[1].root = (void*)sgroot->createSceneGraph(status[1].charano); + charactor[1].score = status[1].score; + charactor[1].vital = status[1].vital; + } + +} MainLoopPtr dandy::init(Viewer *sgroot, int w, int h) { - SceneGraphPtr back, title; - sgroot->createFromXMLfile("xml/title2.xml"); - -//init_charactor(sgroot); - - 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"); - + init_charactor(sgroot); + create_title(sgroot, w, h); return sgroot; } diff -r 7dc2d920fc7c -r 6e1afe1016dc mydandy.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mydandy.cc Thu Jun 17 05:11:29 2010 +0900 @@ -0,0 +1,56 @@ +#include "dandy.h" + +void shot_move(SceneGraphPtr node, void *sgroot_, int w, int h); +void shot_coll(SceneGraphPtr node, void *sgroot_, int w, int h, SceneGraphPtr tree); + +void +dandy_move(SceneGraphPtr node, void *sgroot_, int w, int h) +{ + SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_; + Pad *pad = sgroot->getController(); + + if (pad->right.isHold() && w > node->xyz[0]) { + node->xyz[0] += 10.0f; + } else if (pad->left.isHold() && 0 < node->xyz[0]) { + node->xyz[0] -= 10.0f; + } + if (pad->up.isHold() && 0 < node->xyz[1]) { + node->xyz[1] -= 10.0f; + } else if (pad->down.isHold() && h > node->xyz[1]) { + node->xyz[1] += 10.0f; + } + if (pad->circle.isPush()) { + SceneGraphPtr shot = sgroot->createSceneGraph("bluebullet"); + shot->set_move_collision(shot_move, shot_coll); + shot->xyz[0] = node->xyz[0]; + shot->xyz[1] = node->xyz[1] - player_radius; + node->addBrother(shot); + } +} + +void +dandy_coll(SceneGraphPtr node, void *sgroot_, int w, int h,SceneGraphPtr tree) +{ +/* + SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_; + SceneGraphIteratorPtr it = sgroot->getIterator(tree); + collision_obj(it, node, w, h, sgroot); +*/ +} + + +void +shot_move(SceneGraphPtr node, void *sgroot_, int w, int h) +{ + node->xyz[1] -= shot_speed; + + if (node->xyz[1] < 0) { + node->remove(); + } +} +void +shot_coll(SceneGraphPtr node, void *sgroot_, int w, int h,SceneGraphPtr tree){} + + +void +collision_obj(SceneGraphIteratorPtr it,SceneGraphPtr node ,int w, int h, void *sgroot_){} diff -r 7dc2d920fc7c -r 6e1afe1016dc stage_init.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stage_init.cc Thu Jun 17 05:11:29 2010 +0900 @@ -0,0 +1,55 @@ +#include "dandy.h" + +void stage_move(SceneGraphPtr node, void *sgroot_, int w, int h); +void stage_coll(SceneGraphPtr node, void *sgroot_, int w, int h,SceneGraphPtr tree); + +void +create_title(void *sgroot_, int w, int h) +{ + Viewer *sgroot = (Viewer *)sgroot_; + SceneGraphPtr back, title; + + back = sgroot->createSceneGraph(); + title = sgroot->createSceneGraph("title001"); + title->xyz[0] = w/2; + title->xyz[1] = h/2; + title->set_move_collision(title_move, title_coll); + back->addChild(title); + + sgroot->setSceneData(back); +} + +void +create_stage(void *sgroot_, int w, int h) +{ + 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); +} + +void +stage_move(SceneGraphPtr node, void *sgroot_, int w, int h) +{ + + //stage_plan(node, sgroot_, w, h); + node->frame += 1; + +} + +void +stage_coll(SceneGraphPtr node, void *sgroot_, int w, int h,SceneGraphPtr tree) +{ +} + + diff -r 7dc2d920fc7c -r 6e1afe1016dc title.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/title.cc Thu Jun 17 05:11:29 2010 +0900 @@ -0,0 +1,17 @@ +#include "dandy.h" + +void +title_move(SceneGraphPtr node, void *sgroot_, int w, int h) +{ + SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_; + Pad *pad = sgroot->getController(); + + if(pad->start.isPush()) { + create_stage(sgroot, w, h); + } +} + +void +title_coll(SceneGraphPtr node, void *sgroot_, int w, int h, SceneGraphPtr tree) +{ +}