more missing asserts
[supertux.git] / src / scripting / camera.cpp
index 6f6173b..93b9104 100644 (file)
@@ -2,13 +2,16 @@
 
 #include <string>
 #include <stdio.h>
-#include "camera.hpp"
+#include "object/camera.hpp"
+#include "scripting/camera.hpp"
+#include "math/vector.hpp"
 
-#define NOIMPL      printf("%s not implemented.\n", __PRETTY_FUNCTION__);
+#define NOIMPL      msg_fatal << __PRETTY_FUNCTION__ << " not implemented."
 
 namespace Scripting
 {
-  Camera::Camera()
+  Camera::Camera(::Camera* camera)
+    : camera(camera)
   { }
 
   Camera::~Camera()
@@ -27,8 +30,20 @@ namespace Scripting
   }
 
   void
-  Camera::set_mode(const std::string& )
+  Camera::set_mode(const std::string& mode)
   {
-    NOIMPL;
-  }  
+    if(mode == "normal") {
+      camera->mode = ::Camera::NORMAL;
+    } else if(mode == "manual") {
+      camera->mode = ::Camera::MANUAL;
+    } else {
+      msg_fatal << "Camera mode '" << mode << "' unknown.";
+    }
+  }
+
+  void
+  Camera::scroll_to(float x, float y, float scrolltime)
+  {
+    camera->scroll_to(Vector(x, y), scrolltime);
+  }
 }