changeset 4:e089ac9ea221

greenclab add. not complete...
author tkaito
date Sun, 06 Jun 2010 06:47:45 +0900
parents dca6d5d2ef46
children 57af5c610b34
files Makefile.macosx blender/enemy_greenclab.blend blender/enemy_greenclab.blend1 dandy.cc game_scene01.cc game_scene01.h greenclab.cc xml/enemy_greenclab.h xml/enemy_greenclab.xml
diffstat 9 files changed, 53 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.macosx	Sun Jun 06 05:23:51 2010 +0900
+++ b/Makefile.macosx	Sun Jun 06 06:47:45 2010 +0900
@@ -20,7 +20,7 @@
 viewer : $(VIEWER_OBJ) 
 	$(CC) -o $@ $?    $(LIBS)
 
-DANDY_OBJ = dandy.o title.o game_over.o mydandy.o game_scene01.o 
+DANDY_OBJ = dandy.o title.o game_over.o mydandy.o game_scene01.o greenclab.o
 dandy : $(DANDY_OBJ) 
 	$(CC) -o $@ $?    $(LIBS)
 
Binary file blender/enemy_greenclab.blend has changed
Binary file blender/enemy_greenclab.blend1 has changed
--- a/dandy.cc	Sun Jun 06 05:23:51 2010 +0900
+++ b/dandy.cc	Sun Jun 06 06:47:45 2010 +0900
@@ -2,13 +2,6 @@
 #include "SceneGraphRoot.h"
 #include "dandy.h"
 
