Changeset 11562 for code/branches/ScriptableController_HS17/src/orxonox/scriptablecontroller/scriptable_controller_api.cc
- Timestamp:
- Nov 13, 2017, 5:25:09 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ScriptableController_HS17/src/orxonox/scriptablecontroller/scriptable_controller_api.cc
r11552 r11562 3 3 #include "luatb.h" 4 4 #include "scriptable_controller.h" 5 #include "tools/Timer.h" 5 6 6 7 namespace orxonox … … 13 14 14 15 // Haven't found a shorter way yet to write that... 16 LuaTB<ScriptableControllerAPI, decltype(&ScriptableControllerAPI::orxPrint)>::registerFunction<&ScriptableControllerAPI::orxPrint>(this, lua, "orxPrint"); 15 17 LuaTB<ScriptableControllerAPI, decltype(&ScriptableControllerAPI::registerAfterTimeout)>::registerFunction<&ScriptableControllerAPI::registerAfterTimeout>(this, lua, "registerAfterTimeout"); 16 18 LuaTB<ScriptableControllerAPI, decltype(&ScriptableControllerAPI::registerAtNearObject)>::registerFunction<&ScriptableControllerAPI::registerAtNearObject>(this, lua, "registerAtNearObject"); … … 26 28 } 27 29 30 void ScriptableControllerAPI::orxPrint(std::string msg) 31 { 32 orxout(user_info) << msg << std::endl; 33 } 34 28 35 void ScriptableControllerAPI::registerAfterTimeout(std::function<void (void)> callback, double timeout) 29 36 { 30 // TODO Extend timer class to accept std::function31 this->controller_->registerTimeout(callback, timeout);37 // Kills itself when the timer fires 38 new Timer(timeout, false, callback, true); 32 39 } 33 40 34 41 int ScriptableControllerAPI::registerAtNearObject(std::function<void (int, int)> callback, int obj1, int obj2, double distance) 35 42 { 36 43 //this->controller_->addNearObjectHandler(obj1, obj1, distance, callback); 37 44 } 38 45
Note: See TracChangeset
for help on using the changeset viewer.