changeset 23:3fb8a6a34e24

debug and keep up with task_array
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Tue, 26 Oct 2010 17:28:56 +0900
parents 958a55ce0d98
children a131729d6e4d 6bea374ee604
files Makefile.def dandy.h main.cc ppe/TitleMove.cc stage_init.cc
diffstat 5 files changed, 55 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.def	Mon Oct 18 02:55:17 2010 +0900
+++ b/Makefile.def	Tue Oct 26 17:28:56 2010 +0900
@@ -5,7 +5,7 @@
 CERIUM = ../Cerium
 
 CC      = g++
-OPT = -g
+OPT = -g #-O9
 CFLAGS  =  -Wall $(OPT) 
 
 ABIBIT = 32
--- a/dandy.h	Mon Oct 18 02:55:17 2010 +0900
+++ b/dandy.h	Tue Oct 26 17:28:56 2010 +0900
@@ -32,8 +32,15 @@
 extern ObjProperty back_property;
 extern ObjPropertyPtr charactor;
 
+//キャラクターの総数
 static const int ENEMY_NUM = 2;
 
+//TaskArray 生成に必要な各値
+static const int TASK_NUM = 2;
+static const int PARAMETER = 0;
+static const int INDATA_NUM = 2;
+static const int OUTDATA_NUM = 1;
+
 extern void create_title_back(Viewer *sgroot, int w, int h);
 extern void create_stage(void *sgroot, int w, int h);
 extern void schedule(SceneGraphPtr node, void *sgroot_, int w, int h);
@@ -47,7 +54,6 @@
   
 } state;
 
-
 //const state enemystate[50];
 
 #define ENEMY_STATUS_TABLE {\
--- a/main.cc	Mon Oct 18 02:55:17 2010 +0900
+++ b/main.cc	Tue Oct 26 17:28:56 2010 +0900
@@ -1,8 +1,12 @@
 #include "dandy.h"
 
+#define ENEMY_STATUS(charano,score,hardness) {charano,score,hardness}
+const state status[50] = ENEMY_STATUS_TABLE;
+
 extern void task_init(void);
 
 TaskManager *manager;
+ObjPropertyPtr charactor;
 
 const char *usr_help_str = "Usage: ./twice [-length data_length] [-count task_num]\n\
   -length  Number of data (default DATA_NUM (Func.h))\n\
@@ -13,44 +17,40 @@
 {
     for (int i = 1; argv[i]; ++i) {
         if (strcmp(argv[i], "-length") == 0) {
-	  //length = atoi(argv[++i]);
+	    //length = atoi(argv[++i]);
         } else if (strcmp(argv[i], "-count") == 0) {
-	  //task = atoi(argv[++i]);
+	    //task = atoi(argv[++i]);
         }
     }
 
     return 0;
 }
 
-#define ENEMY_STATUS(charano,score,hardness) {charano,score,hardness}
-const state status[50] = ENEMY_STATUS_TABLE;
-
 void
 init_charactor(Viewer *sgroot, int w, int h)
 {
-  sgroot->createFromXMLfile("xml/mydandy.xml");
-  sgroot->createFromXMLfile("xml/gameover.xml");
-  sgroot->createFromXMLfile("xml/greencrab.xml");
-  sgroot->createFromXMLfile("xml/bluebullet.xml");
-  sgroot->createFromXMLfile("xml/redbullet.xml");
-  sgroot->createFromXMLfile("xml/title2.xml");
+    sgroot->createFromXMLfile("xml/mydandy.xml");
+    sgroot->createFromXMLfile("xml/greencrab.xml");
+    sgroot->createFromXMLfile("xml/gameover.xml");
+    sgroot->createFromXMLfile("xml/greencrab.xml");
+    sgroot->createFromXMLfile("xml/bluebullet.xml");
+    sgroot->createFromXMLfile("xml/redbullet.xml");
+    sgroot->createFromXMLfile("xml/title2.xml");
 
-  for (int i = 0; i < ENEMY_NUM; i++) {
-    charactor[i].root  = (void*)sgroot->createSceneGraph(status[i].charano);
-    charactor[i].score = status[i].score;
-    charactor[i].vital = status[i].vital;
-   }
-  create_title_back(sgroot, w, h);
+    for (int i = 0; i < ENEMY_NUM; i++) {
+	charactor[i].root  = (void*)sgroot->createSceneGraph(status[i].charano);
+	charactor[i].score = status[i].score;
+	charactor[i].vital = status[i].vital;
+    }
+    create_title_back(sgroot, w, h);
 }
 
