# HG changeset patch # User Shinji KONO # Date 1253676996 -32400 # Node ID d47c5d865970d89448e1e1370c994cf50b8899e5 # Parent a18ded47c5dd9c6b9b0eb3f1f866f928be2d4b44 make Application sub directory diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/back_action.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/back_action.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,24 @@ +#include +#include "SceneGraphRoot.h" +#include "SGList.h" +#include "ball_action.h" +using namespace std; + +void +back_move(SceneGraphPtr node, int w, int h) +{ + Pad *pad = sgroot->getController(); + + if (pad->triangle.isPush()) { + SceneGraphPtr ball = sgroot->createSceneGraph(Ball); + ball->xyz[0] = -100; + ball->set_move_collision(ball_move, ball_coll); + node->addChild(ball); + } +} + +void +back_coll(SceneGraphPtr node, int w, int h, SceneGraphPtr tree) +{ + +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/back_action.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/back_action.h Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,2 @@ +void back_move(SceneGraphPtr, int, int); +void back_coll(SceneGraphPtr, int, int, SceneGraphPtr); diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/ball_action.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/ball_action.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,16 @@ +#include +#include "SceneGraphRoot.h" +#include "SGList.h" +using namespace std; + +void +ball_move(SceneGraphPtr node, int w, int h) +{ + node->xyz[0] += 4; +} + +void +ball_coll(SceneGraphPtr node, int w, int h, SceneGraphPtr tree) +{ + if (node->xyz[0] > 600) node->remove(); +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/ball_action.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/ball_action.h Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,2 @@ +void ball_move(SceneGraphPtr, int, int); +void ball_coll(SceneGraphPtr, int, int, SceneGraphPtr); diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/ball_bound.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/ball_bound.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,128 @@ +#include +#include +#include "SceneGraphRoot.h" +#include "SGList.h" + +// prototype +static void ball_move(SceneGraphPtr node, int screen_w, int screen_h); +static void ball_collision(SceneGraphPtr node, int screen_w, int screen_h, SceneGraphPtr tree); +static void ball_collision_idle(SceneGraphPtr, int w, int h, SceneGraphPtr tree); + + +static float vy = 0.0f; // y 方向速度 +static float dt = 1.0/1.0f; // frame rate + +static float e = -0.8f; // 反発係数 +static float g = 9.8f; // 重力加速度 +//static float v0 = 0.0f; // 初速は 0 + +static float h0; // 初期高さ +static float ball_radius = 100.0f; + +static float speed = 10.0f; + +static void +ball_move_idle2(SceneGraphPtr node, int screen_w, int screen_h) +{ + Pad *pad = sgroot->getController(); + + if (pad->circle.isHold()) { + if (pad->left.isHold()) { + node->xyz[0] -= speed; + if(node->xyz[0] < ball_radius) + node->xyz[0] = ball_radius; + } else if (pad->right.isHold()) { + node->xyz[0] += speed; + if(node->xyz[0] > screen_w - ball_radius) + node->xyz[0] = screen_w - ball_radius; + } + + if (pad->up.isHold()) { + node->xyz[1] -= speed; + } else if (pad->down.isHold()) { + node->xyz[1] += speed; + if(node->xyz[1] > screen_h - ball_radius) + node->xyz[1] = screen_h - ball_radius; + } + } else { + node->set_move_collision(ball_move, ball_collision); + } +} + +static int time = 0; + +static void +ball_move_idle(SceneGraphPtr node, int screen_w, int screen_h) +{ + Pad *pad = sgroot->getController(); + + if (pad->circle.isPush()) { + node->set_move_collision(ball_move_idle2, ball_collision_idle); + time = 0; + } + + time++; + + if (time > 90) { + float w = (float)random(); + + w = fmodf(w, screen_w - ball_radius*2); + node->xyz[0] = w + ball_radius; + node->xyz[1] = h0; + node->set_move_collision(ball_move, ball_collision); + time = 0; + } +} + +static void +ball_move(SceneGraphPtr node, int screen_w, int screen_h) +{ + vy += g * dt; + node->xyz[1] += vy * dt; + // node->xyz[0] += 10.0f; +} + +static void +ball_collision_idle(SceneGraphPtr, int w, int h, SceneGraphPtr tree) +{ +} + +static void +ball_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree) +{ + if (node->xyz[1] > screen_h - ball_radius) { + node->xyz[1] = screen_h - ball_radius; + + vy *= e; + if (vy > -g && vy < 0) { + vy = 0.0; + node->set_move_collision(ball_move_idle, ball_collision_idle); + } + } +} + + +void +ball_bound_init(TaskManager *manager, int screen_w, int screen_h) +{ + SceneGraphPtr ball; + + // 固定した値で srandom すると、毎回同じ、random() 列が生成される + // random な値が欲しいなら、man random に方法が書いてあります。 + srandom(100); + + sgroot->createFromXMLfile(manager, "xml_file/Ball.xml"); + ball = sgroot->createSceneGraph(Ball); + ball->set_move_collision(ball_move, ball_collision); + + h0 = screen_h/2; + h0 = -1000; + + ball->xyz[0] = screen_w/2; + //ball->xyz[0] = 0.0f; + ball->xyz[1] = h0; + ball->xyz[2] = 30.0f; + + sgroot->setSceneData(ball); +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/boss1_action.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/boss1_action.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,269 @@ +#include "SGList.h" +#include "boss1_action.h" + +/* +static void +null_move(SceneGraphPtr node, int screen_w, int screen_h) +{ +} +*/ + +static void +null_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree) +{ +} + + +static void +boss1_move_right(SceneGraphPtr node, int screen_w, int screen_h) { + node->xyz[0] += node->stack_xyz[0]; + if(node->xyz[0] > (screen_w - boss_radius_x)) { + node->set_move_collision(boss1_move_left, null_collision); + } +} + +//ボスが左に移動する動作 +static void +boss1_move_left(SceneGraphPtr node, int screen_w, int screen_h) { + node->xyz[0] -= node->stack_xyz[0]; + if(node->xyz[0] < boss_radius_x) { + node->set_move_collision(boss1_move_right, null_collision); + } +} + +//ボスが戦闘位置へ戻る時の動作 +/* +static void +boss1_move_return(SceneGraphPtr node, int screen_w, int screen_h) +{ + node->xyz[1] -= node->stack_xyz[1]; + node->xyz[2] -= node->stack_xyz[2]; + + if((node->xyz[2] = 0)) { + node->stack_xyz[0] = 1.0; + node->set_move_collision(boss1_move_left, null_collision); + } +} +*/ + +//ボス登場時の動き +/* +static void +boss1_first_move(SceneGraphPtr node, int screen_w, int screen_h) +{ + node->xyz[1] += node->stack_xyz[1]; + if(node->xyz[1] > screen_h) { + float time = first_boss1_depth / node->stack_xyz[2]; + node->stack_xyz[1] = (screen_h - boss_radius_y) / time; + node->stack_xyz[2] = return_boss1_depth_speed; + node->set_move_collision(boss1_move_return, null_collision); + } +} +*/ + +static void +player_move(SceneGraphPtr node, int screen_w, int screen_h) +{ + Pad *pad = sgroot->getController(); + + if (pad->left.isPush() + || pad->left.isHold()) { +#if 0 + SceneGraphPtr player_left; + player_left = sgroot->createSceneGraph(PLAYER_L); + player_left->set_move_collision(player_move_left, null_collision); + player_left->xyz[0] = node->xyz[0]; + player_left->xyz[1] = node->xyz[1]; + node->addChild(player_left); + node->flag_drawable = 1; +#endif + node->xyz[0] -= player_speed; + + if (node->xyz[0] - player_radius< 0) { + node->xyz[0] = player_radius; + } + } + + + if (pad->right.isPush() + || pad->right.isHold()) { + node->xyz[0] += player_speed; + + if (node->xyz[0] + player_radius > screen_w) { + node->xyz[0] = screen_w - player_radius; + } + } + + if (pad->up.isPush() + || pad->up.isHold()) { + node->xyz[1] -= player_speed; + + if (node->xyz[1] - player_radius < 0) { + node->xyz[1] = player_radius; + } + } + + if (pad->down.isPush() + || pad->down.isHold()) { + node->xyz[1] += player_speed; + + if (node->xyz[1] + player_radius > screen_h) { + node->xyz[1] = screen_h - player_radius; + } + } + + if (pad->circle.isPush()) { + SceneGraphPtr shot = sgroot->createSceneGraph(P_SHOT1); + shot->set_move_collision(shot_move, shot_collision); + shot->xyz[0] = node->xyz[0]; + shot->xyz[1] = node->xyz[1] - player_radius; + node->addBrother(shot); + } +} + +static void +player_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree) +{ + //自機とボスのx,y座標での距離と2点間の距離 + static float x_distant, y_distant, distance; + //ボスの四角形の四隅の座標 + // static float boss_low_x, boss_low_y, boss_high_x, boss_high_y; + + SceneGraphIteratorPtr it = sgroot->getIterator(tree); + + + for (; it->hasNext(BOSS1);) { + it->next(BOSS1); + SceneGraphPtr enemy = it->get(); + + //各変数の初期化 + x_distant = node->xyz[0] - enemy->xyz[0]; + y_distant = node->xyz[1] - enemy->xyz[1]; + + //hypotfで2点間の距離を求める + distance = hypotf(x_distant, y_distant); + + /*四角形と円のcollision + if( (fabs( node->xyz[1] - ( boss_low_y ))) + */ + + //円同士のcollision + if(distance < (player_radius + boss_radius_y)) { + printf("!!!CAUTION!!!\n"); + } + } +} + +static void +shot_move(SceneGraphPtr node, int screen_w, int screen_h) +{ + node->xyz[1] -= shot_speed; + + // 描画領域から抜けたら削除 + if (node->xyz[1] < 0) { + node->remove(); + } +} + +static void +shot_collision(SceneGraphPtr node, int screen_2, int screen_h, + SceneGraphPtr tree) +{ + //自機とボスのx,y座標での距離と2点間の距離 + static float x_distant, y_distant, distance; + //ボスの四角形の四隅の座標 + // static float boss_low_x, boss_low_y, boss_high_x, boss_high_y; + + SceneGraphIteratorPtr it = sgroot->getIterator(tree); + + + for (; it->hasNext(BOSS1);) { + it->next(BOSS1); + SceneGraphPtr enemy = it->get(); + + x_distant = node->xyz[0] - enemy->xyz[0]; + y_distant = node->xyz[1] - enemy->xyz[1]; + + //hypotfで2点間の距離を求める + distance = hypotf(x_distant, y_distant); + + //円同士のcollision + if(distance < boss_radius_y) { + SceneGraphPtr blast = sgroot->createSceneGraph(BLAST1); + + blast->set_move_collision(blast_move, null_collision); + blast->xyz[0] = node->xyz[0]; + blast->xyz[1] = node->xyz[1]; + node->addBrother(blast); + node->remove(); + } + } +} + +static void +blast_move(SceneGraphPtr node, int screen_w, int screen_h) +{ + if(node->sgid > BLAST8) { + SceneGraphPtr blast = sgroot->createSceneGraph(node->sgid - 1); + blast->set_move_collision(blast_move, null_collision); + blast->xyz[0] = node->xyz[0]; + blast->xyz[1] = node->xyz[1]; + node->addBrother(blast); + } + + if (node->sgid == BLAST8) { + node->flag_drawable = 1; + } + + if((node->frame > 1)) { + node->remove(); + } + node->frame += 1; +} + +void +boss1_init(TaskManager *manager, int screen_w, int screen_h) +{ + SceneGraphPtr root; + SceneGraphPtr player; + SceneGraphPtr boss1; + SceneGraphPtr left_parts; + SceneGraphPtr right_parts; + + sgroot->createFromXMLfile(manager, "xml_file/boss1.xml"); + sgroot->createFromXMLfile(manager, "xml_file/player1.xml"); + sgroot->createFromXMLfile(manager, "xml_file/p_shot.xml"); + sgroot->createFromXMLfile(manager, "xml_file/blast.xml"); + + //rootとなるSceneGraphを生成 + root = sgroot->createSceneGraph(); + + //自機の初期化 + player = sgroot->createSceneGraph(PLAYER); + player->xyz[0] = screen_w/2; + player->xyz[1] = screen_h - player_radius; + root->addChild(player); + + //ボスの初期化 + boss1 = sgroot->createSceneGraph(BOSS1); + boss1->xyz[0] = screen_w/2; + boss1->xyz[1] = boss_radius_y; + // boss1->xyz[2] = first_boss1_depth; + boss1->stack_xyz[0] = first_boss1_speed; + root->addChild(boss1); + + //ボスの左右パーツを追加 + left_parts = sgroot->createSceneGraph(BOSS1_L); + boss1->addChild(left_parts); + right_parts = sgroot->createSceneGraph(BOSS1_R); + boss1->addChild(right_parts); + + //各機体の動きと当たり判定をセット + player->set_move_collision(player_move, player_collision); + boss1->set_move_collision(boss1_move_left, null_collision); + + //仕上げ + sgroot->setSceneData(root); +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/boss1_action.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/boss1_action.h Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,66 @@ +#ifndef BOSS1_ACCTION_H +#define BOSS1_ACCTION_H + +#include +#include "SceneGraphRoot.h" +#include "SGList.h" + +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; + + +/* +static void +null_move(SceneGraphPtr node, int screen_w, int screen_h); +*/ + +static void +null_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree); + +static void +boss1_move_right(SceneGraphPtr node, int screen_w, int screen_h); + +static void +boss1_move_left(SceneGraphPtr node, int screen_w, int screen_h); + +/* +static void +boss1_move_return(SceneGraphPtr node, int screen_w, int screen_h); +*/ + +/* +static void +boss1_first_move(SceneGraphPtr node, int screen_w, int screen_h); +*/ + +static void +player_move(SceneGraphPtr node,int screen_2, int screen_h); + +/* +static void +player_move_left(SceneGraphPtr node,int screen_2, int screen_h); +*/ + +static void +player_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree); +static void +shot_move(SceneGraphPtr node, int screen_w, int screen_h); + +static void +shot_collision(SceneGraphPtr node, int screen_2, int screen_h, + SceneGraphPtr tree); +static void +blast_move(SceneGraphPtr node, int screen_w, int screen_h); + +#endif diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/bullet_action.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/bullet_action.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,65 @@ +#include +#include "SceneGraphRoot.h" +#include "SGList.h" +#include "hit_judge.h" +#define PI M_PI + +int i = 0; + +void +bullet_init(SceneGraphPtr bullet, SceneGraphPtr player) +{ + bullet->xyz[0] = player->xyz[0]; + bullet->xyz[1] = player->xyz[1]; + bullet->xyz[2] = player->xyz[2]; + + bullet->angle[0] = player->angle[0]; + bullet->angle[1] = player->angle[1]; + bullet->angle[2] = player->angle[2]; +} + +void +bluebullet_move(SceneGraphPtr node, int screen_w, int screen_h) +{ + double a = (node->angle[2]+90)*PI/180; + double b = (node->angle[0]+90)*PI/180; + + double y = sin(a); + double x = cos(a); + double z = -cos(b); + + node->xyz[0] += x * 5;//x軸方向 + node->xyz[1] += y * 5;//y軸方向 + node->xyz[2] += z * 5;//z軸方向 +} + +void +bullet_collision(SceneGraphPtr node, int screen_w, int screen_h, SceneGraphPtr tree) +{ + SceneGraphIteratorPtr it = sgroot->getIterator(tree); + //static int damage = 0; + + for (; it->hasNext(E_PLANE);) { + it->next(E_PLANE); + SceneGraphPtr enemy = it->get(); + + int judge = square_judge(node, enemy); + if(judge == HIT) + { + //node->set_move_collision(null_move, bullet_collision); + //E_PLANE->set_move_collision(null_move, enemy_collision); + enemy->remove(); + node->remove(); + //printf("hit!!!\n"); + //bullet_delete(node, scene_graph); + } + } + + if(node->xyz[1] > 100) + { + node->remove(); + //scene_graph->delete_object(node, node->next,node->prev); + //i -= 1; + //printf("bullet_delete:残り弾数=%d\n",i); + } +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/bullet_action.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/bullet_action.h Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,8 @@ +#ifndef BULLET_ACTION_H +#define BULLET_ACTION_H + +void bullet_init(SceneGraphPtr scene_graph, SceneGraphPtr node); +void bluebullet_move(SceneGraphPtr node, int screen_w, int screen_h); +void bullet_collision(SceneGraphPtr node, int screen_w, int screen_h ,SceneGraphPtr tree); + +#endif diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/camera_action.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/camera_action.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,58 @@ +#include "SceneGraphRoot.h" +#include "SGList.h" +#include "camera_action.h" + +#define MOVE_SPEED 0.10 + +void +camera_init(SceneGraphPtr node, int screen_w, int screen_h) +{ + node->xyz[0] = screen_w/2; + node->xyz[1] = screen_h/2 + 50; + node->xyz[2] = 0; + node->angle[0] = 120; +} + +void +c_move(SceneGraphPtr node, int screen_w, int screen_h) +{ + Pad *pad = sgroot->getController(); + + if(pad->right.isHold()) + { + if(node->xyz[0]>screen_w/2 - 50) + { + node->xyz[0]-=MOVE_SPEED; + } + } + + if(pad->left.isHold()) + { + if(node->xyz[0]xyz[0]+=MOVE_SPEED; + } + } + + if(pad->down.isHold()) + { + if(node->xyz[2]>-25) + { + node->xyz[2]-=MOVE_SPEED; + } + } + + if(pad->up.isHold()) + { + if(node->xyz[2]<25) + { + node->xyz[2]+=MOVE_SPEED; + } + } + +} + +void +camera_collision(SceneGraphPtr node, int screen_w, int screen_h,SceneGraphPtr tree) +{ +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/camera_action.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/camera_action.h Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,3 @@ +void camera_init(SceneGraphPtr node, int screen_w, int screen_h); +void c_movet(SceneGraphPtr node, int screen_w, int screen_h); +void camera_collision(SceneGraphPtr node, int screen_w, int screen_h, SceneGraphPtr tree); diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/chain.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/chain.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,170 @@ +#include +#include +#include "SceneGraphRoot.h" +#include "SceneGraph.h" +#include "SGList.h" +#include "TaskManager.h" +#include "Func.h" + +#define FALSE 0 +#define TRUE !FALSE +#define CHAIN_LEN 50 + +static double chain_width = 10; + +typedef struct { + double x, y, next_x, next_y; + double vx, vy, next_vx, next_vy; + double angle[3]; + int can_move; + SceneGraphPtr parent; + int id; + //int parent; +} CHAIN_VARS; + +/* SceneGraph の property */ +CHAIN_VARS* properties[2]; +CHAIN_VARS* property; + + +//void createSceneGraphFromProperty(CHAIN_VARS* p) ; +void createSceneGraphFromProperty(void* p) ; + +void +init_chain_vars(CHAIN_VARS *cv) { + cv->x = 0, cv->y = 0, cv->next_x = 0, cv->next_y = 0; + cv->vx = 0, cv->vy = 0, cv->next_vx = 0, cv->next_vy = 0; + cv->can_move = TRUE; +} + +void +set_vector(CHAIN_VARS *p, SceneGraphPtr sg) { + sg->xyz[0] = p->next_x; + sg->xyz[1] = p->next_y; + sg->xyz[2] = 0.0f; + sg->angle[0] = p->angle[0]; + sg->angle[1] = p->angle[1]; + sg->angle[2] = p->angle[2]; +} + + +static void +chain_move_ope(SceneGraphPtr node, int screen_w, int screen_h) +{ + Pad *pad = sgroot->getController(); + + if (pad->circle.isHold()) { + property[CHAIN_LEN-1].can_move = FALSE; + if (pad->left.isHold()) { + property[CHAIN_LEN-1].x += -5.0; + } else if (pad->right.isHold()) { + property[CHAIN_LEN-1].x += 5.0; + } + + if (pad->up.isHold()) { + property[CHAIN_LEN-1].y += -5.0; + } else if (pad->down.isHold()) { + property[CHAIN_LEN-1].y += 5.0; + } + } else { + property[CHAIN_LEN-1].can_move = TRUE; + } +} + +void +chain_move(TaskManager *manager, SceneGraphPtr sg, int w, int h) +{ + int id = sg->id; + //CHAIN_VARS* p = (CHAIN_VARS*)sg->propertyptr; + HTaskPtr chain_cal; + CHAIN_VARS* output; + + // SceneGraph の切り替えもここでやる + if (property == properties[0]) { + property = properties[1]; + output = properties[0]; + }else{ + property = properties[0]; + output = properties[1]; + } + chain_cal = manager->create_task(CHAINCAL_TASK); + chain_cal->add_inData(property, sizeof(CHAIN_VARS)*CHAIN_LEN); + chain_cal->add_param(id); + chain_cal->add_outData(output, sizeof(CHAIN_VARS)*CHAIN_LEN); + chain_cal->set_post(createSceneGraphFromProperty, (void*)id); + chain_cal->spawn(); + +} + +void +chain_collision(SceneGraphPtr sg, int w, int h, SceneGraphPtr osg) +{ + +} + +void +createSceneGraphFromProperty(void* p) +{ + CHAIN_VARS* chain_p = (CHAIN_VARS*)p; + SceneGraphPtr chain_copy = sgroot->createSceneGraph(CHAIN); + chain_copy->propertyptr = (void*)chain_p; + chain_copy->property_size = sizeof(CHAIN_VARS); + set_vector(chain_p, chain_copy); + chain_p->parent->addChild(chain_copy); +} + +void +chain_init(TaskManager *manager, int w, int h) +{ + SceneGraphPtr root_chain, chain; + CHAIN_VARS rcv; + + HTaskPtr chain_init; + + + sgroot->createFromXMLfile(manager, "xml_file/chain.xml"); + + /* SPE に送る property の配列の領域確保 */ + properties[0] = (CHAIN_VARS*)manager->allocate(sizeof(CHAIN_VARS)*CHAIN_LEN); + properties[1] = (CHAIN_VARS*)manager->allocate(sizeof(CHAIN_VARS)*CHAIN_LEN); + property = properties[0]; + + root_chain = sgroot->createSceneGraph(CHAIN); + // set_move_collision()ではだめ + root_chain->set_move_collision(chain_move_ope, chain_collision); + init_chain_vars(&rcv); + rcv.next_x = w / 2; + rcv.next_y = 0.0; + rcv.angle[0] = 0; + rcv.angle[1] = 0; + rcv.angle[2] = 0; + + set_vector(&rcv, root_chain); + + for(int i = 0; i < CHAIN_LEN; i++) { + chain = sgroot->createSceneGraph(CHAIN); + property[i].id = i; + init_chain_vars(&property[i]); + property[i].x = 0; + property[i].y = chain_width * i; + set_vector(&property[i], chain); + property->angle[1] = -90 * (i % 2); + //chain->set_move_collision(chain_move, chain_collision); + chain->propertyptr = &property[i]; + chain->property_size = sizeof(CHAIN_VARS); + root_chain->addChild(chain); + property[i].parent = root_chain; + } + property[0].can_move = FALSE; + + // property を SPU の共有領域へコピーする + chain_init = manager->create_task(CHAININIT_TASK); + chain_init->add_inData(property, sizeof(CHAIN_VARS)*CHAIN_LEN); + chain_init->add_param(CHAIN_LEN); + chain_init->set_cpu(SPE_0); + chain_init->set_post(createSceneGraphFromProperty, (void*)property); + chain_init->spawn(); + + sgroot->setSceneData(root_chain); +} + diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/cube.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/cube.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,174 @@ +#include +#include "SceneGraphRoot.h" +#include "vacuum.h" +#include "SGList.h" +#define SELECT 2 + +void +cube_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree) +{ + if (node->frame > 120) { + cube_split(node,tree); + } +} + +void +cube_move_left(SceneGraphPtr node, int screen_w, int screen_h) +{ + node->xyz[0] -= node->stack_xyz[0]; + node->xyz[1] += node->stack_xyz[1]; + + if (node->xyz[0] < 0) { + node->set_move_collision(cube_move_right, cube_collision); + } + + if (node->xyz[1] < 0 || node->xyz[1] > screen_h) { + node->stack_xyz[1] = -node->stack_xyz[1]; + } +} + +void +cube_rotate(SceneGraphPtr node, int w, int h) +{ + node->angle[0] += 2.0f; + node->angle[1] += 2.0f; + node->angle[2] += 2.0f; +} + +void +cube_move_right(SceneGraphPtr node, int screen_w, int screen_h) +{ + node->xyz[0] += node->stack_xyz[0]; + node->xyz[1] += node->stack_xyz[1]; + + if (node->xyz[0] > screen_w) { + node->set_move_collision(cube_move_left, cube_collision); + } + + if (node->xyz[1] < 0 || node->xyz[1] > screen_h) { + node->stack_xyz[1] = -node->stack_xyz[1]; + } + +} + + +void +cube_split(SceneGraphPtr root,SceneGraphPtr tree) +{ + + SceneGraphPtr p; + // SceneGraphPtr common_move = sgroot->createSceneGraph(); + // SceneGraphPtr root_common_move = root->parent; + + if(random()%SELECT) { + p = sgroot->createSceneGraph(REDCUBE); + } + else { + p = sgroot->createSceneGraph(ENEMY); + } + + root->set_move_collision(cube_move_right, cube_collision); + p->set_move_collision(cube_move_left, cube_collision); + + root->frame = 0; + p->frame = 0; + + p->xyz[0] = root->xyz[0] + 2; + p->xyz[1] = root->xyz[1]; + p->xyz[2] = root->xyz[2]; + + p->stack_xyz[0] = 2.0f; + p->stack_xyz[1] = random()%3-1; + p->stack_xyz[2] = 0.0f; + + root->xyz[0] -= 2; + root->stack_xyz[0] = 2.0f; + root->stack_xyz[1] = random()%3-1; + + //common_move->addChild(p); + root->addBrother(p); + +} + + +void +collision_red(SceneGraphIteratorPtr it,SceneGraphPtr node) +{ + float dx, dy,ddx,ddy, r; + float q = 0; + + for (; it->hasNext(REDCUBE);) { + + it->next(REDCUBE); + SceneGraphPtr mcube = it->get(); + dx = node->xyz[0] - mcube->xyz[0]; + dy = node->xyz[1] - mcube->xyz[1]; + + ddx = dx*dx; + ddy = dy*dy; + + if(sqrt(ddx) < 10 && sqrt(ddy) < 10) { + mcube->remove(); + continue; + } + r = sqrt(ddx + ddy); + if (r >= 1) q = 200/r; + if (dx == 0) { + if(mcube->xyz[1] > node->xyz[1]) { + mcube->stack_xyz[1] -= q; + } else if(mcube->xyz[1] < node->xyz[1]) { + mcube->stack_xyz[1] += q; + } + } else { + if(mcube->xyz[0] > node->xyz[0]) { + mcube->xyz[0] -= q*cos(atan(dy/dx)); + mcube->xyz[1] -= q*sin(atan(dy/dx)); + } else if(mcube->xyz[0] < node->xyz[0]) { + mcube->xyz[0] += q*cos(atan(dy/dx)); + mcube->xyz[1] += q*sin(atan(dy/dx)); + } + } + } +} + +void +collision_purple(SceneGraphIteratorPtr it,SceneGraphPtr node,int w,int h) +{ + float dx, dy,ddx,ddy, r; + float q = 0; + + for (; it->hasNext(ENEMY);) { + it->next(ENEMY); + SceneGraphPtr mcube = it->get(); + + dx = node->xyz[0] - mcube->xyz[0]; + dy = node->xyz[1] - mcube->xyz[1]; + ddx = dx*dx; + ddy = dy*dy; + + if(sqrt(ddx) < 10 && sqrt(ddy) < 10) { + gameover_scene(w,h,mcube); + node->remove(); + break; + } + r = sqrt(ddx + ddy); + if (r >= 1) q = 200/r; + if (dx == 0) { + if(mcube->xyz[1] > node->xyz[1]) { + mcube->stack_xyz[1] -= q; + } else if(mcube->xyz[1] < node->xyz[1]) { + mcube->stack_xyz[1] += q; + } + } else { + + if(mcube->xyz[0] > node->xyz[0]) { + mcube->xyz[0] -= q*cos(atan(dy/dx)); + mcube->xyz[1] -= q*sin(atan(dy/dx)); + } else if(mcube->xyz[0] < node->xyz[0]) { + mcube->xyz[0] += q*cos(atan(dy/dx)); + mcube->xyz[1] += q*sin(atan(dy/dx)); + } + } + } +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/cube_action.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/cube_action.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,132 @@ +#include +#include "SceneGraphRoot.h" +#include "SGList.h" + +static void cube_move_left(SceneGraphPtr node, int screen_w, int screen_h); +static void cube_move_right(SceneGraphPtr node, int screen_w, int screen_h); +static void cube_move_idle(SceneGraphPtr node, int screen_w, int screen_h); +static void cube_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree); + +static void cube_split(SceneGraphPtr root); + +static void +cube_move_left(SceneGraphPtr node, int screen_w, int screen_h) +{ + node->xyz[0] -= node->stack_xyz[0]; + node->xyz[1] -= node->stack_xyz[0] * node->stack_xyz[1]; + node->xyz[2] -= node->stack_xyz[0] * node->stack_xyz[2]; + + if (node->xyz[0] < 0) { + node->set_move_collision(cube_move_right, cube_collision); + } + + if (node->xyz[1] < 0 || node->xyz[1] > screen_h) { + node->stack_xyz[1] = -node->stack_xyz[1]; + } + + node->angle[0] += 2.0f; + node->angle[1] += 2.0f * node->stack_xyz[1]; + node->angle[2] += 2.0f * node->stack_xyz[2]; + + node->angle[0] = fmodf(node->angle[0], 360.0f); + node->angle[1] = fmodf(node->angle[1], 360.0f); + node->angle[2] = fmodf(node->angle[2], 360.0f); + + if (node->frame > 10 && sgroot->controller->circle.isPush()) { + cube_split(node); + } +} + +static void +cube_move_right(SceneGraphPtr node, int screen_w, int screen_h) +{ + node->xyz[0] += node->stack_xyz[0]; + node->xyz[1] -= node->stack_xyz[0] * node->stack_xyz[1]; + node->xyz[2] -= node->stack_xyz[0] * node->stack_xyz[2]; + + if (node->xyz[0] > screen_w) { + node->set_move_collision(cube_move_left, cube_collision); + } + + if (node->xyz[1] < 0 || node->xyz[1] > screen_h) { + node->stack_xyz[1] = -node->stack_xyz[1]; + } + + node->angle[0] += 2.0f; + node->angle[1] += 2.0f * node->stack_xyz[1]; + node->angle[2] += 2.0f * node->stack_xyz[2]; + + node->angle[0] = fmodf(node->angle[0], 360.0f); + node->angle[1] = fmodf(node->angle[1], 360.0f); + node->angle[2] = fmodf(node->angle[2], 360.0f); + + if (node->frame > 10 && sgroot->controller->circle.isPush()) { + cube_split(node); + } +} + +static void +cube_split(SceneGraphPtr root) +{ + SceneGraphPtr p = root->clone(); + root->addBrother(p); + + root->set_move_collision(cube_move_left, cube_collision); + p->set_move_collision(cube_move_right, cube_collision); + + p->xyz[0] = root->xyz[0] + 2; + p->xyz[1] = root->xyz[1]; + p->xyz[2] = root->xyz[2]; + + p->stack_xyz[0] = 2.0f; + p->stack_xyz[1] = random()%3-1; + p->stack_xyz[2] = random()%3-1; + + root->xyz[0] -= 2; + root->stack_xyz[0] = 2.0f; + root->stack_xyz[1] = random()%3-1; + root->stack_xyz[2] = random()%3-1; +} + + +static void +cube_move_idle(SceneGraphPtr node, int screen_w, int screen_h) +{ + node->xyz[0] = screen_w/2; + node->xyz[1] = screen_h/2; + //node->xyz[2] = -300.0f; + + if (sgroot->controller->circle.isPush()) { + cube_split(node); + } +} + +static void +cube_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree) +{ +} + +void +create_cube_split(TaskManager *manager, int number) +{ + SceneGraphPtr cube; + SceneGraphPtr back; + + sgroot->createFromXMLfile(manager, "xml_file/cube.xml"); + + // 何もしない親 + // cube は brother として繋がっていくので + // 親が居ないとだめ。 + back = sgroot->createSceneGraph(); + + cube = sgroot->createSceneGraph(Cube); + cube->xyz[0] = 960.0f; + cube->xyz[1] = 540.0f; + cube->set_move_collision(cube_move_idle, cube_collision); + + back->addChild(cube); + + sgroot->setSceneData(back); +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/demonstration.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/demonstration.h Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,18 @@ +#ifndef INCLUDED_DEMONSTRATION +#define INCLUDED_DEMONSTRATION + +#include "polygon.h" + +class Demonstration{ + public: + Polygon *list; + void (Demonstration::*action_demo)(); + + Demonstration(); + //~Demonstration(); + void test_init(); + void test_play(); + void test_end(); +}; + +#endif diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/direction.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/direction.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,93 @@ +#include "SceneGraphRoot.h" +#include "SGList.h" + +static void +x_move(SceneGraphPtr node, int w, int h) +{ + Pad *pad = sgroot->getController(); + + node->xyz[0] = w/2; + node->xyz[1] = h/2; + + if (pad->circle.isPush() || pad->circle.isHold()) { + node->angle[1] += 10.0f; + if (node->angle[1] > 360.0f) node->angle[1] = 0.0f; + } + + if (pad->triangle.isPush() || pad->triangle.isHold()) { + node->angle[0] += 10.0f; + if (node->angle[0] > 360.0f) node->angle[0] = 0.0f; + } + + if (pad->start.isPush()) { + node->angle[0] = 0.0f; + node->angle[1] = 90.0f; + } + +} + +static void +y_move(SceneGraphPtr node, int w, int h) +{ + Pad *pad = sgroot->getController(); + + node->xyz[0] = w/2; + node->xyz[1] = h/2; + + if (pad->cross.isPush() || pad->cross.isHold()) { + node->angle[2] += 10.0f; + } + + if (pad->square.isPush() || pad->square.isHold()) { + node->angle[0] += 10.0f; + } + + if (pad->start.isPush()) { + node->angle[0] = 90.0f; + node->angle[1] = 0.0f; + } + +} + +static void +z_move(SceneGraphPtr node, int w, int h) +{ + node->xyz[0] = w/2; + node->xyz[1] = h/2; +} + +static void +dir_collision(SceneGraphPtr node, int w, int h, SceneGraphPtr tree) +{ +} + +void +direction_init(TaskManager *manager) +{ + SceneGraphPtr dx; + SceneGraphPtr dy; + SceneGraphPtr dz; + SceneGraphPtr back; + + sgroot->createFromXMLfile(manager, "xml_file/direction.xml"); + + dx = sgroot->createSceneGraph(Dirx); + dy = sgroot->createSceneGraph(Diry); + dz = sgroot->createSceneGraph(Dirz); + back = sgroot->createSceneGraph(); + + back->addChild(dx); + back->addChild(dy); + back->addChild(dz); + + dx->set_move_collision(x_move, dir_collision); + dx->angle[1] = 90.0f; + dy->set_move_collision(y_move, dir_collision); + dy->angle[0] = 90.0f; + dz->set_move_collision(z_move, dir_collision); + + back->angle[0] = 30.0f; + back->angle[1] = -30.0f; + + sgroot->setSceneData(back); +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/enemy_action.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/enemy_action.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,38 @@ +#include +#include "SceneGraph.h" +#include "enemy_action.h" + +#define PI M_PI + +double vx = 5.0; + +void +enemy_move(SceneGraphPtr node, int screen_w, int screen_h) +{ + double vxr = (node->xyz[0])*PI/180; + if(node->xyz[0] > screen_w/2 || node->xyz[0] < -screen_w/2) + { + vx *= -1; + } + //printf("%f\n", vx); + node->angle[1]+=vx; + + node->xyz[0] += vx; + node->xyz[1] = -sin(vxr*2)*20*vx; + node->xyz[2] = sin(vxr*4)*2*vx; +} + + +void +enemy_collision(SceneGraphPtr node, int screen_w, int screen_h, SceneGraphPtr tree) +{ +#if 0 + int judge = square_judge(E_PLANE, BULEBULLET, tree); + if(judge == HIT) + { + E_PLANE->set_move_collision(null_move, enemy_collision); + printf("ENEMY_hit!!!\n"); + //scene_graph->delete_object(node, node->next,node->prev); + } +#endif +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/enemy_action.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/enemy_action.h Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,2 @@ +extern void enemy_move(SceneGraphPtr node, int screen_w, int screen_h); +extern void enemy_collision(SceneGraphPtr node, int screen_w, int screen_h, SceneGraphPtr tree); diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/game_over.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/game_over.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,42 @@ +#include "SceneGraphRoot.h" +#include "vacuum.h" +#include "SGList.h" + + +void +gameover_scene(int w,int h,SceneGraphPtr node) +{ + + SceneGraphPtr over; + + over = sgroot->createSceneGraph(GAMEOVER); + over->xyz[0] = w/2; + over->xyz[1] = h/2; + over->set_move_collision(gameover_idle,gameover_collision); + node->addBrother(over); +} + +void +gameover_idle(SceneGraphPtr node,int screen_w,int screen_h) +{ +} + +void +gameover_collision(SceneGraphPtr node,int screen_w,int screen_h,SceneGraphPtr tree) +{ + + Pad *pad = sgroot->getController(); + + if(pad->start.isPush()) { + + SceneGraphPtr title; + + title = sgroot->createSceneGraph(TITLE); + title->xyz[0] = screen_w/2; + title->xyz[1] = screen_h/2; + title->set_move_collision(no_move_idle, title_collision); + sgroot->setSceneData(title); + + } + +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/gaplant.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/gaplant.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,30 @@ +#include "SceneGraphRoot.h" +#include "SGList.h" +#include "gaplant_action.h" +#include "back_action.h" + +void +init_gaplant(TaskManager *manager, int w, int h) +{ + SceneGraphPtr back; + SceneGraphPtr gaplant; + sgroot->createFromXMLfile(manager, "xml_file/gap_plane_test.xml"); + sgroot->createFromXMLfile(manager, "xml_file/Ball.xml"); + + back = sgroot->createSceneGraph(); + back->set_move_collision(back_move, back_coll); + gaplant = sgroot->createSceneGraph(); + gaplant->xyz[0] = 200; + gaplant->angle[0] = -60; + gaplant->angle[1] = 0; + gaplant->angle[2] = 0; + gaplant->set_move_collision(gaplant_move, gaplant_coll); + + for (int i = arm_L_D; i <= foot_L_A; i++) { + SceneGraphPtr p = sgroot->createSceneGraph(i); + gaplant->addChild(p); + } + + back->addChild(gaplant); + sgroot->setSceneData(back); +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/gaplant.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/gaplant.h Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,2 @@ +const double CHECK_HIT_RAD = 110; +const double BALL_RAD = 100; diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/gaplant_action.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/gaplant_action.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,98 @@ +#include +#include +#include "SceneGraphRoot.h" +#include "SGList.h" +#include "gaplant.h" +using namespace std; + +void +move_right(SceneGraphPtr node) +{ + /*cout << "右を押したんだ " << node->angle[2] << "\n"; + node->angle[2] -= 1; + if (node->angle[2] < -30) { + node->angle[2] = -30; + }*/ + node->xyz[0] += 5; +} + +void +move_left(SceneGraphPtr node) +{ + /*cout << "左を押したんだ " << node->angle[2] << "\n"; + node->angle[1] += 1; + if (node->angle[2] > 30) { + node->angle[2] = 30; + }*/ + node->xyz[0] -= 5; +} + +void +move_down(SceneGraphPtr node) +{ + /*cout << "下だって押したくなる時はある "<< node->angle[0] << "\n"; + node->angle[0] += 1; + if (node->angle[0] > -60) { + node->angle[0] = -60; + }*/ + node->xyz[1] += 5; +} + +void +move_up(SceneGraphPtr node) +{ + /*cout << "上を押したんだ "<< node->angle[0] << "\n"; + node->angle[0] -= 1; + if (node->angle[0] < -120) { + node->angle[0] = -120; + }*/ + node->xyz[1] -= 5; +} + +void +gaplant_move(SceneGraphPtr node, int w, int h) +{ + Pad *pad = sgroot->getController(); + + if (pad->right.isHold() || pad->left.isHold() || pad->down.isHold() || pad->up.isHold()) { + if (pad->right.isHold()) { + move_right(node); + } else if (pad->left.isHold()) { + move_left(node); + } else if (pad->down.isHold()) { + move_down(node); + } else if (pad->up.isHold()) { + move_up(node); + } + } + + if (pad->cross.isHold() || pad->circle.isHold()) { + if (pad->cross.isHold()) { + node->xyz[2] += 5; + } else if (pad->circle.isHold()) { + node->xyz[2] -= 5; + } + } +} + +void +gaplant_coll(SceneGraphPtr node, int w, int h, SceneGraphPtr tree) +{ + SceneGraphIteratorPtr it = sgroot->getIterator(tree); + //static int damage = 0; + + for (; it->hasNext(Ball);) { + it->next(Ball); + SceneGraphPtr ball = it->get(); + + double dis_x = node->xyz[0] - ball->xyz[0]; + double dis_y = node->xyz[1] - ball->xyz[1]; + double dis_z = node->xyz[2] - ball->xyz[2]; + double distance = sqrt(dis_x*dis_x + dis_y*dis_y + dis_z*dis_z); + + if (distance < CHECK_HIT_RAD + BALL_RAD) { + cout << "今からもっと細かく判定するよ ^q^\n"; + ball->remove(); + } + } +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/gaplant_action.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/gaplant_action.h Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,2 @@ +void gaplant_move(SceneGraphPtr, int, int); +void gaplant_coll(SceneGraphPtr, int, int, SceneGraphPtr); diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/hit_judge.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/hit_judge.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,80 @@ +#include "SceneGraph.h" +#include "hit_judge.h" +#include "SGList.h" + +#define FUSELAGE_W 6 +#define FUSELAGE_H 6 +#define FUSELAGE_Z 6 +#define E_PLANE_W 6*4 +#define E_PLANE_H 6*4 +#define E_PLANE_Z 6*4 +#define BULLTE_W 2*4 +#define BULLTE_H 6*4 +#define BULLTE_Z 2*4 + +int +square_judge(SceneGraphPtr oneself, SceneGraphPtr partner) +{ + int ow = 0, oh = 0, oz = 0; + int pw = 0, ph = 0, pz = 0; + if (oneself->sgid == IDLE) + { + ow = FUSELAGE_W; + oh = FUSELAGE_H; + oz = FUSELAGE_Z; + } + else if (oneself->sgid == E_PLANE) + { + ow = E_PLANE_W; + oh = E_PLANE_H; + oz = E_PLANE_Z; + } + else if(oneself->sgid == BULEBULLET) + { + ow = BULLTE_W; + oh = BULLTE_H; + oz = BULLTE_Z; + } + if(partner->sgid == IDLE) + { + pw = FUSELAGE_W; + ph = FUSELAGE_H; + pz = FUSELAGE_Z; + } + else if(partner->sgid == E_PLANE) + { + pw = E_PLANE_W; + ph = E_PLANE_H; + pz = E_PLANE_Z; + } + else if(partner->sgid == BULEBULLET) + { + pw = BULLTE_W; + ph = BULLTE_H; + pz = BULLTE_Z; + } + + + int ox_min = (int)(oneself->xyz[0] + oneself->c_xyz[0] - ow/2); + int oy_min = (int)(oneself->xyz[1] + oneself->c_xyz[1] - oh/2); + int oz_min = (int)(oneself->xyz[2] + oneself->c_xyz[2] - oz/2); + + int ox_max = (int)(oneself->xyz[0] + oneself->c_xyz[0] + ow/2); + int oy_max = (int)(oneself->xyz[1] + oneself->c_xyz[1] + oh/2); + int oz_max = (int)(oneself->xyz[2] + oneself->c_xyz[2] + oz/2); + + int px_min = (int)(partner->xyz[0] + partner->c_xyz[0] - pw/2); + int py_min = (int)(partner->xyz[1] + partner->c_xyz[1] - ph/2); + int pz_min = (int)(partner->xyz[2] + partner->c_xyz[2] - pz/2); + + int px_max = (int)(partner->xyz[0] + partner->c_xyz[0] + pw/2); + int py_max = (int)(partner->xyz[1] + partner->c_xyz[1] + ph/2); + int pz_max = (int)(partner->xyz[2] + partner->c_xyz[2] + pz/2); + + if(ox_max < px_min || px_max < ox_min || oy_max < py_min || py_max < oy_min || oz_max < pz_min || pz_max < oz_min) + { + } else { + return HIT; + } + return 0; +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/hit_judge.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/hit_judge.h Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,11 @@ +#ifndef HIT_JUDGE_H +#define HIT_JUDGE_H + +#define TOUCH_LOWER 1 +#define TOUCH_TOP 2 +#define TOUCH_RIGHT 3 +#define TOUCH_LEFT 4 +#define HIT 5 + +extern int square_judge(SceneGraphPtr oneself, SceneGraphPtr partner); +#endif diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/icon.png Binary file TaskManager/Test/test_render/Application/icon.png has changed diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/ieshoot.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/ieshoot.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,216 @@ +#include "SceneGraphRoot.h" +#include "SGList.h" + +static const float jiki_speed = 6.0f; +static const float jiki_radius = 32.0f; + +static const float tama_speed = 10.0f; +static const float tama_radius = 16.0f; + +static const float boss_radius_x = 64.0f; +static const float boss_radius_y = 128.0f; + +static const float iebosstama_speed = 15.0f; + +static void +ieboss_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree); +static void +ieboss_collision_invincibil(SceneGraphPtr node, int screen_w, int screen_h, SceneGraphPtr tree); +static void ieboss_move(SceneGraphPtr node, int screen_w, int screen_h); + +static void iebosstama_move(SceneGraphPtr node, int screen_w, int screen_h); + + +static void +iejiki_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree) +{ +} + +static void +ietama_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree) +{ +} + +static void +ieboss_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree) +{ + SceneGraphIteratorPtr it = sgroot->getIterator(tree); + static int damage = 0; + + for (; it->hasNext(IETAMA);) { + it->next(IETAMA); + SceneGraphPtr tama = it->get(); + + if (node->xyz[0] - boss_radius_x < tama->xyz[0] + tama_radius + && node->xyz[0] + boss_radius_x > tama->xyz[0] - tama_radius + && node->xyz[1] + boss_radius_y > tama->xyz[1] - tama_radius) { + tama->remove(); + + node->set_move_collision(ieboss_move, ieboss_collision_invincibil); + + SceneGraphPtr iebosstama = sgroot->createSceneGraph(Earth); + iebosstama->set_move_collision(iebosstama_move, ietama_collision); + iebosstama->xyz[0] = node->xyz[0]; + iebosstama->xyz[1] = node->xyz[1] + boss_radius_y; + //iebosstama->xyz[2] = 50.0f; + node->addBrother(iebosstama); + + damage++; + } + } + + if (damage > 10) { + node->remove(); + } +} + +static void +ieboss_move(SceneGraphPtr node, int screen_w, int screen_h) +{ + /** + * TODO + * Boss が複数居た場合、これじゃ駄目 + */ + static float x_speed = 5.0f; + static float z_speed = 5.0f; + + node->xyz[0] += x_speed; + + if (node->xyz[0] - boss_radius_x < 0) { + x_speed = -x_speed; + node->xyz[0] = boss_radius_x; + } else if (node->xyz[0] + boss_radius_x > screen_w) { + x_speed = -x_speed; + node->xyz[0] = screen_w - boss_radius_x; + } + + //node->xyz[2] += z_speed; + if (node->xyz[2] >= 100.0f) { + node->xyz[2] = 99.99f; + z_speed = -z_speed; + } else if (node->xyz[2] <= -100.0f) { + node->xyz[2] = -99.99f; + z_speed = -z_speed; + } +} + +static void +ieboss_collision_invincibil(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree) +{ + static int frame = 0; + + frame++; + + node->flag_drawable ^= 1; + + if (frame > 60) { + frame = 0; + node->flag_drawable = 1; + node->set_move_collision(ieboss_move, ieboss_collision); + } +} + +static void +iebosstama_move(SceneGraphPtr node, int screen_w, int screen_h) +{ + node->xyz[1] += iebosstama_speed; + + // 描画領域から抜けたら削除 + if (node->xyz[1] > screen_h) { + node->remove(); + } +} + +static void +ietama_move(SceneGraphPtr node, int screen_w, int screen_h) +{ + node->xyz[1] -= tama_speed; + + // 描画領域から抜けたら削除 + if (node->xyz[1] < 0) { + node->remove(); + } +} + +static void +iejiki_move(SceneGraphPtr node, int screen_w, int screen_h) +{ + Pad *pad = sgroot->getController(); + + if (pad->left.isPush() + || pad->left.isHold()) { + node->xyz[0] -= jiki_speed; + + if (node->xyz[0] - jiki_radius< 0) { + node->xyz[0] = jiki_radius; + } + } + + if (pad->right.isPush() + || pad->right.isHold()) { + node->xyz[0] += jiki_speed; + + if (node->xyz[0] + jiki_radius > screen_w) { + node->xyz[0] = screen_w - jiki_radius; + } + } + + if (pad->up.isPush() + || pad->up.isHold()) { + node->xyz[1] -= jiki_speed; + + if (node->xyz[1] - jiki_radius < 0) { + node->xyz[1] = jiki_radius; + } + } + + if (pad->down.isPush() + || pad->down.isHold()) { + node->xyz[1] += jiki_speed; + + if (node->xyz[1] + jiki_radius > screen_h) { + node->xyz[1] = screen_h - jiki_radius; + } + } + + if (pad->circle.isPush()) { + SceneGraphPtr ietama = sgroot->createSceneGraph(IETAMA); + ietama->set_move_collision(ietama_move, ietama_collision); + ietama->xyz[0] = node->xyz[0]; + ietama->xyz[1] = node->xyz[1]; + node->addBrother(ietama); + } +} + + +void +ieshoot_init(TaskManager *manager) +{ + SceneGraphPtr iejiki; + SceneGraphPtr enemy; + SceneGraphPtr back; + + sgroot->createFromXMLfile(manager, "xml_file/ietama.xml"); + sgroot->createFromXMLfile(manager, "xml_file/ieboss.xml"); + sgroot->createFromXMLfile(manager, "xml_file/iejiki.xml"); + sgroot->createFromXMLfile(manager, "xml_file/universe.xml"); + + back = sgroot->createSceneGraph(); + + iejiki = sgroot->createSceneGraph(IEJIKI); + iejiki->set_move_collision(iejiki_move, iejiki_collision); + iejiki->xyz[2] = 20; + back->addChild(iejiki); + + enemy = sgroot->createSceneGraph(IEBOSS); + enemy->set_move_collision(ieboss_move, ieboss_collision); + enemy->xyz[1] = boss_radius_y; + back->addChild(enemy); + + sgroot->setSceneData(back); +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/init_position.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/init_position.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,36 @@ +#include "SceneGraphRoot.h" +#include "SGList.h" +#include "player_action.h" +#include "enemy_action.h" +#include "camera_action.h" + +void +init_position(TaskManager *manager, int w, int h) +{ + SceneGraphPtr back; + SceneGraphPtr player; + SceneGraphPtr enemy; + //SceneGraphPtr bullet; + + sgroot->createFromXMLfile(manager, "xml_file/player.xml"); + back = sgroot->createSceneGraph(BACK); + //back = sgroot->createSceneGraph(); + player = sgroot->createSceneGraph(IDLE); + //bullet = sgroot->createSceneGraph(BULEBULLET); + + camera_init(back, w, h); + back->set_move_collision(camera_init, camera_collision); + player->set_move_collision(player_move_all, player_collision); + + + back->addChild(player); + + for (int i = 0; i < 10; i++) { + enemy = sgroot->createSceneGraph(E_PLANE); + enemy->set_move_collision(enemy_move, enemy_collision); + enemy->xyz[0] = 50.0*i; + back->addChild(enemy); + } + + sgroot->setSceneData(back); +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/long_cube.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/long_cube.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,31 @@ +#include "SceneGraphRoot.h" +#include "SGList.h" + +// prototype +static void lcube_move(SceneGraphPtr node, int screen_w, int screen_h); +//static void lcube_collision(SceneGraphPtr node, int screen_w, int screen_h); + + +static void +lcube_move(SceneGraphPtr node, int screen_w, int screen_h) +{ +} + +static void +lcube_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree) +{ +} + + +void +lcube_init(TaskManager *manager, int screen_w, int screen_h) +{ + SceneGraphPtr lcube; + + sgroot->createFromXMLfile(manager, "xml_file/LongCube.xml"); + lcube = sgroot->createSceneGraph(LongCube); + lcube->set_move_collision(lcube_move, lcube_collision); + + sgroot->setSceneData(lcube); +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/node.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/node.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,72 @@ +#include +#include "SceneGraphRoot.h" +#include "SceneGraph.h" +#include "xml_file/cube.h" + +static void +cube_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree) +{ +} + +static void +cube_move2(SceneGraphPtr node, int screen_w, int screen_h) +{ + node->angle[1] += 1.0f; + if (node->angle[1] > 360.0f) { + node->angle[1] = 0.0f; + } + + node->xyz[0] += node->stack_xyz[0]; + if ((int)node->xyz[0] > screen_w || (int)node->xyz[0] < 0) { + node->stack_xyz[0] = -node->stack_xyz[0]; + } + + node->xyz[1] += node->stack_xyz[1]; + if ((int)node->xyz[1] > screen_h || (int)node->xyz[1] < 0) { + node->stack_xyz[1] = -node->stack_xyz[1]; + } +} + +static void +cube_move(SceneGraphPtr node, int screen_w, int screen_h) +{ + node->angle[1] += 1.0f; + if (node->angle[1] > 360.0f) { + node->angle[1] = 0.0f; + } + + node->xyz[0] += node->stack_xyz[0]; + if ((int)node->xyz[0] > screen_w || (int)node->xyz[0] < 0) { + node->stack_xyz[0] = -node->stack_xyz[0]; + } + + node->xyz[1] += node->stack_xyz[1]; + if ((int)node->xyz[1] > screen_h || (int)node->xyz[1] < 0) { + + // 実は微妙に意味が無い + // そうじゃなくて、やっちゃいけないことです。 + // srandom(random()); + + SceneGraphPtr p = node->clone(); + p->position_init(); + node->addBrother(p); + p->set_move_collision(cube_move2, cube_collision); + p->stack_xyz[0] = (float)(random() % 5); + p->stack_xyz[1] = (float)(random() % 5); + //p->xyz[0] = screen_w/2; + //p->xyz[1] = screen_h/2; + p->xyz[2] = node->xyz[2]+1000.0f; + + node->stack_xyz[1] = -node->stack_xyz[1]; + } +} + +void +node_init(TaskManager *manager) +{ + sgroot->createFromXMLfile(manager, "xml_file/cube.xml"); + Cube->set_move_collision(cube_move, cube_collision); + Cube->stack_xyz[0] = 2.0f; + Cube->stack_xyz[1] = 2.0f; +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/panel.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/panel.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,38 @@ +#include "SceneGraphRoot.h" +#include "SGList.h" + +static void panel_move(SceneGraphPtr node, int screen_w, int screen_h); +static void panel_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree); + +static void +panel_move(SceneGraphPtr node, int screen_w, int screen_h) +{ +} + +static void +panel_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree) +{ +} + +void +panel_init(TaskManager *manager, int bg) +{ + SceneGraphPtr panel; + + if (bg == 2) { + sgroot->createFromXMLfile(manager, "xml_file/panel_512.xml"); + panel = sgroot->createSceneGraph(PANEL_512); + } else if (bg == 3) { + sgroot->createFromXMLfile(manager, "xml_file/panel_1024.xml"); + panel = sgroot->createSceneGraph(PANEL_1024); + } else { + sgroot->createFromXMLfile(manager, "xml_file/panel_2048.xml"); + panel = sgroot->createSceneGraph(PANEL_2048); + } + + panel->set_move_collision(panel_move, panel_collision); + panel->xyz[2] = 30.0f; + sgroot->setSceneData(panel); +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/player_action.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/player_action.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,146 @@ +#include "SceneGraphRoot.h" +#include "bullet_action.h" +#include "SGList.h" + +#define MOVE_SPEED 5.00 + + +void +player_move_right(SceneGraphPtr node, int screen_w, int screen_h) +{ + if(node->xyz[0]xyz[0] += MOVE_SPEED; + } + if(node->angle[1]<=20) + { + node->angle[1]+=1.0; + } + if(node->angle[2]>=-45) + { + node->angle[2]-=1.0; + } +} + +void +player_move_left(SceneGraphPtr node, int screen_w, int screen_h) +{ + if(node->xyz[0]> -screen_w/2) + { + node->xyz[0] -= MOVE_SPEED; + } + if(node->angle[1]>=-20) + { + node->angle[1]-=1.0; + } + if(node->angle[2]<=45) + { + node->angle[2]+=1.0; + } +} + +void +player_move_up(SceneGraphPtr node, int screen_w, int screen_h) +{ + if(node->xyz[2]xyz[2] += MOVE_SPEED; + } + if(node->angle[0]<45) + { + node->angle[0] += 2.0; + } +} + +void +player_move_down(SceneGraphPtr node, int screen_w, int screen_h) +{ + if(node->xyz[2]> -screen_h/2) + { + node->xyz[2] -= MOVE_SPEED; + } + if(node->angle[0]>-45) + { + node->angle[0] -= 2.0; + } +} + +void +player_move_idle(SceneGraphPtr node) +{ + if (node->angle[1]>0) + { + node->angle[1]-=1.0; + } + else if(node->angle[1]<0) + { + node->angle[1]+=1.0; + } + + if(node->angle[2]<0) + { + node->angle[2]+=0.5; + } + else if(node->angle[2]>0) + { + node->angle[2]-=0.5; + } + + if(node->angle[0]<0) + { + node->angle[0]+=1.0; + } + else if(node->angle[0]>0) + { + node->angle[0]-=1.0; + } +} + +void +player_move_all(SceneGraphPtr node, int screen_w, int screen_h) +{ + Pad *pad = sgroot->getController(); + + if (pad->right.isHold() || pad->left.isHold() || + pad->up.isHold() || pad->down.isHold()) { + if (pad->right.isHold()) { + player_move_right(node, screen_w, screen_h); + } else if (pad->left.isHold()) { + player_move_left(node, screen_w, screen_h); + } + + if (pad->down.isHold()) { + player_move_up(node, screen_w, screen_h); + } else if(pad->up.isHold()) { + player_move_down(node, screen_w, screen_h); + } + } else { + player_move_idle(node); + } + + if (pad->r2.isHold()) { + node->xyz[2] -= 10.0f; + } + + if (pad->circle.isPush()) { + SceneGraphPtr bullet = sgroot->createSceneGraph(BULEBULLET); + bullet->set_move_collision(bluebullet_move, bullet_collision); + bullet_init(bullet, node); + node->addBrother(bullet); + } +} + +void +player_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree) +{ +#if 0 + int judge = square_judge(node, BULEBULLET, scene_graph); + + if (judge == HIT) + { + node->set_move_collision(player_move_all,player_collision); + } +#endif +} + diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/player_action.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/player_action.h Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,7 @@ +void player_move_right(SceneGraphPtr node, int screen_w, int screen_h); +void player_move_left(SceneGraphPtr node, int screen_w, int screen_h); +void player_move_up(SceneGraphPtr node, int screen_w, int screen_h); +void player_move_down(SceneGraphPtr node, int screen_w, int screen_h); +void player_move_idle(SceneGraphPtr node); +void player_move_all(SceneGraphPtr node, int screen_w, int screen_h); +void player_collision(SceneGraphPtr node, int screen_w, int screen_h ,SceneGraphPtr tree); diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/title.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/title.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,28 @@ +#include "SceneGraphRoot.h" +#include "vacuum.h" +#include "SGList.h" + +void +title_collision(SceneGraphPtr node, int w, int h,SceneGraphPtr tree) +{ + + Pad *pad = sgroot->getController(); + + if(pad->start.isPush()) { + + SceneGraphPtr vacuum; + SceneGraphPtr back = sgroot->createSceneGraph(); + + vacuum = sgroot->createSceneGraph(BIGCUBE); + vacuum->xyz[0] = w/2; + vacuum->xyz[1] = h*0.8; + vacuum->set_move_collision(vacuum_move, vacuum_coll); + + back->addChild(vacuum); + + add_cubecollision_object(REDCUBE,vacuum,w,h); + + sgroot->setSceneData(back); + + } +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/universe.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/universe.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,68 @@ +#include +#include "SceneGraphRoot.h" +#include "SGList.h" + +static void +earth_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree) +{ +} + +static void +moon_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree) +{ +} + +static void +moon_move(SceneGraphPtr node, int screen_w, int screen_h) +{ + node->angle[0] += 3.0f; +} + + +static void +earth_move(SceneGraphPtr node, int screen_w, int screen_h) +{ + node->angle[1] += 1.0f; + if (node->angle[1] > 360.0f) { + node->angle[1] = 0.0f; + } + + node->xyz[0] += node->stack_xyz[0]; + if ((int)node->xyz[0] > screen_w || (int)node->xyz[0] < 0) { + node->stack_xyz[0] = -node->stack_xyz[0]; + } + + node->xyz[1] += node->stack_xyz[1]; + if ((int)node->xyz[1] > screen_h || (int)node->xyz[1] < 0) { + node->stack_xyz[1] = -node->stack_xyz[1]; + } +} + +void +universe_init(TaskManager *manager) +{ + SceneGraphPtr earth; + SceneGraphPtr moon; + + sgroot->createFromXMLfile(manager, "xml_file/universe.xml"); + + // SGList.h にある SceneGraph ID から SceneGraph を生成する + earth = sgroot->createSceneGraph(Earth); + + // SceneGraph の move と collision を設定 + earth->set_move_collision(earth_move, earth_collision); + earth->stack_xyz[0] = 3.0f; + earth->stack_xyz[1] = 3.0f; + + moon = sgroot->createSceneGraph(Moon); + moon->set_move_collision(moon_move, moon_collision); + + // SceneGraph 同士の親子関係を設定 (今回は 親 earth、子 moon) + earth->addChild(moon); + + // SceneGraphRoot に、使用する SceneGraph を設定する + // このとき、ユーザーが記述した SceneGraph の root を渡す。 + sgroot->setSceneData(earth); +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/untitled.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/untitled.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,149 @@ +#include +#include "SceneGraphRoot.h" +#include "SGList.h" +#include + +static void +cubetest_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree) +{ +} + +static void +test_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree) +{ + // test +} + +static void +test_move(SceneGraphPtr node, int screen_w, int screen_h) +{ + + node->angle[0] += 10.0f; + /* + node->stack_xyz[0] = 2.0f; + node->stack_xyz[1] = 2.0f; + + //node->xyz[0] += node->stack_xyz[0]; + node->xyz[0] += node->stack_xyz[0]; + node->xyz[1] += node->stack_xyz[1]; + + if ((int)node->xyz[0] > screen_w + || (int)node->xyz[0] < 0) { + node->stack_xyz[0] = -node->stack_xyz[0]; + } + + if ((int)node->xyz[1] > screen_w + || (int)node->xyz[1] < 0) { + node->stack_xyz[1] = -node->stack_xyz[1]; + } + + if ((int)node->xyz[2] > 1000 + || (int)node->xyz[2] < 100) { + node->stack_xyz[1] = -node->stack_xyz[1]; + } + */ + +} + +static void +cubetest_move(SceneGraphPtr node, int screen_w, int screen_h) +{ + node->angle[1] += 10.0f; + if (node->angle[1] > 360.0f) { + node->angle[1] = 0.0f; + } + //node->xyz[0] = screen_w/2; + node->xyz[0] += node->stack_xyz[0]; + if ((int)node->xyz[0] > screen_w || (int)node->xyz[0] < 0) { + node->stack_xyz[0] = -node->stack_xyz[0]; + } + //node->xyz[1] = screen_h/2; + node->xyz[1] += node->stack_xyz[1]; + if ((int)node->xyz[1] > screen_h || (int)node->xyz[1] < 0) { + node->stack_xyz[1] = -node->stack_xyz[1]; + } + + node->xyz[2] = 1000; + //node->xyz[2] += node->stack_xyz[2]; + //if ((int)node->xyz[2] > screen_h || (int)node->xyz[2] < 100) { + //node->stack_xyz[2] = -node->stack_xyz[2]; + //} + +} + +void +untitled_init(TaskManager *manager) +{ + SceneGraphPtr test00; + SceneGraphPtr test01; + SceneGraphPtr test02; + SceneGraphPtr test03; + SceneGraphPtr test04; + SceneGraphPtr test05; + SceneGraphPtr test06; + SceneGraphPtr test07; + SceneGraphPtr test08; + SceneGraphPtr test09; + + sgroot->createFromXMLfile(manager, "xml_file/Venus.xml"); + + // SGList.h にある SceneGraph ID から SceneGraph を生成する + /* + test00 = sgroot->createSceneGraph(cubetest000); + test01 = sgroot->createSceneGraph(cubetest009); + test02 = sgroot->createSceneGraph(cubetest008); + test03 = sgroot->createSceneGraph(cubetest007); + test04 = sgroot->createSceneGraph(cubetest006); + test05 = sgroot->createSceneGraph(cubetest005); + test06 = sgroot->createSceneGraph(cubetest004); + test07 = sgroot->createSceneGraph(cubetest003); + test08 = sgroot->createSceneGraph(cubetest002); + test09 = sgroot->createSceneGraph(cubetest001); + */ + test00 = sgroot->createSceneGraph(Venus000); + test01 = sgroot->createSceneGraph(Venus009); + test02 = sgroot->createSceneGraph(Venus008); + test03 = sgroot->createSceneGraph(Venus007); + test04 = sgroot->createSceneGraph(Venus006); + test05 = sgroot->createSceneGraph(Venus005); + test06 = sgroot->createSceneGraph(Venus004); + test07 = sgroot->createSceneGraph(Venus003); + test08 = sgroot->createSceneGraph(Venus002); + test09 = sgroot->createSceneGraph(Venus001); + + // SceneGraph の move と collision を設定 + test00->set_move_collision(cubetest_move, cubetest_collision); + test00->stack_xyz[0] = 3.0f; + test00->stack_xyz[1] = 3.0f; + test00->stack_xyz[2] = 3.0f; + + + + test01->set_move_collision(test_move, test_collision); + test02->set_move_collision(test_move, test_collision); + test03->set_move_collision(test_move, test_collision); + test04->set_move_collision(test_move, test_collision); + test05->set_move_collision(test_move, test_collision); + test06->set_move_collision(test_move, test_collision); + test07->set_move_collision(test_move, test_collision); + test08->set_move_collision(test_move, test_collision); + test09->set_move_collision(test_move, test_collision); + + // SceneGraph 同士の親子関係を設定 (今回は 親 test00、子 その他) + test00->addChild(test01); + test00->addChild(test02); + test00->addChild(test03); + test00->addChild(test04); + test00->addChild(test05); + test00->addChild(test06); + test00->addChild(test07); + test00->addChild(test08); + test00->addChild(test09); + + // SceneGraphRoot に、使用する SceneGraph を設定する + // このとき、ユーザーが記述した SceneGraph の root を渡す。 + sgroot->setSceneData(test00); + +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/vacuum.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/vacuum.cc Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,174 @@ +#include +#include "vacuum.h" +#include "SceneGraphRoot.h" +#include "SGList.h" +#define ENCOUNT 55 +using namespace std; + +static float vacuum_speed = 10.0f; + + +/*オブジェクト毎にファイルを分けてみた + * + * + */ + + + +void +no_move_idle(SceneGraphPtr node, int screen_w, int screen_h) +{ + +} + +void +no_collision_idle(SceneGraphPtr node, int screen_w, int screen_h,SceneGraphPtr tree) +{ + +} + +void +vacuum_coll(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree) +{ + Pad *pad = sgroot->getController(); + + if(node->frame%ENCOUNT == ENCOUNT-1) { + if(random()%2) { + add_cubecollision_object(REDCUBE,node,screen_w,screen_h); + } + else { + add_cubecollision_object(ENEMY,node,screen_w,screen_h); + } + } + + if (pad->cross.isHold()) { + SceneGraphIteratorPtr it = sgroot->getIterator(tree); + collision_red(it,node); + it = sgroot->getIterator(tree); + collision_purple(it,node,screen_w,screen_h); + } + + else if(pad->circle.isHold()) { + SceneGraphIteratorPtr it = sgroot->getIterator(tree); + lock_attack(node,it); + } + +} + +void +lock_attack(SceneGraphPtr node,SceneGraphIteratorPtr it) +{ + + SceneGraphPtr enemy; + SceneGraphPtr near_enemy = NULL; + float dx,dy,r,range = 100; + // Pad *pad = sgroot->getController(); + + for(;it->hasNext(ENEMY);) { + + it->next(ENEMY); + enemy = it->get(); + dx = enemy->xyz[0] - node->xyz[0]; + dy = enemy->xyz[1] - node->xyz[1]; + r = sqrt(dx*dx+dy*dy); + + if(range > r && enemy->stack_xyz[2] == 0) { + range = r; + near_enemy = enemy; + } + } + + + if(near_enemy != NULL) { + /*stack_xyz[2]をlockonフラグとして使うかな?*/ + SceneGraphPtr lockon; + // SceneGraphPtr near_enemy_common_move = near_enemy->parent; + near_enemy->stack_xyz[2] = 1; + lockon = sgroot->createSceneGraph(LOCK); + lockon->set_move_collision(no_move_idle,lockon_collision); + //near_enemy_common_move->addChild(lockon); + near_enemy->addChild(lockon); + } + +} + +void +lockon_collision(SceneGraphPtr node,int w,int h,SceneGraphPtr tree) { + + Pad *pad = sgroot->getController(); + SceneGraphPtr lockon_enemy = node->parent; + + /* node->angle[0] = -lockon_enemy->angle[0]; + node->angle[1] = -lockon_enemy->angle[1]; + node->angle[2] = -lockon_enemy->angle[2];*/ + + if(pad->circle.isRelease()) { + lockon_enemy->remove(); + } + +} + + +void +vacuum_move(SceneGraphPtr node , int w, int h) +{ + Pad *pad = sgroot->getController(); + + if (pad->right.isHold() && w > node->xyz[0]) { + node->xyz[0] += vacuum_speed; + node->angle[0] += 2; + } else if (pad->left.isHold() && 0 < node->xyz[0]) { + node->xyz[0] -= vacuum_speed; + node->angle[0] -= 2; + } + + if (pad->up.isHold() && 0 < node->xyz[1]) { + node->xyz[1] -= vacuum_speed; + node->angle[1] -= 2; + } else if (pad->down.isHold() && h > node->xyz[1]) { + node->xyz[1] += vacuum_speed; + node->angle[1] += 2; + } + + if (pad->start.isPush()) { + node->xyz[0] = w/2; + node->xyz[1] = h*0.8; + } +} + + + +/*cubeをランダムな場所に生成*/ +void +add_cubecollision_object(int id,SceneGraphPtr root,int w,int h) +{ + SceneGraphPtr object; + SceneGraphPtr common_move; + + common_move = sgroot->createSceneGraph(); + object = sgroot->createSceneGraph(id); + object->xyz[0] = random()%w; + object->xyz[1] = random()%h; + object->set_move_collision(no_move_idle,cube_collision); + //common_move->addChild(object); + root->addBrother(object); +} + + +void +vacuum_init2(TaskManager *manager, int w, int h) +{ + SceneGraphPtr title; + + sgroot->createFromXMLfile(manager, "xml_file/gamecube.xml"); + sgroot->createFromXMLfile(manager, "xml_file/title.xml"); + sgroot->createFromXMLfile(manager, "xml_file/gameover.xml"); + + title = sgroot->createSceneGraph(TITLE); + title->xyz[0] = w/2; + title->xyz[1] = h/2; + title->set_move_collision(no_move_idle, title_collision); + + sgroot->setSceneData(title); +} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Application/vacuum.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/Application/vacuum.h Wed Sep 23 12:36:36 2009 +0900 @@ -0,0 +1,28 @@ +#ifndef VACUUM_H +#define VACUUM_H + +#include "SGList.h" +#include "SceneGraphRoot.h" + +void cube_move_left(SceneGraphPtr node, int screen_w, int screen_h); +void cube_move_right(SceneGraphPtr node, int screen_w, int screen_h); +void no_move_idle(SceneGraphPtr node, int screen_w, int screen_h); +void cube_collision_idle(SceneGraphPtr node, int screen_w, int screen_h,SceneGraphPtr tree); +void cube_collision(SceneGraphPtr node, int screen_w, int screen_h,SceneGraphPtr tree); +void cube_split(SceneGraphPtr root,SceneGraphPtr tree); +void vacuum_move(SceneGraphPtr node, int w, int h); +void vacuum_coll(SceneGraphPtr node, int w, int h,SceneGraphPtr tree); +void title_idle(SceneGraphPtr node, int screen_w, int screen_h); +void title_collision(SceneGraphPtr node, int screen_w, int screen_h,SceneGraphPtr tree); +void scene_change(int w,int h,SceneGraphPtr node); +void gameover_idle(SceneGraphPtr node, int screen_w, int screen_h); +void gameover_collision(SceneGraphPtr node, int screen_w, int screen_h,SceneGraphPtr tree); +void collision_red(SceneGraphIteratorPtr it,SceneGraphPtr node); +void collision_purple(SceneGraphIteratorPtr it,SceneGraphPtr node,int w,int h); +void gameover_scene(int w,int h, SceneGraphPtr node); +void add_cubecollision_object(int id,SceneGraphPtr root,int w,int h); +void lock_attack(SceneGraphPtr node,SceneGraphIteratorPtr it); +void lockon_collision(SceneGraphPtr node,int w,int h,SceneGraphPtr tree); +void cube_rotate(SceneGraphPtr node,int w,int h); + +#endif diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Makefile.cell --- a/TaskManager/Test/test_render/Makefile.cell Wed Sep 23 12:23:01 2009 +0900 +++ b/TaskManager/Test/test_render/Makefile.cell Wed Sep 23 12:36:36 2009 +0900 @@ -1,6 +1,6 @@ include ./Makefile.def -SRCS_TMP = $(wildcard *.cc) +SRCS_TMP = $(wildcard *.cc) $(wildcard Application/*.cc) SRCS_EXCLUDE = # SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) OBJS = $(SRCS:.cc=.o) diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/Makefile.macosx --- a/TaskManager/Test/test_render/Makefile.macosx Wed Sep 23 12:23:01 2009 +0900 +++ b/TaskManager/Test/test_render/Makefile.macosx Wed Sep 23 12:36:36 2009 +0900 @@ -1,6 +1,6 @@ include ./Makefile.def -SRCS_TMP = $(wildcard *.cc) +SRCS_TMP = $(wildcard *.cc) $(wildcard Application/*.cc) SRCS_EXCLUDE = # SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) OBJS = $(SRCS:.cc=.o) diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/back_action.cc --- a/TaskManager/Test/test_render/back_action.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -#include -#include "SceneGraphRoot.h" -#include "SGList.h" -#include "ball_action.h" -using namespace std; - -void -back_move(SceneGraphPtr node, int w, int h) -{ - Pad *pad = sgroot->getController(); - - if (pad->triangle.isPush()) { - SceneGraphPtr ball = sgroot->createSceneGraph(Ball); - ball->xyz[0] = -100; - ball->set_move_collision(ball_move, ball_coll); - node->addChild(ball); - } -} - -void -back_coll(SceneGraphPtr node, int w, int h, SceneGraphPtr tree) -{ - -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/back_action.h --- a/TaskManager/Test/test_render/back_action.h Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -void back_move(SceneGraphPtr, int, int); -void back_coll(SceneGraphPtr, int, int, SceneGraphPtr); diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/ball_action.cc --- a/TaskManager/Test/test_render/ball_action.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -#include -#include "SceneGraphRoot.h" -#include "SGList.h" -using namespace std; - -void -ball_move(SceneGraphPtr node, int w, int h) -{ - node->xyz[0] += 4; -} - -void -ball_coll(SceneGraphPtr node, int w, int h, SceneGraphPtr tree) -{ - if (node->xyz[0] > 600) node->remove(); -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/ball_action.h --- a/TaskManager/Test/test_render/ball_action.h Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -void ball_move(SceneGraphPtr, int, int); -void ball_coll(SceneGraphPtr, int, int, SceneGraphPtr); diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/ball_bound.cc --- a/TaskManager/Test/test_render/ball_bound.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -#include -#include -#include "SceneGraphRoot.h" -#include "SGList.h" - -// prototype -static void ball_move(SceneGraphPtr node, int screen_w, int screen_h); -static void ball_collision(SceneGraphPtr node, int screen_w, int screen_h, SceneGraphPtr tree); -static void ball_collision_idle(SceneGraphPtr, int w, int h, SceneGraphPtr tree); - - -static float vy = 0.0f; // y 方向速度 -static float dt = 1.0/1.0f; // frame rate - -static float e = -0.8f; // 反発係数 -static float g = 9.8f; // 重力加速度 -//static float v0 = 0.0f; // 初速は 0 - -static float h0; // 初期高さ -static float ball_radius = 100.0f; - -static float speed = 10.0f; - -static void -ball_move_idle2(SceneGraphPtr node, int screen_w, int screen_h) -{ - Pad *pad = sgroot->getController(); - - if (pad->circle.isHold()) { - if (pad->left.isHold()) { - node->xyz[0] -= speed; - if(node->xyz[0] < ball_radius) - node->xyz[0] = ball_radius; - } else if (pad->right.isHold()) { - node->xyz[0] += speed; - if(node->xyz[0] > screen_w - ball_radius) - node->xyz[0] = screen_w - ball_radius; - } - - if (pad->up.isHold()) { - node->xyz[1] -= speed; - } else if (pad->down.isHold()) { - node->xyz[1] += speed; - if(node->xyz[1] > screen_h - ball_radius) - node->xyz[1] = screen_h - ball_radius; - } - } else { - node->set_move_collision(ball_move, ball_collision); - } -} - -static int time = 0; - -static void -ball_move_idle(SceneGraphPtr node, int screen_w, int screen_h) -{ - Pad *pad = sgroot->getController(); - - if (pad->circle.isPush()) { - node->set_move_collision(ball_move_idle2, ball_collision_idle); - time = 0; - } - - time++; - - if (time > 90) { - float w = (float)random(); - - w = fmodf(w, screen_w - ball_radius*2); - node->xyz[0] = w + ball_radius; - node->xyz[1] = h0; - node->set_move_collision(ball_move, ball_collision); - time = 0; - } -} - -static void -ball_move(SceneGraphPtr node, int screen_w, int screen_h) -{ - vy += g * dt; - node->xyz[1] += vy * dt; - // node->xyz[0] += 10.0f; -} - -static void -ball_collision_idle(SceneGraphPtr, int w, int h, SceneGraphPtr tree) -{ -} - -static void -ball_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree) -{ - if (node->xyz[1] > screen_h - ball_radius) { - node->xyz[1] = screen_h - ball_radius; - - vy *= e; - if (vy > -g && vy < 0) { - vy = 0.0; - node->set_move_collision(ball_move_idle, ball_collision_idle); - } - } -} - - -void -ball_bound_init(TaskManager *manager, int screen_w, int screen_h) -{ - SceneGraphPtr ball; - - // 固定した値で srandom すると、毎回同じ、random() 列が生成される - // random な値が欲しいなら、man random に方法が書いてあります。 - srandom(100); - - sgroot->createFromXMLfile(manager, "xml_file/Ball.xml"); - ball = sgroot->createSceneGraph(Ball); - ball->set_move_collision(ball_move, ball_collision); - - h0 = screen_h/2; - h0 = -1000; - - ball->xyz[0] = screen_w/2; - //ball->xyz[0] = 0.0f; - ball->xyz[1] = h0; - ball->xyz[2] = 30.0f; - - sgroot->setSceneData(ball); -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/boss1_action.cc --- a/TaskManager/Test/test_render/boss1_action.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,269 +0,0 @@ -#include "SGList.h" -#include "boss1_action.h" - -/* -static void -null_move(SceneGraphPtr node, int screen_w, int screen_h) -{ -} -*/ - -static void -null_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree) -{ -} - - -static void -boss1_move_right(SceneGraphPtr node, int screen_w, int screen_h) { - node->xyz[0] += node->stack_xyz[0]; - if(node->xyz[0] > (screen_w - boss_radius_x)) { - node->set_move_collision(boss1_move_left, null_collision); - } -} - -//ボスが左に移動する動作 -static void -boss1_move_left(SceneGraphPtr node, int screen_w, int screen_h) { - node->xyz[0] -= node->stack_xyz[0]; - if(node->xyz[0] < boss_radius_x) { - node->set_move_collision(boss1_move_right, null_collision); - } -} - -//ボスが戦闘位置へ戻る時の動作 -/* -static void -boss1_move_return(SceneGraphPtr node, int screen_w, int screen_h) -{ - node->xyz[1] -= node->stack_xyz[1]; - node->xyz[2] -= node->stack_xyz[2]; - - if((node->xyz[2] = 0)) { - node->stack_xyz[0] = 1.0; - node->set_move_collision(boss1_move_left, null_collision); - } -} -*/ - -//ボス登場時の動き -/* -static void -boss1_first_move(SceneGraphPtr node, int screen_w, int screen_h) -{ - node->xyz[1] += node->stack_xyz[1]; - if(node->xyz[1] > screen_h) { - float time = first_boss1_depth / node->stack_xyz[2]; - node->stack_xyz[1] = (screen_h - boss_radius_y) / time; - node->stack_xyz[2] = return_boss1_depth_speed; - node->set_move_collision(boss1_move_return, null_collision); - } -} -*/ - -static void -player_move(SceneGraphPtr node, int screen_w, int screen_h) -{ - Pad *pad = sgroot->getController(); - - if (pad->left.isPush() - || pad->left.isHold()) { -#if 0 - SceneGraphPtr player_left; - player_left = sgroot->createSceneGraph(PLAYER_L); - player_left->set_move_collision(player_move_left, null_collision); - player_left->xyz[0] = node->xyz[0]; - player_left->xyz[1] = node->xyz[1]; - node->addChild(player_left); - node->flag_drawable = 1; -#endif - node->xyz[0] -= player_speed; - - if (node->xyz[0] - player_radius< 0) { - node->xyz[0] = player_radius; - } - } - - - if (pad->right.isPush() - || pad->right.isHold()) { - node->xyz[0] += player_speed; - - if (node->xyz[0] + player_radius > screen_w) { - node->xyz[0] = screen_w - player_radius; - } - } - - if (pad->up.isPush() - || pad->up.isHold()) { - node->xyz[1] -= player_speed; - - if (node->xyz[1] - player_radius < 0) { - node->xyz[1] = player_radius; - } - } - - if (pad->down.isPush() - || pad->down.isHold()) { - node->xyz[1] += player_speed; - - if (node->xyz[1] + player_radius > screen_h) { - node->xyz[1] = screen_h - player_radius; - } - } - - if (pad->circle.isPush()) { - SceneGraphPtr shot = sgroot->createSceneGraph(P_SHOT1); - shot->set_move_collision(shot_move, shot_collision); - shot->xyz[0] = node->xyz[0]; - shot->xyz[1] = node->xyz[1] - player_radius; - node->addBrother(shot); - } -} - -static void -player_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree) -{ - //自機とボスのx,y座標での距離と2点間の距離 - static float x_distant, y_distant, distance; - //ボスの四角形の四隅の座標 - // static float boss_low_x, boss_low_y, boss_high_x, boss_high_y; - - SceneGraphIteratorPtr it = sgroot->getIterator(tree); - - - for (; it->hasNext(BOSS1);) { - it->next(BOSS1); - SceneGraphPtr enemy = it->get(); - - //各変数の初期化 - x_distant = node->xyz[0] - enemy->xyz[0]; - y_distant = node->xyz[1] - enemy->xyz[1]; - - //hypotfで2点間の距離を求める - distance = hypotf(x_distant, y_distant); - - /*四角形と円のcollision - if( (fabs( node->xyz[1] - ( boss_low_y ))) - */ - - //円同士のcollision - if(distance < (player_radius + boss_radius_y)) { - printf("!!!CAUTION!!!\n"); - } - } -} - -static void -shot_move(SceneGraphPtr node, int screen_w, int screen_h) -{ - node->xyz[1] -= shot_speed; - - // 描画領域から抜けたら削除 - if (node->xyz[1] < 0) { - node->remove(); - } -} - -static void -shot_collision(SceneGraphPtr node, int screen_2, int screen_h, - SceneGraphPtr tree) -{ - //自機とボスのx,y座標での距離と2点間の距離 - static float x_distant, y_distant, distance; - //ボスの四角形の四隅の座標 - // static float boss_low_x, boss_low_y, boss_high_x, boss_high_y; - - SceneGraphIteratorPtr it = sgroot->getIterator(tree); - - - for (; it->hasNext(BOSS1);) { - it->next(BOSS1); - SceneGraphPtr enemy = it->get(); - - x_distant = node->xyz[0] - enemy->xyz[0]; - y_distant = node->xyz[1] - enemy->xyz[1]; - - //hypotfで2点間の距離を求める - distance = hypotf(x_distant, y_distant); - - //円同士のcollision - if(distance < boss_radius_y) { - SceneGraphPtr blast = sgroot->createSceneGraph(BLAST1); - - blast->set_move_collision(blast_move, null_collision); - blast->xyz[0] = node->xyz[0]; - blast->xyz[1] = node->xyz[1]; - node->addBrother(blast); - node->remove(); - } - } -} - -static void -blast_move(SceneGraphPtr node, int screen_w, int screen_h) -{ - if(node->sgid > BLAST8) { - SceneGraphPtr blast = sgroot->createSceneGraph(node->sgid - 1); - blast->set_move_collision(blast_move, null_collision); - blast->xyz[0] = node->xyz[0]; - blast->xyz[1] = node->xyz[1]; - node->addBrother(blast); - } - - if (node->sgid == BLAST8) { - node->flag_drawable = 1; - } - - if((node->frame > 1)) { - node->remove(); - } - node->frame += 1; -} - -void -boss1_init(TaskManager *manager, int screen_w, int screen_h) -{ - SceneGraphPtr root; - SceneGraphPtr player; - SceneGraphPtr boss1; - SceneGraphPtr left_parts; - SceneGraphPtr right_parts; - - sgroot->createFromXMLfile(manager, "xml_file/boss1.xml"); - sgroot->createFromXMLfile(manager, "xml_file/player1.xml"); - sgroot->createFromXMLfile(manager, "xml_file/p_shot.xml"); - sgroot->createFromXMLfile(manager, "xml_file/blast.xml"); - - //rootとなるSceneGraphを生成 - root = sgroot->createSceneGraph(); - - //自機の初期化 - player = sgroot->createSceneGraph(PLAYER); - player->xyz[0] = screen_w/2; - player->xyz[1] = screen_h - player_radius; - root->addChild(player); - - //ボスの初期化 - boss1 = sgroot->createSceneGraph(BOSS1); - boss1->xyz[0] = screen_w/2; - boss1->xyz[1] = boss_radius_y; - // boss1->xyz[2] = first_boss1_depth; - boss1->stack_xyz[0] = first_boss1_speed; - root->addChild(boss1); - - //ボスの左右パーツを追加 - left_parts = sgroot->createSceneGraph(BOSS1_L); - boss1->addChild(left_parts); - right_parts = sgroot->createSceneGraph(BOSS1_R); - boss1->addChild(right_parts); - - //各機体の動きと当たり判定をセット - player->set_move_collision(player_move, player_collision); - boss1->set_move_collision(boss1_move_left, null_collision); - - //仕上げ - sgroot->setSceneData(root); -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/boss1_action.h --- a/TaskManager/Test/test_render/boss1_action.h Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -#ifndef BOSS1_ACCTION_H -#define BOSS1_ACCTION_H - -#include -#include "SceneGraphRoot.h" -#include "SGList.h" - -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; - - -/* -static void -null_move(SceneGraphPtr node, int screen_w, int screen_h); -*/ - -static void -null_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree); - -static void -boss1_move_right(SceneGraphPtr node, int screen_w, int screen_h); - -static void -boss1_move_left(SceneGraphPtr node, int screen_w, int screen_h); - -/* -static void -boss1_move_return(SceneGraphPtr node, int screen_w, int screen_h); -*/ - -/* -static void -boss1_first_move(SceneGraphPtr node, int screen_w, int screen_h); -*/ - -static void -player_move(SceneGraphPtr node,int screen_2, int screen_h); - -/* -static void -player_move_left(SceneGraphPtr node,int screen_2, int screen_h); -*/ - -static void -player_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree); -static void -shot_move(SceneGraphPtr node, int screen_w, int screen_h); - -static void -shot_collision(SceneGraphPtr node, int screen_2, int screen_h, - SceneGraphPtr tree); -static void -blast_move(SceneGraphPtr node, int screen_w, int screen_h); - -#endif diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/bullet_action.cc --- a/TaskManager/Test/test_render/bullet_action.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -#include -#include "SceneGraphRoot.h" -#include "SGList.h" -#include "hit_judge.h" -#define PI M_PI - -int i = 0; - -void -bullet_init(SceneGraphPtr bullet, SceneGraphPtr player) -{ - bullet->xyz[0] = player->xyz[0]; - bullet->xyz[1] = player->xyz[1]; - bullet->xyz[2] = player->xyz[2]; - - bullet->angle[0] = player->angle[0]; - bullet->angle[1] = player->angle[1]; - bullet->angle[2] = player->angle[2]; -} - -void -bluebullet_move(SceneGraphPtr node, int screen_w, int screen_h) -{ - double a = (node->angle[2]+90)*PI/180; - double b = (node->angle[0]+90)*PI/180; - - double y = sin(a); - double x = cos(a); - double z = -cos(b); - - node->xyz[0] += x * 5;//x軸方向 - node->xyz[1] += y * 5;//y軸方向 - node->xyz[2] += z * 5;//z軸方向 -} - -void -bullet_collision(SceneGraphPtr node, int screen_w, int screen_h, SceneGraphPtr tree) -{ - SceneGraphIteratorPtr it = sgroot->getIterator(tree); - //static int damage = 0; - - for (; it->hasNext(E_PLANE);) { - it->next(E_PLANE); - SceneGraphPtr enemy = it->get(); - - int judge = square_judge(node, enemy); - if(judge == HIT) - { - //node->set_move_collision(null_move, bullet_collision); - //E_PLANE->set_move_collision(null_move, enemy_collision); - enemy->remove(); - node->remove(); - //printf("hit!!!\n"); - //bullet_delete(node, scene_graph); - } - } - - if(node->xyz[1] > 100) - { - node->remove(); - //scene_graph->delete_object(node, node->next,node->prev); - //i -= 1; - //printf("bullet_delete:残り弾数=%d\n",i); - } -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/bullet_action.h --- a/TaskManager/Test/test_render/bullet_action.h Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -#ifndef BULLET_ACTION_H -#define BULLET_ACTION_H - -void bullet_init(SceneGraphPtr scene_graph, SceneGraphPtr node); -void bluebullet_move(SceneGraphPtr node, int screen_w, int screen_h); -void bullet_collision(SceneGraphPtr node, int screen_w, int screen_h ,SceneGraphPtr tree); - -#endif diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/camera_action.cc --- a/TaskManager/Test/test_render/camera_action.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -#include "SceneGraphRoot.h" -#include "SGList.h" -#include "camera_action.h" - -#define MOVE_SPEED 0.10 - -void -camera_init(SceneGraphPtr node, int screen_w, int screen_h) -{ - node->xyz[0] = screen_w/2; - node->xyz[1] = screen_h/2 + 50; - node->xyz[2] = 0; - node->angle[0] = 120; -} - -void -c_move(SceneGraphPtr node, int screen_w, int screen_h) -{ - Pad *pad = sgroot->getController(); - - if(pad->right.isHold()) - { - if(node->xyz[0]>screen_w/2 - 50) - { - node->xyz[0]-=MOVE_SPEED; - } - } - - if(pad->left.isHold()) - { - if(node->xyz[0]xyz[0]+=MOVE_SPEED; - } - } - - if(pad->down.isHold()) - { - if(node->xyz[2]>-25) - { - node->xyz[2]-=MOVE_SPEED; - } - } - - if(pad->up.isHold()) - { - if(node->xyz[2]<25) - { - node->xyz[2]+=MOVE_SPEED; - } - } - -} - -void -camera_collision(SceneGraphPtr node, int screen_w, int screen_h,SceneGraphPtr tree) -{ -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/camera_action.h --- a/TaskManager/Test/test_render/camera_action.h Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -void camera_init(SceneGraphPtr node, int screen_w, int screen_h); -void c_movet(SceneGraphPtr node, int screen_w, int screen_h); -void camera_collision(SceneGraphPtr node, int screen_w, int screen_h, SceneGraphPtr tree); diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/chain.cc --- a/TaskManager/Test/test_render/chain.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,170 +0,0 @@ -#include -#include -#include "SceneGraphRoot.h" -#include "SceneGraph.h" -#include "SGList.h" -#include "TaskManager.h" -#include "Func.h" - -#define FALSE 0 -#define TRUE !FALSE -#define CHAIN_LEN 50 - -static double chain_width = 10; - -typedef struct { - double x, y, next_x, next_y; - double vx, vy, next_vx, next_vy; - double angle[3]; - int can_move; - SceneGraphPtr parent; - int id; - //int parent; -} CHAIN_VARS; - -/* SceneGraph の property */ -CHAIN_VARS* properties[2]; -CHAIN_VARS* property; - - -//void createSceneGraphFromProperty(CHAIN_VARS* p) ; -void createSceneGraphFromProperty(void* p) ; - -void -init_chain_vars(CHAIN_VARS *cv) { - cv->x = 0, cv->y = 0, cv->next_x = 0, cv->next_y = 0; - cv->vx = 0, cv->vy = 0, cv->next_vx = 0, cv->next_vy = 0; - cv->can_move = TRUE; -} - -void -set_vector(CHAIN_VARS *p, SceneGraphPtr sg) { - sg->xyz[0] = p->next_x; - sg->xyz[1] = p->next_y; - sg->xyz[2] = 0.0f; - sg->angle[0] = p->angle[0]; - sg->angle[1] = p->angle[1]; - sg->angle[2] = p->angle[2]; -} - - -static void -chain_move_ope(SceneGraphPtr node, int screen_w, int screen_h) -{ - Pad *pad = sgroot->getController(); - - if (pad->circle.isHold()) { - property[CHAIN_LEN-1].can_move = FALSE; - if (pad->left.isHold()) { - property[CHAIN_LEN-1].x += -5.0; - } else if (pad->right.isHold()) { - property[CHAIN_LEN-1].x += 5.0; - } - - if (pad->up.isHold()) { - property[CHAIN_LEN-1].y += -5.0; - } else if (pad->down.isHold()) { - property[CHAIN_LEN-1].y += 5.0; - } - } else { - property[CHAIN_LEN-1].can_move = TRUE; - } -} - -void -chain_move(TaskManager *manager, SceneGraphPtr sg, int w, int h) -{ - int id = sg->id; - //CHAIN_VARS* p = (CHAIN_VARS*)sg->propertyptr; - HTaskPtr chain_cal; - CHAIN_VARS* output; - - // SceneGraph の切り替えもここでやる - if (property == properties[0]) { - property = properties[1]; - output = properties[0]; - }else{ - property = properties[0]; - output = properties[1]; - } - chain_cal = manager->create_task(CHAINCAL_TASK); - chain_cal->add_inData(property, sizeof(CHAIN_VARS)*CHAIN_LEN); - chain_cal->add_param(id); - chain_cal->add_outData(output, sizeof(CHAIN_VARS)*CHAIN_LEN); - chain_cal->set_post(createSceneGraphFromProperty, (void*)id); - chain_cal->spawn(); - -} - -void -chain_collision(SceneGraphPtr sg, int w, int h, SceneGraphPtr osg) -{ - -} - -void -createSceneGraphFromProperty(void* p) -{ - CHAIN_VARS* chain_p = (CHAIN_VARS*)p; - SceneGraphPtr chain_copy = sgroot->createSceneGraph(CHAIN); - chain_copy->propertyptr = (void*)chain_p; - chain_copy->property_size = sizeof(CHAIN_VARS); - set_vector(chain_p, chain_copy); - chain_p->parent->addChild(chain_copy); -} - -void -chain_init(TaskManager *manager, int w, int h) -{ - SceneGraphPtr root_chain, chain; - CHAIN_VARS rcv; - - HTaskPtr chain_init; - - - sgroot->createFromXMLfile(manager, "xml_file/chain.xml"); - - /* SPE に送る property の配列の領域確保 */ - properties[0] = (CHAIN_VARS*)manager->allocate(sizeof(CHAIN_VARS)*CHAIN_LEN); - properties[1] = (CHAIN_VARS*)manager->allocate(sizeof(CHAIN_VARS)*CHAIN_LEN); - property = properties[0]; - - root_chain = sgroot->createSceneGraph(CHAIN); - // set_move_collision()ではだめ - root_chain->set_move_collision(chain_move_ope, chain_collision); - init_chain_vars(&rcv); - rcv.next_x = w / 2; - rcv.next_y = 0.0; - rcv.angle[0] = 0; - rcv.angle[1] = 0; - rcv.angle[2] = 0; - - set_vector(&rcv, root_chain); - - for(int i = 0; i < CHAIN_LEN; i++) { - chain = sgroot->createSceneGraph(CHAIN); - property[i].id = i; - init_chain_vars(&property[i]); - property[i].x = 0; - property[i].y = chain_width * i; - set_vector(&property[i], chain); - property->angle[1] = -90 * (i % 2); - //chain->set_move_collision(chain_move, chain_collision); - chain->propertyptr = &property[i]; - chain->property_size = sizeof(CHAIN_VARS); - root_chain->addChild(chain); - property[i].parent = root_chain; - } - property[0].can_move = FALSE; - - // property を SPU の共有領域へコピーする - chain_init = manager->create_task(CHAININIT_TASK); - chain_init->add_inData(property, sizeof(CHAIN_VARS)*CHAIN_LEN); - chain_init->add_param(CHAIN_LEN); - chain_init->set_cpu(SPE_0); - chain_init->set_post(createSceneGraphFromProperty, (void*)property); - chain_init->spawn(); - - sgroot->setSceneData(root_chain); -} - diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/cube.cc --- a/TaskManager/Test/test_render/cube.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,174 +0,0 @@ -#include -#include "SceneGraphRoot.h" -#include "vacuum.h" -#include "SGList.h" -#define SELECT 2 - -void -cube_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree) -{ - if (node->frame > 120) { - cube_split(node,tree); - } -} - -void -cube_move_left(SceneGraphPtr node, int screen_w, int screen_h) -{ - node->xyz[0] -= node->stack_xyz[0]; - node->xyz[1] += node->stack_xyz[1]; - - if (node->xyz[0] < 0) { - node->set_move_collision(cube_move_right, cube_collision); - } - - if (node->xyz[1] < 0 || node->xyz[1] > screen_h) { - node->stack_xyz[1] = -node->stack_xyz[1]; - } -} - -void -cube_rotate(SceneGraphPtr node, int w, int h) -{ - node->angle[0] += 2.0f; - node->angle[1] += 2.0f; - node->angle[2] += 2.0f; -} - -void -cube_move_right(SceneGraphPtr node, int screen_w, int screen_h) -{ - node->xyz[0] += node->stack_xyz[0]; - node->xyz[1] += node->stack_xyz[1]; - - if (node->xyz[0] > screen_w) { - node->set_move_collision(cube_move_left, cube_collision); - } - - if (node->xyz[1] < 0 || node->xyz[1] > screen_h) { - node->stack_xyz[1] = -node->stack_xyz[1]; - } - -} - - -void -cube_split(SceneGraphPtr root,SceneGraphPtr tree) -{ - - SceneGraphPtr p; - // SceneGraphPtr common_move = sgroot->createSceneGraph(); - // SceneGraphPtr root_common_move = root->parent; - - if(random()%SELECT) { - p = sgroot->createSceneGraph(REDCUBE); - } - else { - p = sgroot->createSceneGraph(ENEMY); - } - - root->set_move_collision(cube_move_right, cube_collision); - p->set_move_collision(cube_move_left, cube_collision); - - root->frame = 0; - p->frame = 0; - - p->xyz[0] = root->xyz[0] + 2; - p->xyz[1] = root->xyz[1]; - p->xyz[2] = root->xyz[2]; - - p->stack_xyz[0] = 2.0f; - p->stack_xyz[1] = random()%3-1; - p->stack_xyz[2] = 0.0f; - - root->xyz[0] -= 2; - root->stack_xyz[0] = 2.0f; - root->stack_xyz[1] = random()%3-1; - - //common_move->addChild(p); - root->addBrother(p); - -} - - -void -collision_red(SceneGraphIteratorPtr it,SceneGraphPtr node) -{ - float dx, dy,ddx,ddy, r; - float q = 0; - - for (; it->hasNext(REDCUBE);) { - - it->next(REDCUBE); - SceneGraphPtr mcube = it->get(); - dx = node->xyz[0] - mcube->xyz[0]; - dy = node->xyz[1] - mcube->xyz[1]; - - ddx = dx*dx; - ddy = dy*dy; - - if(sqrt(ddx) < 10 && sqrt(ddy) < 10) { - mcube->remove(); - continue; - } - r = sqrt(ddx + ddy); - if (r >= 1) q = 200/r; - if (dx == 0) { - if(mcube->xyz[1] > node->xyz[1]) { - mcube->stack_xyz[1] -= q; - } else if(mcube->xyz[1] < node->xyz[1]) { - mcube->stack_xyz[1] += q; - } - } else { - if(mcube->xyz[0] > node->xyz[0]) { - mcube->xyz[0] -= q*cos(atan(dy/dx)); - mcube->xyz[1] -= q*sin(atan(dy/dx)); - } else if(mcube->xyz[0] < node->xyz[0]) { - mcube->xyz[0] += q*cos(atan(dy/dx)); - mcube->xyz[1] += q*sin(atan(dy/dx)); - } - } - } -} - -void -collision_purple(SceneGraphIteratorPtr it,SceneGraphPtr node,int w,int h) -{ - float dx, dy,ddx,ddy, r; - float q = 0; - - for (; it->hasNext(ENEMY);) { - it->next(ENEMY); - SceneGraphPtr mcube = it->get(); - - dx = node->xyz[0] - mcube->xyz[0]; - dy = node->xyz[1] - mcube->xyz[1]; - ddx = dx*dx; - ddy = dy*dy; - - if(sqrt(ddx) < 10 && sqrt(ddy) < 10) { - gameover_scene(w,h,mcube); - node->remove(); - break; - } - r = sqrt(ddx + ddy); - if (r >= 1) q = 200/r; - if (dx == 0) { - if(mcube->xyz[1] > node->xyz[1]) { - mcube->stack_xyz[1] -= q; - } else if(mcube->xyz[1] < node->xyz[1]) { - mcube->stack_xyz[1] += q; - } - } else { - - if(mcube->xyz[0] > node->xyz[0]) { - mcube->xyz[0] -= q*cos(atan(dy/dx)); - mcube->xyz[1] -= q*sin(atan(dy/dx)); - } else if(mcube->xyz[0] < node->xyz[0]) { - mcube->xyz[0] += q*cos(atan(dy/dx)); - mcube->xyz[1] += q*sin(atan(dy/dx)); - } - } - } -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/cube_action.cc --- a/TaskManager/Test/test_render/cube_action.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -#include -#include "SceneGraphRoot.h" -#include "SGList.h" - -static void cube_move_left(SceneGraphPtr node, int screen_w, int screen_h); -static void cube_move_right(SceneGraphPtr node, int screen_w, int screen_h); -static void cube_move_idle(SceneGraphPtr node, int screen_w, int screen_h); -static void cube_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree); - -static void cube_split(SceneGraphPtr root); - -static void -cube_move_left(SceneGraphPtr node, int screen_w, int screen_h) -{ - node->xyz[0] -= node->stack_xyz[0]; - node->xyz[1] -= node->stack_xyz[0] * node->stack_xyz[1]; - node->xyz[2] -= node->stack_xyz[0] * node->stack_xyz[2]; - - if (node->xyz[0] < 0) { - node->set_move_collision(cube_move_right, cube_collision); - } - - if (node->xyz[1] < 0 || node->xyz[1] > screen_h) { - node->stack_xyz[1] = -node->stack_xyz[1]; - } - - node->angle[0] += 2.0f; - node->angle[1] += 2.0f * node->stack_xyz[1]; - node->angle[2] += 2.0f * node->stack_xyz[2]; - - node->angle[0] = fmodf(node->angle[0], 360.0f); - node->angle[1] = fmodf(node->angle[1], 360.0f); - node->angle[2] = fmodf(node->angle[2], 360.0f); - - if (node->frame > 10 && sgroot->controller->circle.isPush()) { - cube_split(node); - } -} - -static void -cube_move_right(SceneGraphPtr node, int screen_w, int screen_h) -{ - node->xyz[0] += node->stack_xyz[0]; - node->xyz[1] -= node->stack_xyz[0] * node->stack_xyz[1]; - node->xyz[2] -= node->stack_xyz[0] * node->stack_xyz[2]; - - if (node->xyz[0] > screen_w) { - node->set_move_collision(cube_move_left, cube_collision); - } - - if (node->xyz[1] < 0 || node->xyz[1] > screen_h) { - node->stack_xyz[1] = -node->stack_xyz[1]; - } - - node->angle[0] += 2.0f; - node->angle[1] += 2.0f * node->stack_xyz[1]; - node->angle[2] += 2.0f * node->stack_xyz[2]; - - node->angle[0] = fmodf(node->angle[0], 360.0f); - node->angle[1] = fmodf(node->angle[1], 360.0f); - node->angle[2] = fmodf(node->angle[2], 360.0f); - - if (node->frame > 10 && sgroot->controller->circle.isPush()) { - cube_split(node); - } -} - -static void -cube_split(SceneGraphPtr root) -{ - SceneGraphPtr p = root->clone(); - root->addBrother(p); - - root->set_move_collision(cube_move_left, cube_collision); - p->set_move_collision(cube_move_right, cube_collision); - - p->xyz[0] = root->xyz[0] + 2; - p->xyz[1] = root->xyz[1]; - p->xyz[2] = root->xyz[2]; - - p->stack_xyz[0] = 2.0f; - p->stack_xyz[1] = random()%3-1; - p->stack_xyz[2] = random()%3-1; - - root->xyz[0] -= 2; - root->stack_xyz[0] = 2.0f; - root->stack_xyz[1] = random()%3-1; - root->stack_xyz[2] = random()%3-1; -} - - -static void -cube_move_idle(SceneGraphPtr node, int screen_w, int screen_h) -{ - node->xyz[0] = screen_w/2; - node->xyz[1] = screen_h/2; - //node->xyz[2] = -300.0f; - - if (sgroot->controller->circle.isPush()) { - cube_split(node); - } -} - -static void -cube_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree) -{ -} - -void -create_cube_split(TaskManager *manager, int number) -{ - SceneGraphPtr cube; - SceneGraphPtr back; - - sgroot->createFromXMLfile(manager, "xml_file/cube.xml"); - - // 何もしない親 - // cube は brother として繋がっていくので - // 親が居ないとだめ。 - back = sgroot->createSceneGraph(); - - cube = sgroot->createSceneGraph(Cube); - cube->xyz[0] = 960.0f; - cube->xyz[1] = 540.0f; - cube->set_move_collision(cube_move_idle, cube_collision); - - back->addChild(cube); - - sgroot->setSceneData(back); -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/demonstration.h --- a/TaskManager/Test/test_render/demonstration.h Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -#ifndef INCLUDED_DEMONSTRATION -#define INCLUDED_DEMONSTRATION - -#include "polygon.h" - -class Demonstration{ - public: - Polygon *list; - void (Demonstration::*action_demo)(); - - Demonstration(); - //~Demonstration(); - void test_init(); - void test_play(); - void test_end(); -}; - -#endif diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/direction.cc --- a/TaskManager/Test/test_render/direction.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -#include "SceneGraphRoot.h" -#include "SGList.h" - -static void -x_move(SceneGraphPtr node, int w, int h) -{ - Pad *pad = sgroot->getController(); - - node->xyz[0] = w/2; - node->xyz[1] = h/2; - - if (pad->circle.isPush() || pad->circle.isHold()) { - node->angle[1] += 10.0f; - if (node->angle[1] > 360.0f) node->angle[1] = 0.0f; - } - - if (pad->triangle.isPush() || pad->triangle.isHold()) { - node->angle[0] += 10.0f; - if (node->angle[0] > 360.0f) node->angle[0] = 0.0f; - } - - if (pad->start.isPush()) { - node->angle[0] = 0.0f; - node->angle[1] = 90.0f; - } - -} - -static void -y_move(SceneGraphPtr node, int w, int h) -{ - Pad *pad = sgroot->getController(); - - node->xyz[0] = w/2; - node->xyz[1] = h/2; - - if (pad->cross.isPush() || pad->cross.isHold()) { - node->angle[2] += 10.0f; - } - - if (pad->square.isPush() || pad->square.isHold()) { - node->angle[0] += 10.0f; - } - - if (pad->start.isPush()) { - node->angle[0] = 90.0f; - node->angle[1] = 0.0f; - } - -} - -static void -z_move(SceneGraphPtr node, int w, int h) -{ - node->xyz[0] = w/2; - node->xyz[1] = h/2; -} - -static void -dir_collision(SceneGraphPtr node, int w, int h, SceneGraphPtr tree) -{ -} - -void -direction_init(TaskManager *manager) -{ - SceneGraphPtr dx; - SceneGraphPtr dy; - SceneGraphPtr dz; - SceneGraphPtr back; - - sgroot->createFromXMLfile(manager, "xml_file/direction.xml"); - - dx = sgroot->createSceneGraph(Dirx); - dy = sgroot->createSceneGraph(Diry); - dz = sgroot->createSceneGraph(Dirz); - back = sgroot->createSceneGraph(); - - back->addChild(dx); - back->addChild(dy); - back->addChild(dz); - - dx->set_move_collision(x_move, dir_collision); - dx->angle[1] = 90.0f; - dy->set_move_collision(y_move, dir_collision); - dy->angle[0] = 90.0f; - dz->set_move_collision(z_move, dir_collision); - - back->angle[0] = 30.0f; - back->angle[1] = -30.0f; - - sgroot->setSceneData(back); -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/enemy_action.cc --- a/TaskManager/Test/test_render/enemy_action.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -#include -#include "SceneGraph.h" -#include "enemy_action.h" - -#define PI M_PI - -double vx = 5.0; - -void -enemy_move(SceneGraphPtr node, int screen_w, int screen_h) -{ - double vxr = (node->xyz[0])*PI/180; - if(node->xyz[0] > screen_w/2 || node->xyz[0] < -screen_w/2) - { - vx *= -1; - } - //printf("%f\n", vx); - node->angle[1]+=vx; - - node->xyz[0] += vx; - node->xyz[1] = -sin(vxr*2)*20*vx; - node->xyz[2] = sin(vxr*4)*2*vx; -} - - -void -enemy_collision(SceneGraphPtr node, int screen_w, int screen_h, SceneGraphPtr tree) -{ -#if 0 - int judge = square_judge(E_PLANE, BULEBULLET, tree); - if(judge == HIT) - { - E_PLANE->set_move_collision(null_move, enemy_collision); - printf("ENEMY_hit!!!\n"); - //scene_graph->delete_object(node, node->next,node->prev); - } -#endif -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/enemy_action.h --- a/TaskManager/Test/test_render/enemy_action.h Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -extern void enemy_move(SceneGraphPtr node, int screen_w, int screen_h); -extern void enemy_collision(SceneGraphPtr node, int screen_w, int screen_h, SceneGraphPtr tree); diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/game_over.cc --- a/TaskManager/Test/test_render/game_over.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -#include "SceneGraphRoot.h" -#include "vacuum.h" -#include "SGList.h" - - -void -gameover_scene(int w,int h,SceneGraphPtr node) -{ - - SceneGraphPtr over; - - over = sgroot->createSceneGraph(GAMEOVER); - over->xyz[0] = w/2; - over->xyz[1] = h/2; - over->set_move_collision(gameover_idle,gameover_collision); - node->addBrother(over); -} - -void -gameover_idle(SceneGraphPtr node,int screen_w,int screen_h) -{ -} - -void -gameover_collision(SceneGraphPtr node,int screen_w,int screen_h,SceneGraphPtr tree) -{ - - Pad *pad = sgroot->getController(); - - if(pad->start.isPush()) { - - SceneGraphPtr title; - - title = sgroot->createSceneGraph(TITLE); - title->xyz[0] = screen_w/2; - title->xyz[1] = screen_h/2; - title->set_move_collision(no_move_idle, title_collision); - sgroot->setSceneData(title); - - } - -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/gaplant.cc --- a/TaskManager/Test/test_render/gaplant.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -#include "SceneGraphRoot.h" -#include "SGList.h" -#include "gaplant_action.h" -#include "back_action.h" - -void -init_gaplant(TaskManager *manager, int w, int h) -{ - SceneGraphPtr back; - SceneGraphPtr gaplant; - sgroot->createFromXMLfile(manager, "xml_file/gap_plane_test.xml"); - sgroot->createFromXMLfile(manager, "xml_file/Ball.xml"); - - back = sgroot->createSceneGraph(); - back->set_move_collision(back_move, back_coll); - gaplant = sgroot->createSceneGraph(); - gaplant->xyz[0] = 200; - gaplant->angle[0] = -60; - gaplant->angle[1] = 0; - gaplant->angle[2] = 0; - gaplant->set_move_collision(gaplant_move, gaplant_coll); - - for (int i = arm_L_D; i <= foot_L_A; i++) { - SceneGraphPtr p = sgroot->createSceneGraph(i); - gaplant->addChild(p); - } - - back->addChild(gaplant); - sgroot->setSceneData(back); -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/gaplant.h --- a/TaskManager/Test/test_render/gaplant.h Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -const double CHECK_HIT_RAD = 110; -const double BALL_RAD = 100; diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/gaplant_action.cc --- a/TaskManager/Test/test_render/gaplant_action.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -#include -#include -#include "SceneGraphRoot.h" -#include "SGList.h" -#include "gaplant.h" -using namespace std; - -void -move_right(SceneGraphPtr node) -{ - /*cout << "右を押したんだ " << node->angle[2] << "\n"; - node->angle[2] -= 1; - if (node->angle[2] < -30) { - node->angle[2] = -30; - }*/ - node->xyz[0] += 5; -} - -void -move_left(SceneGraphPtr node) -{ - /*cout << "左を押したんだ " << node->angle[2] << "\n"; - node->angle[1] += 1; - if (node->angle[2] > 30) { - node->angle[2] = 30; - }*/ - node->xyz[0] -= 5; -} - -void -move_down(SceneGraphPtr node) -{ - /*cout << "下だって押したくなる時はある "<< node->angle[0] << "\n"; - node->angle[0] += 1; - if (node->angle[0] > -60) { - node->angle[0] = -60; - }*/ - node->xyz[1] += 5; -} - -void -move_up(SceneGraphPtr node) -{ - /*cout << "上を押したんだ "<< node->angle[0] << "\n"; - node->angle[0] -= 1; - if (node->angle[0] < -120) { - node->angle[0] = -120; - }*/ - node->xyz[1] -= 5; -} - -void -gaplant_move(SceneGraphPtr node, int w, int h) -{ - Pad *pad = sgroot->getController(); - - if (pad->right.isHold() || pad->left.isHold() || pad->down.isHold() || pad->up.isHold()) { - if (pad->right.isHold()) { - move_right(node); - } else if (pad->left.isHold()) { - move_left(node); - } else if (pad->down.isHold()) { - move_down(node); - } else if (pad->up.isHold()) { - move_up(node); - } - } - - if (pad->cross.isHold() || pad->circle.isHold()) { - if (pad->cross.isHold()) { - node->xyz[2] += 5; - } else if (pad->circle.isHold()) { - node->xyz[2] -= 5; - } - } -} - -void -gaplant_coll(SceneGraphPtr node, int w, int h, SceneGraphPtr tree) -{ - SceneGraphIteratorPtr it = sgroot->getIterator(tree); - //static int damage = 0; - - for (; it->hasNext(Ball);) { - it->next(Ball); - SceneGraphPtr ball = it->get(); - - double dis_x = node->xyz[0] - ball->xyz[0]; - double dis_y = node->xyz[1] - ball->xyz[1]; - double dis_z = node->xyz[2] - ball->xyz[2]; - double distance = sqrt(dis_x*dis_x + dis_y*dis_y + dis_z*dis_z); - - if (distance < CHECK_HIT_RAD + BALL_RAD) { - cout << "今からもっと細かく判定するよ ^q^\n"; - ball->remove(); - } - } -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/gaplant_action.h --- a/TaskManager/Test/test_render/gaplant_action.h Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -void gaplant_move(SceneGraphPtr, int, int); -void gaplant_coll(SceneGraphPtr, int, int, SceneGraphPtr); diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/hit_judge.cc --- a/TaskManager/Test/test_render/hit_judge.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -#include "SceneGraph.h" -#include "hit_judge.h" -#include "SGList.h" - -#define FUSELAGE_W 6 -#define FUSELAGE_H 6 -#define FUSELAGE_Z 6 -#define E_PLANE_W 6*4 -#define E_PLANE_H 6*4 -#define E_PLANE_Z 6*4 -#define BULLTE_W 2*4 -#define BULLTE_H 6*4 -#define BULLTE_Z 2*4 - -int -square_judge(SceneGraphPtr oneself, SceneGraphPtr partner) -{ - int ow = 0, oh = 0, oz = 0; - int pw = 0, ph = 0, pz = 0; - if (oneself->sgid == IDLE) - { - ow = FUSELAGE_W; - oh = FUSELAGE_H; - oz = FUSELAGE_Z; - } - else if (oneself->sgid == E_PLANE) - { - ow = E_PLANE_W; - oh = E_PLANE_H; - oz = E_PLANE_Z; - } - else if(oneself->sgid == BULEBULLET) - { - ow = BULLTE_W; - oh = BULLTE_H; - oz = BULLTE_Z; - } - if(partner->sgid == IDLE) - { - pw = FUSELAGE_W; - ph = FUSELAGE_H; - pz = FUSELAGE_Z; - } - else if(partner->sgid == E_PLANE) - { - pw = E_PLANE_W; - ph = E_PLANE_H; - pz = E_PLANE_Z; - } - else if(partner->sgid == BULEBULLET) - { - pw = BULLTE_W; - ph = BULLTE_H; - pz = BULLTE_Z; - } - - - int ox_min = (int)(oneself->xyz[0] + oneself->c_xyz[0] - ow/2); - int oy_min = (int)(oneself->xyz[1] + oneself->c_xyz[1] - oh/2); - int oz_min = (int)(oneself->xyz[2] + oneself->c_xyz[2] - oz/2); - - int ox_max = (int)(oneself->xyz[0] + oneself->c_xyz[0] + ow/2); - int oy_max = (int)(oneself->xyz[1] + oneself->c_xyz[1] + oh/2); - int oz_max = (int)(oneself->xyz[2] + oneself->c_xyz[2] + oz/2); - - int px_min = (int)(partner->xyz[0] + partner->c_xyz[0] - pw/2); - int py_min = (int)(partner->xyz[1] + partner->c_xyz[1] - ph/2); - int pz_min = (int)(partner->xyz[2] + partner->c_xyz[2] - pz/2); - - int px_max = (int)(partner->xyz[0] + partner->c_xyz[0] + pw/2); - int py_max = (int)(partner->xyz[1] + partner->c_xyz[1] + ph/2); - int pz_max = (int)(partner->xyz[2] + partner->c_xyz[2] + pz/2); - - if(ox_max < px_min || px_max < ox_min || oy_max < py_min || py_max < oy_min || oz_max < pz_min || pz_max < oz_min) - { - } else { - return HIT; - } - return 0; -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/hit_judge.h --- a/TaskManager/Test/test_render/hit_judge.h Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -#ifndef HIT_JUDGE_H -#define HIT_JUDGE_H - -#define TOUCH_LOWER 1 -#define TOUCH_TOP 2 -#define TOUCH_RIGHT 3 -#define TOUCH_LEFT 4 -#define HIT 5 - -extern int square_judge(SceneGraphPtr oneself, SceneGraphPtr partner); -#endif diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/icon.png Binary file TaskManager/Test/test_render/icon.png has changed diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/ieshoot.cc --- a/TaskManager/Test/test_render/ieshoot.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,216 +0,0 @@ -#include "SceneGraphRoot.h" -#include "SGList.h" - -static const float jiki_speed = 6.0f; -static const float jiki_radius = 32.0f; - -static const float tama_speed = 10.0f; -static const float tama_radius = 16.0f; - -static const float boss_radius_x = 64.0f; -static const float boss_radius_y = 128.0f; - -static const float iebosstama_speed = 15.0f; - -static void -ieboss_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree); -static void -ieboss_collision_invincibil(SceneGraphPtr node, int screen_w, int screen_h, SceneGraphPtr tree); -static void ieboss_move(SceneGraphPtr node, int screen_w, int screen_h); - -static void iebosstama_move(SceneGraphPtr node, int screen_w, int screen_h); - - -static void -iejiki_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree) -{ -} - -static void -ietama_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree) -{ -} - -static void -ieboss_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree) -{ - SceneGraphIteratorPtr it = sgroot->getIterator(tree); - static int damage = 0; - - for (; it->hasNext(IETAMA);) { - it->next(IETAMA); - SceneGraphPtr tama = it->get(); - - if (node->xyz[0] - boss_radius_x < tama->xyz[0] + tama_radius - && node->xyz[0] + boss_radius_x > tama->xyz[0] - tama_radius - && node->xyz[1] + boss_radius_y > tama->xyz[1] - tama_radius) { - tama->remove(); - - node->set_move_collision(ieboss_move, ieboss_collision_invincibil); - - SceneGraphPtr iebosstama = sgroot->createSceneGraph(Earth); - iebosstama->set_move_collision(iebosstama_move, ietama_collision); - iebosstama->xyz[0] = node->xyz[0]; - iebosstama->xyz[1] = node->xyz[1] + boss_radius_y; - //iebosstama->xyz[2] = 50.0f; - node->addBrother(iebosstama); - - damage++; - } - } - - if (damage > 10) { - node->remove(); - } -} - -static void -ieboss_move(SceneGraphPtr node, int screen_w, int screen_h) -{ - /** - * TODO - * Boss が複数居た場合、これじゃ駄目 - */ - static float x_speed = 5.0f; - static float z_speed = 5.0f; - - node->xyz[0] += x_speed; - - if (node->xyz[0] - boss_radius_x < 0) { - x_speed = -x_speed; - node->xyz[0] = boss_radius_x; - } else if (node->xyz[0] + boss_radius_x > screen_w) { - x_speed = -x_speed; - node->xyz[0] = screen_w - boss_radius_x; - } - - //node->xyz[2] += z_speed; - if (node->xyz[2] >= 100.0f) { - node->xyz[2] = 99.99f; - z_speed = -z_speed; - } else if (node->xyz[2] <= -100.0f) { - node->xyz[2] = -99.99f; - z_speed = -z_speed; - } -} - -static void -ieboss_collision_invincibil(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree) -{ - static int frame = 0; - - frame++; - - node->flag_drawable ^= 1; - - if (frame > 60) { - frame = 0; - node->flag_drawable = 1; - node->set_move_collision(ieboss_move, ieboss_collision); - } -} - -static void -iebosstama_move(SceneGraphPtr node, int screen_w, int screen_h) -{ - node->xyz[1] += iebosstama_speed; - - // 描画領域から抜けたら削除 - if (node->xyz[1] > screen_h) { - node->remove(); - } -} - -static void -ietama_move(SceneGraphPtr node, int screen_w, int screen_h) -{ - node->xyz[1] -= tama_speed; - - // 描画領域から抜けたら削除 - if (node->xyz[1] < 0) { - node->remove(); - } -} - -static void -iejiki_move(SceneGraphPtr node, int screen_w, int screen_h) -{ - Pad *pad = sgroot->getController(); - - if (pad->left.isPush() - || pad->left.isHold()) { - node->xyz[0] -= jiki_speed; - - if (node->xyz[0] - jiki_radius< 0) { - node->xyz[0] = jiki_radius; - } - } - - if (pad->right.isPush() - || pad->right.isHold()) { - node->xyz[0] += jiki_speed; - - if (node->xyz[0] + jiki_radius > screen_w) { - node->xyz[0] = screen_w - jiki_radius; - } - } - - if (pad->up.isPush() - || pad->up.isHold()) { - node->xyz[1] -= jiki_speed; - - if (node->xyz[1] - jiki_radius < 0) { - node->xyz[1] = jiki_radius; - } - } - - if (pad->down.isPush() - || pad->down.isHold()) { - node->xyz[1] += jiki_speed; - - if (node->xyz[1] + jiki_radius > screen_h) { - node->xyz[1] = screen_h - jiki_radius; - } - } - - if (pad->circle.isPush()) { - SceneGraphPtr ietama = sgroot->createSceneGraph(IETAMA); - ietama->set_move_collision(ietama_move, ietama_collision); - ietama->xyz[0] = node->xyz[0]; - ietama->xyz[1] = node->xyz[1]; - node->addBrother(ietama); - } -} - - -void -ieshoot_init(TaskManager *manager) -{ - SceneGraphPtr iejiki; - SceneGraphPtr enemy; - SceneGraphPtr back; - - sgroot->createFromXMLfile(manager, "xml_file/ietama.xml"); - sgroot->createFromXMLfile(manager, "xml_file/ieboss.xml"); - sgroot->createFromXMLfile(manager, "xml_file/iejiki.xml"); - sgroot->createFromXMLfile(manager, "xml_file/universe.xml"); - - back = sgroot->createSceneGraph(); - - iejiki = sgroot->createSceneGraph(IEJIKI); - iejiki->set_move_collision(iejiki_move, iejiki_collision); - iejiki->xyz[2] = 20; - back->addChild(iejiki); - - enemy = sgroot->createSceneGraph(IEBOSS); - enemy->set_move_collision(ieboss_move, ieboss_collision); - enemy->xyz[1] = boss_radius_y; - back->addChild(enemy); - - sgroot->setSceneData(back); -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/init_position.cc --- a/TaskManager/Test/test_render/init_position.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#include "SceneGraphRoot.h" -#include "SGList.h" -#include "player_action.h" -#include "enemy_action.h" -#include "camera_action.h" - -void -init_position(TaskManager *manager, int w, int h) -{ - SceneGraphPtr back; - SceneGraphPtr player; - SceneGraphPtr enemy; - //SceneGraphPtr bullet; - - sgroot->createFromXMLfile(manager, "xml_file/player.xml"); - back = sgroot->createSceneGraph(BACK); - //back = sgroot->createSceneGraph(); - player = sgroot->createSceneGraph(IDLE); - //bullet = sgroot->createSceneGraph(BULEBULLET); - - camera_init(back, w, h); - back->set_move_collision(camera_init, camera_collision); - player->set_move_collision(player_move_all, player_collision); - - - back->addChild(player); - - for (int i = 0; i < 10; i++) { - enemy = sgroot->createSceneGraph(E_PLANE); - enemy->set_move_collision(enemy_move, enemy_collision); - enemy->xyz[0] = 50.0*i; - back->addChild(enemy); - } - - sgroot->setSceneData(back); -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/long_cube.cc --- a/TaskManager/Test/test_render/long_cube.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -#include "SceneGraphRoot.h" -#include "SGList.h" - -// prototype -static void lcube_move(SceneGraphPtr node, int screen_w, int screen_h); -//static void lcube_collision(SceneGraphPtr node, int screen_w, int screen_h); - - -static void -lcube_move(SceneGraphPtr node, int screen_w, int screen_h) -{ -} - -static void -lcube_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree) -{ -} - - -void -lcube_init(TaskManager *manager, int screen_w, int screen_h) -{ - SceneGraphPtr lcube; - - sgroot->createFromXMLfile(manager, "xml_file/LongCube.xml"); - lcube = sgroot->createSceneGraph(LongCube); - lcube->set_move_collision(lcube_move, lcube_collision); - - sgroot->setSceneData(lcube); -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/node.cc --- a/TaskManager/Test/test_render/node.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -#include -#include "SceneGraphRoot.h" -#include "SceneGraph.h" -#include "xml_file/cube.h" - -static void -cube_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree) -{ -} - -static void -cube_move2(SceneGraphPtr node, int screen_w, int screen_h) -{ - node->angle[1] += 1.0f; - if (node->angle[1] > 360.0f) { - node->angle[1] = 0.0f; - } - - node->xyz[0] += node->stack_xyz[0]; - if ((int)node->xyz[0] > screen_w || (int)node->xyz[0] < 0) { - node->stack_xyz[0] = -node->stack_xyz[0]; - } - - node->xyz[1] += node->stack_xyz[1]; - if ((int)node->xyz[1] > screen_h || (int)node->xyz[1] < 0) { - node->stack_xyz[1] = -node->stack_xyz[1]; - } -} - -static void -cube_move(SceneGraphPtr node, int screen_w, int screen_h) -{ - node->angle[1] += 1.0f; - if (node->angle[1] > 360.0f) { - node->angle[1] = 0.0f; - } - - node->xyz[0] += node->stack_xyz[0]; - if ((int)node->xyz[0] > screen_w || (int)node->xyz[0] < 0) { - node->stack_xyz[0] = -node->stack_xyz[0]; - } - - node->xyz[1] += node->stack_xyz[1]; - if ((int)node->xyz[1] > screen_h || (int)node->xyz[1] < 0) { - - // 実は微妙に意味が無い - // そうじゃなくて、やっちゃいけないことです。 - // srandom(random()); - - SceneGraphPtr p = node->clone(); - p->position_init(); - node->addBrother(p); - p->set_move_collision(cube_move2, cube_collision); - p->stack_xyz[0] = (float)(random() % 5); - p->stack_xyz[1] = (float)(random() % 5); - //p->xyz[0] = screen_w/2; - //p->xyz[1] = screen_h/2; - p->xyz[2] = node->xyz[2]+1000.0f; - - node->stack_xyz[1] = -node->stack_xyz[1]; - } -} - -void -node_init(TaskManager *manager) -{ - sgroot->createFromXMLfile(manager, "xml_file/cube.xml"); - Cube->set_move_collision(cube_move, cube_collision); - Cube->stack_xyz[0] = 2.0f; - Cube->stack_xyz[1] = 2.0f; -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/panel.cc --- a/TaskManager/Test/test_render/panel.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -#include "SceneGraphRoot.h" -#include "SGList.h" - -static void panel_move(SceneGraphPtr node, int screen_w, int screen_h); -static void panel_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree); - -static void -panel_move(SceneGraphPtr node, int screen_w, int screen_h) -{ -} - -static void -panel_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree) -{ -} - -void -panel_init(TaskManager *manager, int bg) -{ - SceneGraphPtr panel; - - if (bg == 2) { - sgroot->createFromXMLfile(manager, "xml_file/panel_512.xml"); - panel = sgroot->createSceneGraph(PANEL_512); - } else if (bg == 3) { - sgroot->createFromXMLfile(manager, "xml_file/panel_1024.xml"); - panel = sgroot->createSceneGraph(PANEL_1024); - } else { - sgroot->createFromXMLfile(manager, "xml_file/panel_2048.xml"); - panel = sgroot->createSceneGraph(PANEL_2048); - } - - panel->set_move_collision(panel_move, panel_collision); - panel->xyz[2] = 30.0f; - sgroot->setSceneData(panel); -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/player_action.cc --- a/TaskManager/Test/test_render/player_action.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,146 +0,0 @@ -#include "SceneGraphRoot.h" -#include "bullet_action.h" -#include "SGList.h" - -#define MOVE_SPEED 5.00 - - -void -player_move_right(SceneGraphPtr node, int screen_w, int screen_h) -{ - if(node->xyz[0]xyz[0] += MOVE_SPEED; - } - if(node->angle[1]<=20) - { - node->angle[1]+=1.0; - } - if(node->angle[2]>=-45) - { - node->angle[2]-=1.0; - } -} - -void -player_move_left(SceneGraphPtr node, int screen_w, int screen_h) -{ - if(node->xyz[0]> -screen_w/2) - { - node->xyz[0] -= MOVE_SPEED; - } - if(node->angle[1]>=-20) - { - node->angle[1]-=1.0; - } - if(node->angle[2]<=45) - { - node->angle[2]+=1.0; - } -} - -void -player_move_up(SceneGraphPtr node, int screen_w, int screen_h) -{ - if(node->xyz[2]xyz[2] += MOVE_SPEED; - } - if(node->angle[0]<45) - { - node->angle[0] += 2.0; - } -} - -void -player_move_down(SceneGraphPtr node, int screen_w, int screen_h) -{ - if(node->xyz[2]> -screen_h/2) - { - node->xyz[2] -= MOVE_SPEED; - } - if(node->angle[0]>-45) - { - node->angle[0] -= 2.0; - } -} - -void -player_move_idle(SceneGraphPtr node) -{ - if (node->angle[1]>0) - { - node->angle[1]-=1.0; - } - else if(node->angle[1]<0) - { - node->angle[1]+=1.0; - } - - if(node->angle[2]<0) - { - node->angle[2]+=0.5; - } - else if(node->angle[2]>0) - { - node->angle[2]-=0.5; - } - - if(node->angle[0]<0) - { - node->angle[0]+=1.0; - } - else if(node->angle[0]>0) - { - node->angle[0]-=1.0; - } -} - -void -player_move_all(SceneGraphPtr node, int screen_w, int screen_h) -{ - Pad *pad = sgroot->getController(); - - if (pad->right.isHold() || pad->left.isHold() || - pad->up.isHold() || pad->down.isHold()) { - if (pad->right.isHold()) { - player_move_right(node, screen_w, screen_h); - } else if (pad->left.isHold()) { - player_move_left(node, screen_w, screen_h); - } - - if (pad->down.isHold()) { - player_move_up(node, screen_w, screen_h); - } else if(pad->up.isHold()) { - player_move_down(node, screen_w, screen_h); - } - } else { - player_move_idle(node); - } - - if (pad->r2.isHold()) { - node->xyz[2] -= 10.0f; - } - - if (pad->circle.isPush()) { - SceneGraphPtr bullet = sgroot->createSceneGraph(BULEBULLET); - bullet->set_move_collision(bluebullet_move, bullet_collision); - bullet_init(bullet, node); - node->addBrother(bullet); - } -} - -void -player_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree) -{ -#if 0 - int judge = square_judge(node, BULEBULLET, scene_graph); - - if (judge == HIT) - { - node->set_move_collision(player_move_all,player_collision); - } -#endif -} - diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/player_action.h --- a/TaskManager/Test/test_render/player_action.h Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -void player_move_right(SceneGraphPtr node, int screen_w, int screen_h); -void player_move_left(SceneGraphPtr node, int screen_w, int screen_h); -void player_move_up(SceneGraphPtr node, int screen_w, int screen_h); -void player_move_down(SceneGraphPtr node, int screen_w, int screen_h); -void player_move_idle(SceneGraphPtr node); -void player_move_all(SceneGraphPtr node, int screen_w, int screen_h); -void player_collision(SceneGraphPtr node, int screen_w, int screen_h ,SceneGraphPtr tree); diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/title.cc --- a/TaskManager/Test/test_render/title.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -#include "SceneGraphRoot.h" -#include "vacuum.h" -#include "SGList.h" - -void -title_collision(SceneGraphPtr node, int w, int h,SceneGraphPtr tree) -{ - - Pad *pad = sgroot->getController(); - - if(pad->start.isPush()) { - - SceneGraphPtr vacuum; - SceneGraphPtr back = sgroot->createSceneGraph(); - - vacuum = sgroot->createSceneGraph(BIGCUBE); - vacuum->xyz[0] = w/2; - vacuum->xyz[1] = h*0.8; - vacuum->set_move_collision(vacuum_move, vacuum_coll); - - back->addChild(vacuum); - - add_cubecollision_object(REDCUBE,vacuum,w,h); - - sgroot->setSceneData(back); - - } -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/universe.cc --- a/TaskManager/Test/test_render/universe.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -#include -#include "SceneGraphRoot.h" -#include "SGList.h" - -static void -earth_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree) -{ -} - -static void -moon_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree) -{ -} - -static void -moon_move(SceneGraphPtr node, int screen_w, int screen_h) -{ - node->angle[0] += 3.0f; -} - - -static void -earth_move(SceneGraphPtr node, int screen_w, int screen_h) -{ - node->angle[1] += 1.0f; - if (node->angle[1] > 360.0f) { - node->angle[1] = 0.0f; - } - - node->xyz[0] += node->stack_xyz[0]; - if ((int)node->xyz[0] > screen_w || (int)node->xyz[0] < 0) { - node->stack_xyz[0] = -node->stack_xyz[0]; - } - - node->xyz[1] += node->stack_xyz[1]; - if ((int)node->xyz[1] > screen_h || (int)node->xyz[1] < 0) { - node->stack_xyz[1] = -node->stack_xyz[1]; - } -} - -void -universe_init(TaskManager *manager) -{ - SceneGraphPtr earth; - SceneGraphPtr moon; - - sgroot->createFromXMLfile(manager, "xml_file/universe.xml"); - - // SGList.h にある SceneGraph ID から SceneGraph を生成する - earth = sgroot->createSceneGraph(Earth); - - // SceneGraph の move と collision を設定 - earth->set_move_collision(earth_move, earth_collision); - earth->stack_xyz[0] = 3.0f; - earth->stack_xyz[1] = 3.0f; - - moon = sgroot->createSceneGraph(Moon); - moon->set_move_collision(moon_move, moon_collision); - - // SceneGraph 同士の親子関係を設定 (今回は 親 earth、子 moon) - earth->addChild(moon); - - // SceneGraphRoot に、使用する SceneGraph を設定する - // このとき、ユーザーが記述した SceneGraph の root を渡す。 - sgroot->setSceneData(earth); -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/untitled.cc --- a/TaskManager/Test/test_render/untitled.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +0,0 @@ -#include -#include "SceneGraphRoot.h" -#include "SGList.h" -#include - -static void -cubetest_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree) -{ -} - -static void -test_collision(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree) -{ - // test -} - -static void -test_move(SceneGraphPtr node, int screen_w, int screen_h) -{ - - node->angle[0] += 10.0f; - /* - node->stack_xyz[0] = 2.0f; - node->stack_xyz[1] = 2.0f; - - //node->xyz[0] += node->stack_xyz[0]; - node->xyz[0] += node->stack_xyz[0]; - node->xyz[1] += node->stack_xyz[1]; - - if ((int)node->xyz[0] > screen_w - || (int)node->xyz[0] < 0) { - node->stack_xyz[0] = -node->stack_xyz[0]; - } - - if ((int)node->xyz[1] > screen_w - || (int)node->xyz[1] < 0) { - node->stack_xyz[1] = -node->stack_xyz[1]; - } - - if ((int)node->xyz[2] > 1000 - || (int)node->xyz[2] < 100) { - node->stack_xyz[1] = -node->stack_xyz[1]; - } - */ - -} - -static void -cubetest_move(SceneGraphPtr node, int screen_w, int screen_h) -{ - node->angle[1] += 10.0f; - if (node->angle[1] > 360.0f) { - node->angle[1] = 0.0f; - } - //node->xyz[0] = screen_w/2; - node->xyz[0] += node->stack_xyz[0]; - if ((int)node->xyz[0] > screen_w || (int)node->xyz[0] < 0) { - node->stack_xyz[0] = -node->stack_xyz[0]; - } - //node->xyz[1] = screen_h/2; - node->xyz[1] += node->stack_xyz[1]; - if ((int)node->xyz[1] > screen_h || (int)node->xyz[1] < 0) { - node->stack_xyz[1] = -node->stack_xyz[1]; - } - - node->xyz[2] = 1000; - //node->xyz[2] += node->stack_xyz[2]; - //if ((int)node->xyz[2] > screen_h || (int)node->xyz[2] < 100) { - //node->stack_xyz[2] = -node->stack_xyz[2]; - //} - -} - -void -untitled_init(TaskManager *manager) -{ - SceneGraphPtr test00; - SceneGraphPtr test01; - SceneGraphPtr test02; - SceneGraphPtr test03; - SceneGraphPtr test04; - SceneGraphPtr test05; - SceneGraphPtr test06; - SceneGraphPtr test07; - SceneGraphPtr test08; - SceneGraphPtr test09; - - sgroot->createFromXMLfile(manager, "xml_file/Venus.xml"); - - // SGList.h にある SceneGraph ID から SceneGraph を生成する - /* - test00 = sgroot->createSceneGraph(cubetest000); - test01 = sgroot->createSceneGraph(cubetest009); - test02 = sgroot->createSceneGraph(cubetest008); - test03 = sgroot->createSceneGraph(cubetest007); - test04 = sgroot->createSceneGraph(cubetest006); - test05 = sgroot->createSceneGraph(cubetest005); - test06 = sgroot->createSceneGraph(cubetest004); - test07 = sgroot->createSceneGraph(cubetest003); - test08 = sgroot->createSceneGraph(cubetest002); - test09 = sgroot->createSceneGraph(cubetest001); - */ - test00 = sgroot->createSceneGraph(Venus000); - test01 = sgroot->createSceneGraph(Venus009); - test02 = sgroot->createSceneGraph(Venus008); - test03 = sgroot->createSceneGraph(Venus007); - test04 = sgroot->createSceneGraph(Venus006); - test05 = sgroot->createSceneGraph(Venus005); - test06 = sgroot->createSceneGraph(Venus004); - test07 = sgroot->createSceneGraph(Venus003); - test08 = sgroot->createSceneGraph(Venus002); - test09 = sgroot->createSceneGraph(Venus001); - - // SceneGraph の move と collision を設定 - test00->set_move_collision(cubetest_move, cubetest_collision); - test00->stack_xyz[0] = 3.0f; - test00->stack_xyz[1] = 3.0f; - test00->stack_xyz[2] = 3.0f; - - - - test01->set_move_collision(test_move, test_collision); - test02->set_move_collision(test_move, test_collision); - test03->set_move_collision(test_move, test_collision); - test04->set_move_collision(test_move, test_collision); - test05->set_move_collision(test_move, test_collision); - test06->set_move_collision(test_move, test_collision); - test07->set_move_collision(test_move, test_collision); - test08->set_move_collision(test_move, test_collision); - test09->set_move_collision(test_move, test_collision); - - // SceneGraph 同士の親子関係を設定 (今回は 親 test00、子 その他) - test00->addChild(test01); - test00->addChild(test02); - test00->addChild(test03); - test00->addChild(test04); - test00->addChild(test05); - test00->addChild(test06); - test00->addChild(test07); - test00->addChild(test08); - test00->addChild(test09); - - // SceneGraphRoot に、使用する SceneGraph を設定する - // このとき、ユーザーが記述した SceneGraph の root を渡す。 - sgroot->setSceneData(test00); - -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/vacuum.cc --- a/TaskManager/Test/test_render/vacuum.cc Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,174 +0,0 @@ -#include -#include "vacuum.h" -#include "SceneGraphRoot.h" -#include "SGList.h" -#define ENCOUNT 55 -using namespace std; - -static float vacuum_speed = 10.0f; - - -/*オブジェクト毎にファイルを分けてみた - * - * - */ - - - -void -no_move_idle(SceneGraphPtr node, int screen_w, int screen_h) -{ - -} - -void -no_collision_idle(SceneGraphPtr node, int screen_w, int screen_h,SceneGraphPtr tree) -{ - -} - -void -vacuum_coll(SceneGraphPtr node, int screen_w, int screen_h, - SceneGraphPtr tree) -{ - Pad *pad = sgroot->getController(); - - if(node->frame%ENCOUNT == ENCOUNT-1) { - if(random()%2) { - add_cubecollision_object(REDCUBE,node,screen_w,screen_h); - } - else { - add_cubecollision_object(ENEMY,node,screen_w,screen_h); - } - } - - if (pad->cross.isHold()) { - SceneGraphIteratorPtr it = sgroot->getIterator(tree); - collision_red(it,node); - it = sgroot->getIterator(tree); - collision_purple(it,node,screen_w,screen_h); - } - - else if(pad->circle.isHold()) { - SceneGraphIteratorPtr it = sgroot->getIterator(tree); - lock_attack(node,it); - } - -} - -void -lock_attack(SceneGraphPtr node,SceneGraphIteratorPtr it) -{ - - SceneGraphPtr enemy; - SceneGraphPtr near_enemy = NULL; - float dx,dy,r,range = 100; - // Pad *pad = sgroot->getController(); - - for(;it->hasNext(ENEMY);) { - - it->next(ENEMY); - enemy = it->get(); - dx = enemy->xyz[0] - node->xyz[0]; - dy = enemy->xyz[1] - node->xyz[1]; - r = sqrt(dx*dx+dy*dy); - - if(range > r && enemy->stack_xyz[2] == 0) { - range = r; - near_enemy = enemy; - } - } - - - if(near_enemy != NULL) { - /*stack_xyz[2]をlockonフラグとして使うかな?*/ - SceneGraphPtr lockon; - // SceneGraphPtr near_enemy_common_move = near_enemy->parent; - near_enemy->stack_xyz[2] = 1; - lockon = sgroot->createSceneGraph(LOCK); - lockon->set_move_collision(no_move_idle,lockon_collision); - //near_enemy_common_move->addChild(lockon); - near_enemy->addChild(lockon); - } - -} - -void -lockon_collision(SceneGraphPtr node,int w,int h,SceneGraphPtr tree) { - - Pad *pad = sgroot->getController(); - SceneGraphPtr lockon_enemy = node->parent; - - /* node->angle[0] = -lockon_enemy->angle[0]; - node->angle[1] = -lockon_enemy->angle[1]; - node->angle[2] = -lockon_enemy->angle[2];*/ - - if(pad->circle.isRelease()) { - lockon_enemy->remove(); - } - -} - - -void -vacuum_move(SceneGraphPtr node , int w, int h) -{ - Pad *pad = sgroot->getController(); - - if (pad->right.isHold() && w > node->xyz[0]) { - node->xyz[0] += vacuum_speed; - node->angle[0] += 2; - } else if (pad->left.isHold() && 0 < node->xyz[0]) { - node->xyz[0] -= vacuum_speed; - node->angle[0] -= 2; - } - - if (pad->up.isHold() && 0 < node->xyz[1]) { - node->xyz[1] -= vacuum_speed; - node->angle[1] -= 2; - } else if (pad->down.isHold() && h > node->xyz[1]) { - node->xyz[1] += vacuum_speed; - node->angle[1] += 2; - } - - if (pad->start.isPush()) { - node->xyz[0] = w/2; - node->xyz[1] = h*0.8; - } -} - - - -/*cubeをランダムな場所に生成*/ -void -add_cubecollision_object(int id,SceneGraphPtr root,int w,int h) -{ - SceneGraphPtr object; - SceneGraphPtr common_move; - - common_move = sgroot->createSceneGraph(); - object = sgroot->createSceneGraph(id); - object->xyz[0] = random()%w; - object->xyz[1] = random()%h; - object->set_move_collision(no_move_idle,cube_collision); - //common_move->addChild(object); - root->addBrother(object); -} - - -void -vacuum_init2(TaskManager *manager, int w, int h) -{ - SceneGraphPtr title; - - sgroot->createFromXMLfile(manager, "xml_file/gamecube.xml"); - sgroot->createFromXMLfile(manager, "xml_file/title.xml"); - sgroot->createFromXMLfile(manager, "xml_file/gameover.xml"); - - title = sgroot->createSceneGraph(TITLE); - title->xyz[0] = w/2; - title->xyz[1] = h/2; - title->set_move_collision(no_move_idle, title_collision); - - sgroot->setSceneData(title); -} diff -r a18ded47c5dd -r d47c5d865970 TaskManager/Test/test_render/vacuum.h --- a/TaskManager/Test/test_render/vacuum.h Wed Sep 23 12:23:01 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -#ifndef VACUUM_H -#define VACUUM_H - -#include "SGList.h" -#include "SceneGraphRoot.h" - -void cube_move_left(SceneGraphPtr node, int screen_w, int screen_h); -void cube_move_right(SceneGraphPtr node, int screen_w, int screen_h); -void no_move_idle(SceneGraphPtr node, int screen_w, int screen_h); -void cube_collision_idle(SceneGraphPtr node, int screen_w, int screen_h,SceneGraphPtr tree); -void cube_collision(SceneGraphPtr node, int screen_w, int screen_h,SceneGraphPtr tree); -void cube_split(SceneGraphPtr root,SceneGraphPtr tree); -void vacuum_move(SceneGraphPtr node, int w, int h); -void vacuum_coll(SceneGraphPtr node, int w, int h,SceneGraphPtr tree); -void title_idle(SceneGraphPtr node, int screen_w, int screen_h); -void title_collision(SceneGraphPtr node, int screen_w, int screen_h,SceneGraphPtr tree); -void scene_change(int w,int h,SceneGraphPtr node); -void gameover_idle(SceneGraphPtr node, int screen_w, int screen_h); -void gameover_collision(SceneGraphPtr node, int screen_w, int screen_h,SceneGraphPtr tree); -void collision_red(SceneGraphIteratorPtr it,SceneGraphPtr node); -void collision_purple(SceneGraphIteratorPtr it,SceneGraphPtr node,int w,int h); -void gameover_scene(int w,int h, SceneGraphPtr node); -void add_cubecollision_object(int id,SceneGraphPtr root,int w,int h); -void lock_attack(SceneGraphPtr node,SceneGraphIteratorPtr it); -void lockon_collision(SceneGraphPtr node,int w,int h,SceneGraphPtr tree); -void cube_rotate(SceneGraphPtr node,int w,int h); - -#endif