changeset 4:ccc811ee5f55

property add.
author tkaito
date Mon, 21 Jun 2010 03:23:55 +0900
parents 7b4c2cfeba45
children bcbcee3c6729
files Makefile.macosx dandy.h main.cc ppe/TitleMove.cc ppe/TitleMove.h stage_init.cc title.cc
diffstat 7 files changed, 46 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.macosx	Thu Jun 17 06:31:01 2010 +0900
+++ b/Makefile.macosx	Mon Jun 21 03:23:55 2010 +0900
@@ -11,7 +11,7 @@
 TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP))
 TASK_OBJS = $(TASK_SRCS:.cc=.o)
 
-CFLAGS += `sdl-config --cflags` `xml2-config --cflags`
+CFLAGS += `sdl-config --cflags` `xml2-config --cflags` 
 LIBS += -lCerium -lFifoManager
 LIBS += `sdl-config --libs` `xml2-config --libs` -lSDL_image -Wl,-framework,OpenGL 
 CC += -m$(ABIBIT)
--- a/dandy.h	Thu Jun 17 06:31:01 2010 +0900
+++ b/dandy.h	Mon Jun 21 03:23:55 2010 +0900
@@ -29,7 +29,6 @@
 } *ObjPropertyPtr, ObjProperty;
 
 static const int ENEMY_NUM = 1;
-extern ObjPropertyPtr charactor;
 
 static const float player_speed = 10.0f;
 static const float player_radius = 42.0f;
@@ -47,8 +46,8 @@
 extern void title_coll(SceneGraphPtr node, void *sgroot_, int w, int h, SceneGraphPtr tree);
 extern void dandy_move(SceneGraphPtr node, void *sgroot_, int w, int h);
 extern void dandy_coll(SceneGraphPtr node, void *sgroot_, int w, int h,SceneGraphPtr tree);
-extern void create_title(void *sgroot, int w, int h);
-extern void create_stage(void *sgroot, int w, int h);
+extern void create_title(void *sgroot, int w, int h, ObjPropertyPtr charactor);
+extern void create_stage(void *sgroot, int w, int h, ObjPropertyPtr charactor);
 
 typedef struct enemy_state {
   const char *charano;
--- a/main.cc	Thu Jun 17 06:31:01 2010 +0900
+++ b/main.cc	Mon Jun 21 03:23:55 2010 +0900
@@ -3,7 +3,7 @@
 extern void task_init(void);
 
 TaskManager *manager;
-ObjPropertyPtr charactor = (ObjPropertyPtr)manager->allocate(sizeof(ObjPropertyPtr)*ENEMY_NUM);
+
 
 static int length = DATA_NUM;
 static int task = 1;
@@ -81,7 +81,7 @@
 //ObjPropertyPtr charactor = (ObjPropertyPtr)manager->allocate(sizeof(ObjPropertyPtr)*ENEMY_NUM);
 
 void
-init_charactor(Viewer *sgroot)
+init_charactor(Viewer *sgroot, ObjPropertyPtr charactor)
 {
   sgroot->createFromXMLfile("xml/mydandy.xml");
   sgroot->createFromXMLfile("xml/gameover.xml");
@@ -91,26 +91,23 @@
   sgroot->createFromXMLfile("xml/title2.xml");  
 
   for (int i = 0; i < ENEMY_NUM; i++) {
-    charactor[1].root  = (void*)sgroot->createSceneGraph(status[1].charano);
-    charactor[1].score = status[1].score;
-    charactor[1].vital = status[1].vital;
-  }
+    charactor[0].root  = (void*)sgroot->createSceneGraph(status[1].charano);
+    charactor[0].score = status[1].score;
+    charactor[0].vital = status[1].vital;
+   }
 
 }
 
 MainLoopPtr
 dandy::init(Viewer *sgroot, int w, int h)
 {
-  init_charactor(sgroot);
-  create_title(sgroot, w, h);
+  ObjPropertyPtr charactor = (ObjPropertyPtr)sgroot->manager->allocate(sizeof(ObjPropertyPtr)*16);
+  init_charactor(sgroot, charactor);
+  create_title(sgroot, w, h, charactor);
+
   return sgroot;
 }
 
-void
-property_init(TaskManager *manager)
-{
-
-}
 
 extern Application *
 application() {
@@ -136,7 +133,6 @@
 	twice_init(manager);
     }
     */
-    property_init(manager);
     //create_title(sgroot, w, h);
     task_initialize();
     manager->set_TMend(TMend);