-
-void
-dandy_move_idle(SceneGraphPtr node, int w, int h)
-{
-
-}
-
 void
 title_idle(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h)
 {
@@ -20,9 +13,11 @@
 {
   SceneGraphPtr back, title;
 
-  sgroot->createFromXMLfile( "xml/mydandy.xml");
-  sgroot->createFromXMLfile( "xml/title2.xml");
-  sgroot->createFromXMLfile( "xml/gameover.xml");
+  sgroot->createFromXMLfile("xml/mydandy.xml");
+  sgroot->createFromXMLfile("xml/title2.xml");
+  sgroot->createFromXMLfile("xml/gameover.xml");
+  sgroot->createFromXMLfile("xml/enemy_greenclab.xml");
+
   
   back  = sgroot->createSceneGraph();
   title = sgroot->createSceneGraph("title001");
--- a/game_scene01.cc	Sun Jun 06 05:23:51 2010 +0900
+++ b/game_scene01.cc	Sun Jun 06 06:47:45 2010 +0900
@@ -4,27 +4,45 @@
 create_object(void *sgroot_, int w, int h) 
 {
   SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_;
-  SceneGraphPtr dandy, rdandy, rtdandy, ldandy, ltdandy;
   //SceneGraphPtr tmp[5] = {ldandy, ltdandy, dandy, rtdandy, rtdandy};
   //dandys = tmp;
 
   SceneGraphPtr back = sgroot->createSceneGraph(); 
-  
+
+  /* 自機 */
+  SceneGraphPtr dandy, rdandy, rtdandy, ldandy, ltdandy;
   dandy   = sgroot->createSceneGraph("mydandy");
   ldandy  = sgroot->createSceneGraph("l-dandy");
   ltdandy = sgroot->createSceneGraph("lt-dandy");
   rdandy  = sgroot->createSceneGraph("r-dandy");
   rtdandy = sgroot->createSceneGraph("rt-dandy");
 
-  dandy->xyz[0]   = w/2;
-  dandy->xyz[1]   = h*0.9;
+  dandy->xyz[0] = w/2;
+  dandy->xyz[1] = h*0.9;
 
   dandy->set_move_collision(dandy_move, dandy_collision);
-  //ldandy->set_move_collision(dandy_move, dandy_collision);
+  ldandy->set_move_collision(dandy_move, dandy_collision);
   ltdandy->set_move_collision(dandy_move, dandy_collision);
   rdandy->set_move_collision(dandy_move, dandy_collision);
   rtdandy->set_move_collision(dandy_move, dandy_collision);
+
+  /* 敵機 */
+  SceneGraphPtr gclab;
+  gclab = sgroot->createSceneGraph("green_clab");
+
+  gclab->xyz[0] = w/2;
+  gclab->xyz[1] = h/2;
   
-  back->addChild(dandy);  
+  gclab->set_move_collision(gclab_move, gclab_collision);
+
+  //stage_plan();
+
+  back->addChild(dandy);
+  back->addChild(gclab);
   sgroot->setSceneData(back);
 }
+
+void
+stage_plan() {
+  //TODO : stageの設計。stageも幾つかに分けるべき?
+}
--- a/game_scene01.h	Sun Jun 06 05:23:51 2010 +0900
+++ b/game_scene01.h	Sun Jun 06 06:47:45 2010 +0900
@@ -3,3 +3,8 @@
 
 void dandy_move(SceneGraphPtr node, void *sgroot_, int w, int h);
 void dandy_collision(SceneGraphPtr node, void *sgroot_, int w, int h,SceneGraphPtr tree);
+
+void gclab_move(SceneGraphPtr node, void *sgroot_, int w, int h);
+void gclab_collision(SceneGraphPtr node, void *sgroot_, int w, int h,SceneGraphPtr tree);
+
+
--- a/greenclab.cc	Sun Jun 06 05:23:51 2010 +0900
+++ b/greenclab.cc	Sun Jun 06 06:47:45 2010 +0900
@@ -1,47 +1,23 @@
-#include <math.h>
-#include "SceneGraphRoot.h"
-#include "SGList.h"
+#include "game_scene01.h"
+
+void 
+gclab_move(SceneGraphPtr node, void *sgroot_, int w, int h)
+{
 
-static void greenclab_move(SceneGraphPtr node, int screen_w, int screen_h);
-static void greenclab_move_idle(SceneGraphPtr node, int screen_w, int screen_h);
-static void greenclab_collision(SceneGraphPtr node, int screen_w, int screen_h,
-			   SceneGraphPtr tree);
-void create_greenclab(TaskManager *manager, int number);
+/*
+  if (w > node->xyz[0]) {
+  } else if (0 < node->xyz[0]) {
+  }
+  if (0 < node->xyz[1]) {
+  } else if (h > node->xyz[1]) {
+  }
+*/
+}
 
-static void 
-greenclab_move(SceneGraphPtr node, int w, int h)
+void 
+gclab_collision(SceneGraphPtr node, void *sgroot_, int w, int h, SceneGraphPtr tree)
 {
 
 }
 
-static void 
-greenclab_move_idle(SceneGraphPtr node, int w, int h)
-{
-  node->xyz[1] += 2.0f;
-  node->xyz[2] = 0.0f;
-}
 
-static void 
-greenclab_collision(SceneGraphPtr node, int w, int h, SceneGraphPtr tree)
-{
-
-}
-
-void 
-create_greenclab(TaskManager *manager, int w, int h)
-{
-  SceneGraphPtr greenclab;
-  SceneGraphPtr back;
-
-  sgroot->createFromXMLfile(manager, "xml/enemy_greenclab.xml");
-
-  back = sgroot->createSceneGraph();
-  greenclab = sgroot->createSceneGraph(greenclab);
-  greenclab->xyz[0] = w/2;
-  greenclab->xyz[1] = 0.0f;
-  greenclab->set_move_collision(greenclab_move_idle, greenclab_collision);
-
-  back->addChild(greenclab);
-
-  sgroot->setSceneData(back);
-}
--- a/xml/enemy_greenclab.h	Sun Jun 06 05:23:51 2010 +0900
+++ b/xml/enemy_greenclab.h	Sun Jun 06 06:47:45 2010 +0900
@@ -1,1 +1,1 @@
-#define greenclab scene_graph
+#define green_clab scene_graph
--- a/xml/enemy_greenclab.xml	Sun Jun 06 05:23:51 2010 +0900
+++ b/xml/enemy_greenclab.xml	Sun Jun 06 06:47:45 2010 +0900
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <OBJECT-3D>
-	<surface name="greenclab" size="6" prim="Triangle" parent="NULL">
+	<surface name="green_clab" size="6" prim="Triangle" parent="NULL">
 		<coordinate>
 			30.113185 30.098001 0.000000
 			-30.052460 30.098014 0.000000