Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 13, 2017, 5:25:09 PM (7 years ago)
Author:
kohlia
Message:

Figuring out when the different things are ready in orxonox

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ScriptableController_HS17/src/orxonox/scriptablecontroller/scriptable_controller_api.cc

    r11552 r11562  
    33#include "luatb.h"
    44#include "scriptable_controller.h"
     5#include "tools/Timer.h"
    56
    67namespace orxonox
     
    1314
    1415    // Haven't found a shorter way yet to write that...
     16    LuaTB<ScriptableControllerAPI, decltype(&ScriptableControllerAPI::orxPrint)>::registerFunction<&ScriptableControllerAPI::orxPrint>(this, lua, "orxPrint");
    1517    LuaTB<ScriptableControllerAPI, decltype(&ScriptableControllerAPI::registerAfterTimeout)>::registerFunction<&ScriptableControllerAPI::registerAfterTimeout>(this, lua, "registerAfterTimeout");
    1618    LuaTB<ScriptableControllerAPI, decltype(&ScriptableControllerAPI::registerAtNearObject)>::registerFunction<&ScriptableControllerAPI::registerAtNearObject>(this, lua, "registerAtNearObject");
     
    2628}
    2729
     30void ScriptableControllerAPI::orxPrint(std::string msg)
     31{
     32    orxout(user_info) << msg << std::endl;
     33}
     34
    2835void ScriptableControllerAPI::registerAfterTimeout(std::function<void (void)> callback, double timeout)
    2936{
    30     // TODO Extend timer class to accept std::function
    31     this->controller_->registerTimeout(callback, timeout);
     37    // Kills itself when the timer fires
     38    new Timer(timeout, false, callback, true);
    3239}
    3340
    3441int ScriptableControllerAPI::registerAtNearObject(std::function<void (int, int)> callback, int obj1, int obj2, double distance)
    3542{
    36 
     43    //this->controller_->addNearObjectHandler(obj1, obj1, distance, callback);
    3744}
    3845
Note: See TracChangeset for help on using the changeset viewer.