void UI_Main::reloadUI( void ) { // clear the navigation stack navigator->popAllDocuments(); // clear the navigation stack from previous installment navigator->getCache()->clearCaches(); // forget about all previously registed shaders rocketModule->clearShaderCache(); if( serverBrowser ) { serverBrowser->stopUpdate(); } if( demos ) { demos->Reset(); } destroyDataSources(); createDataSources(); preloadUI(); showUI( true ); }
void UI_Main::reloadUI( void ) { int i; for( i = 0; i < UI_NUM_CONTEXTS; i++ ) { UI_Navigation &navigation = navigations[i]; NavigationStack *navigator = navigation.front(); while( !navigation.empty() ) { NavigationStack *stack = navigation.front(); navigation.pop_front(); // clear the navigation stack stack->popAllDocuments(); stack->getCache()->clearCaches(); if( stack != navigator ) { __delete__( stack ); } } navigation.push_front( navigator ); } if( serverBrowser ) { serverBrowser->stopUpdate(); } if( demos ) { demos->Reset(); } destroyDataSources(); createDataSources(); preloadUI(); showUI( 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 ); }