experimental code to influence camera, adjusted some parameters, tried to improve...
[supertux.git] / src / scripting / wrapper.cpp
index e0ab1c2..c4a9e61 100644 (file)
@@ -202,6 +202,30 @@ static SQInteger Camera_release_hook(SQUserPointer ptr, SQInteger )
   return 0;
 }
 
+static SQInteger Camera_reload_config_wrapper(HSQUIRRELVM vm)
+{
+  SQUserPointer data;
+  if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
+    sq_throwerror(vm, _SC("'reload_config' called without instance"));
+    return SQ_ERROR;
+  }
+  Scripting::Camera* _this = reinterpret_cast<Scripting::Camera*> (data);
+
+  try {
+    _this->reload_config();
+
+    return 0;
+
+  } catch(std::exception& e) {
+    sq_throwerror(vm, e.what());
+    return SQ_ERROR;
+  } catch(...) {
+    sq_throwerror(vm, _SC("Unexpected exception while executing function 'reload_config'"));
+    return SQ_ERROR;
+  }
+
+}
+
 static SQInteger Camera_shake_wrapper(HSQUIRRELVM vm)
 {
   SQUserPointer data;
@@ -3960,6 +3984,12 @@ void register_supertux_wrapper(HSQUIRRELVM v)
     msg << "Couldn't create new class 'Camera'";
     throw SquirrelError(v, msg.str());
   }
+  sq_pushstring(v, "reload_config", -1);
+  sq_newclosure(v, &Camera_reload_config_wrapper, 0);
+  if(SQ_FAILED(sq_createslot(v, -3))) {
+    throw SquirrelError(v, "Couldn't register function 'reload_config'");
+  }
+
   sq_pushstring(v, "shake", -1);
   sq_newclosure(v, &Camera_shake_wrapper, 0);
   if(SQ_FAILED(sq_createslot(v, -3))) {