changeset 3:dca6d5d2ef46

stage 1 add
author tkaito
date Sun, 06 Jun 2010 05:23:51 +0900
parents 69b4108bf4e8
children e089ac9ea221
files Makefile.macosx dandy.h game_scene01.cc game_scene01.h mydandy.cc viewer.cc
diffstat 6 files changed, 46 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.macosx	Sun Jun 06 03:22:11 2010 +0900
+++ b/Makefile.macosx	Sun Jun 06 05:23:51 2010 +0900
@@ -20,7 +20,7 @@
 viewer : $(VIEWER_OBJ) 
 	$(CC) -o $@ $?    $(LIBS)
 
-DANDY_OBJ = dandy.o title.o game_over.o mydandy.o
+DANDY_OBJ = dandy.o title.o game_over.o mydandy.o game_scene01.o 
 dandy : $(DANDY_OBJ) 
 	$(CC) -o $@ $?    $(LIBS)
 
--- a/dandy.h	Sun Jun 06 03:22:11 2010 +0900
+++ b/dandy.h	Sun Jun 06 05:23:51 2010 +0900
@@ -4,7 +4,6 @@
 #include "Application.h"
 #include "MainLoop.h"
 
-
 class dandy : public Application {
 
   MainLoopPtr init(Viewer *viewer, int screen_w, int screen_h);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/game_scene01.cc	Sun Jun 06 05:23:51 2010 +0900
@@ -0,0 +1,30 @@
+#include "game_scene01.h"
+
+void
+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(); 
+  
+  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->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);
+  
+  back->addChild(dandy);  
+  sgroot->setSceneData(back);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/game_scene01.h	Sun Jun 06 05:23:51 2010 +0900
@@ -0,0 +1,5 @@
+#include "SceneGraphRoot.h"
+#include "dandy.h"
+
+void dandy_move(SceneGraphPtr node, void *sgroot_, int w, int h);
+void dandy_collision(SceneGraphPtr node, void *sgroot_, int w, int h,SceneGraphPtr tree);
--- a/mydandy.cc	Sun Jun 06 03:22:11 2010 +0900
+++ b/mydandy.cc	Sun Jun 06 05:23:51 2010 +0900
@@ -1,7 +1,4 @@
-#include "SceneGraphRoot.h"
-#include "dandy.h"
-
-SceneGraphPtr *dandys;
+#include "game_scene01.h"
 
 void def_angle(SceneGraphPtr node, void *sgroot_, int w, int h);
 void left_angle(SceneGraphPtr node, void *sgroot_, int w, int h);
@@ -38,6 +35,7 @@
   } else if (pad->down.isHold() && h > node->xyz[1]) {
     node->xyz[1] += 10.0f;
   }
+
 }
 
 void
@@ -47,34 +45,6 @@
 }
 
 /* 時機や敵機のオブジェクトや何やらを作成してsetSceneDataまで */
-void
-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(); 
-  
-  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->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);
-  
-  back->addChild(dandy);  
-  sgroot->setSceneData(back);
-}
 
 void
 def_angle(SceneGraphPtr node, void *sgroot_, int w, int h) 
--- a/viewer.cc	Sun Jun 06 03:22:11 2010 +0900
+++ b/viewer.cc	Sun Jun 06 05:23:51 2010 +0900
@@ -12,20 +12,17 @@
 static void object_move_translation(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h);
 
 
-char *light_sysswitch = "off";
+int light_sysswitch = 1;
 int light_num = 4;
 
 void LightSysSwitch(Viewer *sgroot) {
-  if (strcmp(light_sysswitch,"on") == 0) {
+  if (light_sysswitch == 1) {
     sgroot->OnLightSysSwitch();
-  } else if (strcmp(light_sysswitch,"off") == 0) {
+  } else if (light_sysswitch == 0) {
     sgroot->OffLightSysSwitch();
   }
 }
 
-
-
-
 static void
 object_move_rotation(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h)
 {
@@ -159,7 +156,11 @@
         } else if (strcmp(argv[i],"-name") == 0 && i+1<=argc) {
            parts[parts_cnt++] = argv[i+1];
         } else if (strcmp(argv[i],"-lightsys") == 0 && i+1<=argc) {
-	  light_sysswitch = argv[i+1];
+	  if (strcmp(argv[i],"on") == 0) {
+	    light_sysswitch = 1;
+	  } else if (strcmp(argv[i],"off") == 0) {
+	    light_sysswitch = 0;
+	  }
 	} else if (strcmp(argv[i],"-lightnum") == 0 && i+1<=argc) {
 	  light_num = atoi(argv[i+1]);
 	}