コード例 #1
0
ファイル: CEGUILua.cpp プロジェクト: B2O/IV-Network
/*************************************************************************
	Constructor (creates Lua state)
*************************************************************************/
LuaScriptModule::LuaScriptModule(lua_State* state) :
    d_ownsState(state == 0),
    d_state(state),
    d_errFuncIndex(LUA_NOREF),
    d_activeErrFuncIndex(LUA_NOREF)
{
    // initialise and create a lua_State if one was not provided
    if (!d_state)
    {
        #if CEGUI_LUA_VER >= 51
            static const luaL_Reg lualibs[] = {
                {"", luaopen_base},
                {LUA_LOADLIBNAME, luaopen_package},
                {LUA_TABLIBNAME, luaopen_table},
                {LUA_IOLIBNAME, luaopen_io},
                {LUA_OSLIBNAME, luaopen_os},
                {LUA_STRLIBNAME, luaopen_string},
                {LUA_MATHLIBNAME, luaopen_math},
            #if defined(DEBUG) || defined (_DEBUG)
                    {LUA_DBLIBNAME, luaopen_debug},
            #endif
                {0, 0}
            };
        #endif /* CEGUI_LUA_VER >= 51 */

        // create a lua state
        d_ownsState = true;
#if LUA_VERSION_NUM > 501
        d_state = luaL_newstate();
#else
        d_state = lua_open();
#endif

        // init all standard libraries
        #if CEGUI_LUA_VER >= 51
                const luaL_Reg *lib = lualibs;
                for (; lib->func; lib++)
                {
                    lua_pushcfunction(d_state, lib->func);
                    lua_pushstring(d_state, lib->name);
                    lua_call(d_state, 1, 0);
                }
        #else /* CEGUI_LUA_VER >= 51 */
            luaopen_base(d_state);
            luaopen_io(d_state);
            luaopen_string(d_state);
            luaopen_table(d_state);
            luaopen_math(d_state);
            #if defined(DEBUG) || defined (_DEBUG)
                luaopen_debug(d_state);
            #endif
        #endif /* CEGUI_LUA_VER >= 51 */
    }

    setModuleIdentifierString();
}
コード例 #2
0
FalconScriptingModule::FalconScriptingModule(Falcon::VMachine* vm) : d_vm(vm), d_ownsVM(vm == 0)
{
    const CEGUI::String& dir = static_cast<CEGUI::DefaultResourceProvider*>(CEGUI::System::getSingleton().getResourceProvider())->getResourceGroupDirectory(this->getDefaultResourceGroup());
    Falcon::Engine::Init();
    d_ml = new Falcon::ModuleLoader(GameManager::getGameFolderName().c_str());
    d_ml->addFalconPath();
    d_ml->addDirectoryBack(dir.c_str());
    if(!d_vm) {
        d_ownsVM = true;
        d_vm = new Falcon::VMachine;
        d_vm->link(Falcon::core_module_init());
        d_vm->link(DisandriaFalconSAPI::createBinding());
        d_vm->link(CEGUIFalconBinding::createBinding());
    }
    setModuleIdentifierString();
}
コード例 #3
0
ファイル: openglrenderer.cpp プロジェクト: gitrider/wxsj2
OpenGLRenderer::OpenGLRenderer(uint max_quads,int width, int height) :
	d_queueing(true),
	d_currTexture(0),
	d_bufferPos(0)
{
	GLint vp[4];   

	// initialise renderer size
	glGetIntegerv(GL_VIEWPORT, vp);
	glGetIntegerv(GL_MAX_TEXTURE_SIZE, &d_maxTextureSize);
	d_display_area.d_left	= 0;
	d_display_area.d_top	= 0;
	d_display_area.d_right	= static_cast<float>(width);
	d_display_area.d_bottom	= static_cast<float>(height);

    setModuleIdentifierString();
}