diff Renderer/Test/camera_action.cc @ 0:04e28d8d3c6f

first commit
author Daiki KINJYO <e085722@ie.u-ryukyu.ac.jp>
date Mon, 08 Nov 2010 01:23:25 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Renderer/Test/camera_action.cc	Mon Nov 08 01:23:25 2010 +0900
@@ -0,0 +1,58 @@
+#include "SceneGraphRoot.h"
+#include "SGList.h"
+#include "camera_action.h"
+
+#define MOVE_SPEED 0.10
+
+void
+camera_init(SceneGraphPtr node, int screen_w, int screen_h)
+{
+    node->xyz[0] = screen_w/2;
+    node->xyz[1] = screen_h/2 + 50;
+    node->xyz[2] = 0;
+    node->angle[0] = 120;
+}
+
+void
+c_move(SceneGraphPtr node, int screen_w, int screen_h)
+{
+    Pad *pad = sgroot->getController();
+
+    if(pad->right.isHold())
+    {
+	if(node->xyz[0]>screen_w/2 - 50)
+	{
+          node->xyz[0]-=MOVE_SPEED;
+        }
+    }
+
+    if(pad->left.isHold())
+    {
+      if(node->xyz[0]<screen_w/2 + 50)
+        {
+          node->xyz[0]+=MOVE_SPEED;
+        }
+    }
+
+  if(pad->down.isHold())
+    {
+      if(node->xyz[2]>-25)
+        {
+          node->xyz[2]-=MOVE_SPEED;
+        }
+    }
+
+  if(pad->up.isHold())
+  {
+      if(node->xyz[2]<25)
+      {
+          node->xyz[2]+=MOVE_SPEED;
+      }
+  }
+
+}
+
+void
+camera_collision(SceneGraphPtr node, int screen_w, int screen_h,SceneGraphPtr tree)
+{
+}