changeset 3:7b4c2cfeba45

task not move 2%
author tkaito
date Thu, 17 Jun 2010 06:31:01 +0900
parents 6e1afe1016dc
children ccc811ee5f55
files dandy.h main.cc stage_init.cc
diffstat 3 files changed, 65 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/dandy.h	Thu Jun 17 05:11:29 2010 +0900
+++ b/dandy.h	Thu Jun 17 06:31:01 2010 +0900
@@ -1,8 +1,13 @@
 #include <math.h>
 #include <stdlib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "TaskManager.h"
 #include "SceneGraph.h"
 #include "Application.h"
 #include "MainLoop.h"
+#include "Func.h"
 
 class dandy : public Application {
   MainLoopPtr init(Viewer *viewer, int w, int h);
@@ -14,6 +19,7 @@
 typedef struct {
   double x, y;
   double vx, vy;
+  int frame;
   const char *chara;
   int vital;
   int score;
@@ -23,7 +29,7 @@
 } *ObjPropertyPtr, ObjProperty;
 
 static const int ENEMY_NUM = 1;
-extern ObjProperty charactor[ENEMY_NUM];
+extern ObjPropertyPtr charactor;
 
 static const float player_speed = 10.0f;
 static const float player_radius = 42.0f;
--- a/main.cc	Thu Jun 17 05:11:29 2010 +0900
+++ b/main.cc	Thu Jun 17 06:31:01 2010 +0900
@@ -1,12 +1,10 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "TaskManager.h"
-#include "Func.h"
 #include "dandy.h"
 
 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;
 
@@ -79,7 +77,8 @@
 #define ENEMY_STATUS(charano,score,hardness) {charano,score,hardness}
 const state status[] = ENEMY_STATUS_TABLE;
 
-ObjProperty charactor[ENEMY_NUM];
+//ObjProperty charactor[ENEMY_NUM]
+//ObjPropertyPtr charactor = (ObjPropertyPtr)manager->allocate(sizeof(ObjPropertyPtr)*ENEMY_NUM);
 
 void
 init_charactor(Viewer *sgroot)
@@ -107,6 +106,12 @@
   return sgroot;
 }
 
+void
+property_init(TaskManager *manager)
+{
+
+}
+
 extern Application *
 application() {
     return new dandy();
@@ -131,6 +136,8 @@
 	twice_init(manager);
     }
     */
+    property_init(manager);
+    //create_title(sgroot, w, h);
     task_initialize();
     manager->set_TMend(TMend);
     return init(manager,argc, argv);
--- a/stage_init.cc	Thu Jun 17 05:11:29 2010 +0900
+++ b/stage_init.cc	Thu Jun 17 06:31:01 2010 +0900
@@ -4,20 +4,56 @@
 void stage_coll(SceneGraphPtr node, void *sgroot_, int w, int h,SceneGraphPtr tree);
 
 void
+createSceneGraphFromProperty(SchedTask *s, void *charactor_, void *b)
+{
+  ObjPropertyPtr charactor1 = (ObjPropertyPtr)charactor; 
+  printf("charactor.x = %f\n", charactor1[0].x);
+}
+
+
+void
 create_title(void *sgroot_, int w, int h) 
 {
+  TaskManager *manager;
   Viewer *sgroot = (Viewer *)sgroot_;
-  SceneGraphPtr back, title;
+  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].vx = back1->stack_xyz[0];
+  charactor[0].vy = back1->stack_xyz[1];
+  charactor[0].frame = back1->frame;
 
-  back  = sgroot->createSceneGraph();
-  title = sgroot->createSceneGraph("title001");
-  title->xyz[0] = w/2;
-  title->xyz[1] = h/2;
-  title->set_move_collision(title_move, title_coll);
-  back->addChild(title);
+  /* set_game_task */
+  HTask *back;
+  back = 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_param((memaddr)1);
+  back->set_post(createSceneGraphFromProperty, (void*)charactor, 0);
+  //back->set_post(test, (void*)charactor, 0);
+  back->spawn();
+}
 
-  sgroot->setSceneData(back);
-}
+  //createSceneGraphFromProperty(ObjProperty charactor);
+
+
+  //title = sgroot->createSceneGraph("title001");
+  //title->xyz[0] = w/2;
+  //title->xyz[1] = h/2;
+  //back->addChild(title);
+
+
+  //title->set_move_collision(title_move, title_coll);
+
+		
+
 
 void
 create_stage(void *sgroot_, int w, int h)