-ObjPropertyPtr charactor;
-
 MainLoopPtr
 Dandy::init(Viewer *sgroot, int w, int h)
 {
-  charactor = (ObjPropertyPtr)sgroot->manager->allocate(sizeof(ObjProperty)*ENEMY_NUM);
-  init_charactor(sgroot, w, h);
-  return sgroot;
+    charactor = (ObjPropertyPtr)sgroot->manager->allocate(sizeof(ObjProperty)*ENEMY_NUM);
+    init_charactor(sgroot, w, h);
+    return sgroot;
 }
 
 extern Application *
@@ -65,18 +65,18 @@
 int
 TMmain(TaskManager *manager,int argc, char *argv[])
 {
-  /*  
-    if (init(argc, argv) < 0) {
+    /*  
+	if (init(argc, argv) < 0) {
 	return -1;
-    }
-  */
+	}
+    */
     // Task Register
     //   ppe/task_init.cc
     task_init();
     /*
-    for (int i = 0; i < task; ++i) {
-	twice_init(manager);
-    }
+      for (int i = 0; i < task; ++i) {
+      twice_init(manager);
+      }
     */
     //create_title(sgroot, w, h);
     task_initialize();
--- a/ppe/TitleMove.cc	Mon Oct 18 02:55:17 2010 +0900
+++ b/ppe/TitleMove.cc	Tue Oct 26 17:28:56 2010 +0900
@@ -21,7 +21,7 @@
     i_obj->flag = 1;
   }
 
-  o_obj->flag = i_obj->flag;
+  o_obj = i_obj;
 
   return 0;
 }
--- a/stage_init.cc	Mon Oct 18 02:55:17 2010 +0900
+++ b/stage_init.cc	Tue Oct 26 17:28:56 2010 +0900
@@ -4,10 +4,10 @@
 create_crab(SchedTask *s, void *charactor_, void *b)
 {
     ObjPropertyPtr charactor = (ObjPropertyPtr)charactor_;
-    SceneGraphPtr crab = (SceneGraphPtr)charactor[1].root;
+    SceneGraphPtr crab = (SceneGraphPtr)charactor->root;
 
-    crab->xyz[0] = charactor[1].x;
-    crab->xyz[1] = charactor[1].y;
+    crab->xyz[0] = charactor->x;
+    crab->xyz[1] = charactor->y;
 }
 
 void
@@ -26,38 +26,39 @@
 create_title_back(Viewer *sgroot_, int w, int h) 
 { 
     Viewer *sgroot = sgroot_;
-    SceneGraphPtr back;
-    back = sgroot->createSceneGraph();
+    SceneGraphPtr root = sgroot->createSceneGraph();
 
     SceneGraphPtr title = (SceneGraphPtr)charactor[0].root;
     charactor[0].x = w/2;
     charactor[0].y = h/2;
-    charactor[0].vx = 1.0;
-    charactor[0].vy = 1.0;
+    charactor[0].vx = 0.0;
+    charactor[0].vy = 0.0;
     charactor[0].flag = 0;
-    charactor[0].parent = (void*)back;
+    charactor[0].parent = (void*)root;
     
     title->xyz[0] = charactor[0].x;
     title->xyz[1] = charactor[0].y;
 
     SceneGraphPtr crab = (SceneGraphPtr)charactor[1].root;
-    charactor[1].x = 0.0;
-    charactor[1].y = 0.0;
+    charactor[1].x = w/2;
+    charactor[1].y = h/2;
     charactor[1].vx = 1.0;
     charactor[1].vy = 1.0;
     charactor[1].flag = 0;
-    charactor[1].parent = (void*)back;
+    charactor[1].parent = (void*)root;
     
     crab->xyz[0] = charactor[1].x;
     crab->xyz[1] = charactor[1].y;
-    
-    back->addChild(title);
-    //    back->addChild(crab);
-    sgroot->setSceneData(back);
+    crab->flag_drawable = 0;
 
     int size = sizeof(ObjProperty);
-    //    sgroot->set_pad_task(crab, CRAB_MOVE, (void*)&charactor[1], size, create_crab);
+    sgroot->task_array_init(TITLE_MOVE, TASK_NUM, PARAMETER, INDATA_NUM, OUTDATA_NUM);
     sgroot->set_pad_task(title, TITLE_MOVE, (void*)&charactor[0], size, create_title);
+    sgroot->set_pad_task(crab, CRAB_MOVE, (void*)&charactor[1], size, create_crab);
+    
+    root->addChild(title);
+    root->addChild(crab);
+    sgroot->setSceneData(root);
 }