bool GuiDemo::setup(void) { gkBlendFile* blend = gkBlendLoader::getSingleton().loadFile(gkUtils::getFile(m_blend), "", GUIDEMO_GROUP_NAME); if (!blend) { gkPrintf("File loading failed.\n"); return false; } m_scene = blend->getMainScene(); if (!m_scene) { gkPrintf("No usable scenes found in blend.\n"); return false; } m_scene->createInstance(); // add input hooks gkWindowSystem::getSingleton().addListener(this); gkBlendLoader::getSingleton().loadFile(gkUtils::getFile(ASSETS_BLEND_FILE), "", GUIDEMO_GROUP_NAME); //-- initRocket(); return true; }
UI_Main::UI_Main( int vidWidth, int vidHeight, int protocol, int sharedSeed, bool demoPlaying, const char *demoName ) // pointers to zero : asmodule(0), rocketModule(0), levelshot_fmt(0), datetime_fmt(0), duration_fmt(0), filetype_fmt(0), colorcode_fmt(0), crosshair_fmt(0), empty_fmt(0), serverBrowser(0), gameTypes(0), maps(0), vidProfiles(0), huds(0), videoModes(0), demos(0), mods(0), playerModels(0), crosshairs(0), navigator(0), /* backwards development compatibility: */ currentLoader(0), // other members mousex(0), mousey(0), gameProtocol(protocol), menuVisible(false), forceMenu(false), showNavigationStack(false), demoInfo(demoName), sharedSeed(sharedSeed) { // instance self = this; Vector4Set( colorWhite, 1, 1, 1, 1 ); ui_basepath = trap::Cvar_Get( "ui_basepath", "/ui/baseui", CVAR_ARCHIVE ); ui_cursor = trap::Cvar_Get( "ui_cursor", "cursors/default.rml", CVAR_DEVELOPER ); ui_developer = trap::Cvar_Get( "developer", "0", 0 ); // temp fix for missing background on start.. populate refreshState with some nice values refreshState.clientState = CA_UNINITIALIZED; refreshState.width = vidWidth; refreshState.height = vidHeight; refreshState.drawBackground = true; demoInfo.setPlaying( demoPlaying ); if( !initRocket() ) throw std::runtime_error( "UI: Failed to initialize libRocket" ); registerRocketCustoms(); createDataSources(); createFormatters(); navigator = __new__( NavigationStack )(); streamCache = __new__( StreamCache )(); streamCache->Init(); if( !initAS() ) throw std::runtime_error( "UI: Failed to initialize AngelScript" ); // this after instantiation ASUI::BindGlobals( self->getAS() ); // load cursor document loadCursor(); // this has to be called after AS API is fully loaded preloadUI(); // commands trap::Cmd_AddCommand( "ui_reload", ReloadUI_Cmd_f ); trap::Cmd_AddCommand( "ui_dumpapi", DumpAPI_f ); trap::Cmd_AddCommand( "ui_printdocs", PrintDocuments_Cmd ); trap::Cmd_AddCommand( "menu_force", M_Menu_Force_f ); trap::Cmd_AddCommand( "menu_open", M_Menu_Open_f ); trap::Cmd_AddCommand( "menu_close", M_Menu_Close_f ); trap::Cmd_AddCommand( "menu_tvchannel_add", &M_Menu_AddTVChannel_f ); trap::Cmd_AddCommand( "menu_tvchannel_remove", &M_Menu_RemoveTVChannel_f ); }