Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 23, 2009, 8:47:55 PM (15 years ago)
Author:
rgrieder
Message:

Generalised use of tolua interfaces a bit: GSRoot now adds the interface functions to LuaBind which supports two new functions: openToluaInterfaces and closeToluaInterfaces. Both accept a lua state and can therefore be used to inject our own tolua bindings (the GUIManager makes use of that).
There's also something new: When loading a level, you could now use the tolua bindings from Orxonox as well (not just those from Core).

Location:
code/branches/resource/src/orxonox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/resource/src/orxonox/gamestates/GSRoot.cc

    r3304 r3340  
    3434#include "core/Game.h"
    3535#include "core/GameMode.h"
     36#include "core/LuaBind.h"
    3637#include "network/NetworkFunction.h"
     38#include "ToluaBindCore.h"
     39#include "ToluaBindOrxonox.h"
    3740#include "tools/Timer.h"
    3841#include "interfaces/TimeFactorListener.h"
     
    5861        this->ccSetTimeFactor_ = 0;
    5962        this->ccPause_ = 0;
     63
     64        // Tell LuaBind about all tolua interfaces
     65        LuaBind::getInstance().addToluaInterface(&tolua_Core_open, "Core");
     66        LuaBind::getInstance().addToluaInterface(&tolua_Orxonox_open, "Orxonox");
    6067    }
    6168
  • code/branches/resource/src/orxonox/gui/GUIManager.cc

    r3339 r3340  
    5959#include "core/Core.h"
    6060#include "core/Clock.h"
    61 #include "ToluaBindCore.h"
    62 #include "ToluaBindOrxonox.h"
     61#include "core/LuaBind.h"
    6362
    6463namespace orxonox
     
    136135
    137136            // do this after 'new CEGUI::Sytem' because that creates the lua state in the first place
    138             tolua_Core_open(this->scriptModule_->getLuaState());
    139             tolua_Orxonox_open(this->scriptModule_->getLuaState());
     137            LuaBind::getInstance().openToluaInterfaces(this->luaState_);
    140138
    141139            // initialise the basic lua code
     
    162160    {
    163161        // destroy our own tolua interfaces
    164         lua_pushnil(luaState_);
    165         lua_setglobal(luaState_, "Orxonox");
    166         lua_pushnil(luaState_);
    167         lua_setglobal(luaState_, "Core");
     162        LuaBind::getInstance().closeToluaInterfaces(this->luaState_);
    168163
    169164        singletonRef_s = 0;
Note: See TracChangeset for help on using the changeset viewer.