--- a/ppe/TitleMove.cc	Thu Jun 17 06:31:01 2010 +0900
+++ b/ppe/TitleMove.cc	Mon Jun 21 03:23:55 2010 +0900
@@ -9,13 +9,16 @@
 static int
 run(SchedTask *s,void *rbuf, void *wbuf)
 {
-  /*
-    SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_;
-    Pad *pad = sgroot->getController();
+  ObjPropertyPtr i_obj;
+  ObjPropertyPtr o_obj;
+
+  i_obj = (ObjPropertyPtr)s->get_input(rbuf, 0);
+  o_obj = (ObjPropertyPtr)s->get_output(wbuf, 0);
   
-    if(pad->start.isPush()) {
-      create_stage(sgroot, w, h);
-    }
-  */
+  o_obj[0] = i_obj[0];
+
+  //printf("x = %f\n", i_obj[0].x);
+  //printf("y = %f\n", i_obj[0].y);
+
   return 0;
 }
--- a/ppe/TitleMove.h	Thu Jun 17 06:31:01 2010 +0900
+++ b/ppe/TitleMove.h	Mon Jun 21 03:23:55 2010 +0900
@@ -16,6 +16,7 @@
 typedef struct {
   double x, y;
   double vx, vy;
+  int frame;
   const char *chara;
   int vital;
   int score;
--- a/stage_init.cc	Thu Jun 17 06:31:01 2010 +0900
+++ b/stage_init.cc	Mon Jun 21 03:23:55 2010 +0900
@@ -6,44 +6,46 @@
 void
 createSceneGraphFromProperty(SchedTask *s, void *charactor_, void *b)
 {
-  ObjPropertyPtr charactor1 = (ObjPropertyPtr)charactor; 
-  printf("charactor.x = %f\n", charactor1[0].x);
-}
+  ObjPropertyPtr charactor1 = (ObjPropertyPtr)charactor_; 
+  
 
 
+  //printf("charactor.x = %d\n", charactor1[0].frame);
+
+}
+
 void
-create_title(void *sgroot_, int w, int h) 
+create_title(void *sgroot_, int w, int h, ObjPropertyPtr charactor) 
 {
-  TaskManager *manager;
   Viewer *sgroot = (Viewer *)sgroot_;
   SceneGraphPtr back1; //title;
 
   back1  = sgroot->createSceneGraph();
   //back->set_move_collision(back_move, back_coll);
   sgroot->setSceneData(back1);
-
   /* createPropertyFromSceneGraph */
-  charactor[0].x  = back1->xyz[0];
-  charactor[0].y  = back1->xyz[1];
+  //charactor[0].x  = back1->xyz[0];
+  charactor[0].x  = w/2;
+  //charactor[0].y  = back1->xyz[1];
+  charactor[0].y  = h/2;
   charactor[0].vx = back1->stack_xyz[0];
   charactor[0].vy = back1->stack_xyz[1];
   charactor[0].frame = back1->frame;
-
-  /* set_game_task */
+  charactor[0].root = (void*)back1;
+  charactor[0].frame = 4;
+  
+  /* set_game_task(int id, ObjProperty property, int size, PostFunction post_func) */
   HTask *back;
-  back = manager->create_task(TITLE_MOVE);
+
+  back = sgroot->manager->create_task(TITLE_MOVE);
   back->set_cpu(SPE_ANY);
-  back->add_inData((char*)charactor, sizeof(ObjProperty));
-  back->add_outData(charactor, sizeof(ObjProperty));
+  back->add_inData(charactor, sizeof(ObjPropertyPtr)*16);
+  back->add_outData(charactor, sizeof(ObjPropertyPtr)*16);
   back->add_param((memaddr)1);
   back->set_post(createSceneGraphFromProperty, (void*)charactor, 0);
-  //back->set_post(test, (void*)charactor, 0);
   back->spawn();
 }
 
-  //createSceneGraphFromProperty(ObjProperty charactor);
-
-
   //title = sgroot->createSceneGraph("title001");
   //title->xyz[0] = w/2;
   //title->xyz[1] = h/2;
@@ -56,7 +58,7 @@
 
 
 void
-create_stage(void *sgroot_, int w, int h) 
+create_stage(void *sgroot_, int w, int h, ObjPropertyPtr charactor) 
 {
   SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_;
 
--- a/title.cc	Thu Jun 17 06:31:01 2010 +0900
+++ b/title.cc	Mon Jun 21 03:23:55 2010 +0900
@@ -1,13 +1,13 @@
 #include "dandy.h"
 
 void
-title_move(SceneGraphPtr node, void *sgroot_, int w, int h)
+title_move(SceneGraphPtr node, void *sgroot_, int w, int h, ObjPropertyPtr charactor)
 {
   SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_;
   Pad *pad = sgroot->getController();
   
   if(pad->start.isPush()) {
-    create_stage(sgroot, w, h);
+    create_stage(sgroot, w, h, charactor);
   }
 }