1
0
forked from 0ad/0ad

remove obsolete NO_GUI that's just cluttering up the code

This was SVN commit r7086.
This commit is contained in:
janwas 2009-08-08 10:04:43 +00:00
parent b59ba962df
commit 6b619cfb38
4 changed files with 6 additions and 41 deletions

View File

@ -259,9 +259,7 @@ static void Frame()
PROFILE_START("gui tick"); PROFILE_START("gui tick");
MICROLOG(L"gui tick"); MICROLOG(L"gui tick");
#ifndef NO_GUI
g_GUI.TickObjects(); g_GUI.TickObjects();
#endif
PROFILE_END("gui tick"); PROFILE_END("gui tick");
ogl_WarnIfError(); ogl_WarnIfError();
@ -347,9 +345,7 @@ static void MainControllerInit()
// gui_handler needs to be registered after (i.e. called before!) the // gui_handler needs to be registered after (i.e. called before!) the
// hotkey handler so that input boxes can be typed in without // hotkey handler so that input boxes can be typed in without
// setting off hotkeys. // setting off hotkeys.
#ifndef NO_GUI
in_add_handler(gui_handler); in_add_handler(gui_handler);
#endif
// must be registered after gui_handler. Should mayhap even be last. // must be registered after gui_handler. Should mayhap even be last.
in_add_handler(MainInputHandler); in_add_handler(MainInputHandler);

View File

@ -40,9 +40,7 @@
#include "simulation/EntityManager.h" #include "simulation/EntityManager.h"
#include "simulation/Simulation.h" #include "simulation/Simulation.h"
#ifndef NO_GUI
#include "gui/CGUI.h" #include "gui/CGUI.h"
#endif
class CNetServer; class CNetServer;
extern CNetServer *g_NetServer; extern CNetServer *g_NetServer;
@ -133,8 +131,6 @@ PSRETURN CGame::RegisterInit(CGameAttributes* pAttribs)
**/ **/
PSRETURN CGame::ReallyStartGame() PSRETURN CGame::ReallyStartGame()
{ {
#ifndef NO_GUI
// Call the reallyStartGame GUI function, but only if it exists // Call the reallyStartGame GUI function, but only if it exists
jsval fval, rval; jsval fval, rval;
JSBool ok = JS_GetProperty(g_ScriptingHost.getContext(), g_GUI.GetScriptObject(), "reallyStartGame", &fval); JSBool ok = JS_GetProperty(g_ScriptingHost.getContext(), g_GUI.GetScriptObject(), "reallyStartGame", &fval);
@ -144,7 +140,6 @@ PSRETURN CGame::ReallyStartGame()
ok = JS_CallFunctionValue(g_ScriptingHost.getContext(), g_GUI.GetScriptObject(), fval, 0, NULL, &rval); ok = JS_CallFunctionValue(g_ScriptingHost.getContext(), g_GUI.GetScriptObject(), fval, 0, NULL, &rval);
debug_assert(ok); debug_assert(ok);
} }
#endif
debug_printf("GAME STARTED, ALL INIT COMPLETE\n"); debug_printf("GAME STARTED, ALL INIT COMPLETE\n");
m_GameStarted=true; m_GameStarted=true;
@ -156,9 +151,7 @@ PSRETURN CGame::ReallyStartGame()
g_GameRestarted = true; g_GameRestarted = true;
#ifndef NO_GUI
g_GUI.SendEventToAll("sessionstart"); g_GUI.SendEventToAll("sessionstart");
#endif
return 0; return 0;
} }

View File

@ -80,11 +80,9 @@
#include "ps/scripting/JSInterface_Console.h" #include "ps/scripting/JSInterface_Console.h"
#include "ps/scripting/JSCollection.h" #include "ps/scripting/JSCollection.h"
#include "simulation/scripting/SimulationScriptInit.h" #include "simulation/scripting/SimulationScriptInit.h"
#ifndef NO_GUI #include "gui/scripting/JSInterface_IGUIObject.h"
# include "gui/scripting/JSInterface_IGUIObject.h" #include "gui/scripting/JSInterface_GUITypes.h"
# include "gui/scripting/JSInterface_GUITypes.h" #include "gui/GUI.h"
# include "gui/GUI.h"
#endif
#include "sound/JSI_Sound.h" #include "sound/JSI_Sound.h"
#include "network/NetLog.h" #include "network/NetLog.h"
@ -129,9 +127,7 @@ static int SetVideoMode(int w, int h, int bpp, bool fullscreen)
glViewport(0, 0, w, h); glViewport(0, 0, w, h);
#ifndef NO_GUI
g_GUI.UpdateResolution(); g_GUI.UpdateResolution();
#endif
ogl_Init(); // required after each mode change ogl_Init(); // required after each mode change
@ -207,7 +203,6 @@ retry:
void GUI_Init() void GUI_Init()
{ {
#ifndef NO_GUI
{TIMER("ps_gui_init"); {TIMER("ps_gui_init");
g_GUI.Initialize();} g_GUI.Initialize();}
@ -242,16 +237,13 @@ void GUI_Init()
g_GUI.LoadXmlFile("gui/test/7_atlas.xml");} g_GUI.LoadXmlFile("gui/test/7_atlas.xml");}
{TIMER("ps_gui_9"); {TIMER("ps_gui_9");
g_GUI.LoadXmlFile("gui/test/9_global.xml");} g_GUI.LoadXmlFile("gui/test/9_global.xml");}
#endif
} }
void GUI_Shutdown() void GUI_Shutdown()
{ {
#ifndef NO_GUI
g_GUI.Destroy(); g_GUI.Destroy();
delete &g_GUI; delete &g_GUI;
#endif
} }
@ -264,13 +256,11 @@ void GUI_ShowMainMenu()
// display progress / description in loading screen // display progress / description in loading screen
void GUI_DisplayLoadProgress(int percent, const wchar_t* pending_task) void GUI_DisplayLoadProgress(int percent, const wchar_t* pending_task)
{ {
#ifndef NO_GUI
CStrW i18n_description = I18n::translate(pending_task); CStrW i18n_description = I18n::translate(pending_task);
JSString* js_desc = StringConvert::wstring_to_jsstring(g_ScriptingHost.getContext(), i18n_description); JSString* js_desc = StringConvert::wstring_to_jsstring(g_ScriptingHost.getContext(), i18n_description);
g_ScriptingHost.SetGlobal("g_Progress", INT_TO_JSVAL(percent)); g_ScriptingHost.SetGlobal("g_Progress", INT_TO_JSVAL(percent));
g_ScriptingHost.SetGlobal("g_LoadDescription", STRING_TO_JSVAL(js_desc)); g_ScriptingHost.SetGlobal("g_LoadDescription", STRING_TO_JSVAL(js_desc));
g_GUI.SendEventToAll("progress"); g_GUI.SendEventToAll("progress");
#endif
} }
@ -281,13 +271,11 @@ void Render()
ogl_WarnIfError(); ogl_WarnIfError();
#ifndef NO_GUI // HACK: because colour-parsing requires the GUI
CStr skystring = "61 193 255"; CStr skystring = "61 193 255";
CFG_GET_USER_VAL("skycolor", String, skystring); CFG_GET_USER_VAL("skycolor", String, skystring);
CColor skycol; CColor skycol;
GUI<CColor>::ParseString(skystring, skycol); GUI<CColor>::ParseString(skystring, skycol);
g_Renderer.SetClearColor(skycol.AsSColor4ub()); g_Renderer.SetClearColor(skycol.AsSColor4ub());
#endif
// start new frame // start new frame
g_Renderer.BeginFrame(); g_Renderer.BeginFrame();
@ -397,13 +385,11 @@ void Render()
ogl_WarnIfError(); ogl_WarnIfError();
#ifndef NO_GUI
// Temp GUI message GeeTODO // Temp GUI message GeeTODO
MICROLOG(L"render GUI"); MICROLOG(L"render GUI");
PROFILE_START( "render gui" ); PROFILE_START( "render gui" );
if(g_DoRenderGui) g_GUI.Draw(); if(g_DoRenderGui) g_GUI.Draw();
PROFILE_END( "render gui" ); PROFILE_END( "render gui" );
#endif
ogl_WarnIfError(); ogl_WarnIfError();
@ -515,10 +501,8 @@ static void RegisterJavascriptInterfaces()
SimulationScriptInit(); SimulationScriptInit();
// GUI // GUI
#ifndef NO_GUI
JSI_IGUIObject::init(); JSI_IGUIObject::init();
JSI_GUITypes::init(); JSI_GUITypes::init();
#endif
} }
@ -1040,9 +1024,7 @@ void Init(const CmdLineArgs& args, int flags)
const bool setup_gui = ((flags & INIT_NO_GUI) == 0 && g_AutostartMap.empty()); const bool setup_gui = ((flags & INIT_NO_GUI) == 0 && g_AutostartMap.empty());
// GUI is notified in SetVideoMode, so this must come before that. // GUI is notified in SetVideoMode, so this must come before that.
#ifndef NO_GUI
new CGUI; new CGUI;
#endif
// default to windowed, so users don't get stuck if e.g. half the // default to windowed, so users don't get stuck if e.g. half the
// filesystem is missing and the config files aren't loaded // filesystem is missing and the config files aren't loaded
@ -1149,12 +1131,10 @@ void Init(const CmdLineArgs& args, int flags)
ogl_WarnIfError(); ogl_WarnIfError();
#ifndef NO_GUI
{ {
TIMER("Init_guiload"); TIMER("Init_guiload");
g_GUI.SendEventToAll("load"); g_GUI.SendEventToAll("load");
} }
#endif
if (g_FixedFrameTiming) { if (g_FixedFrameTiming) {
CCamera &camera = *g_Game->GetView()->GetCamera(); CCamera &camera = *g_Game->GetView()->GetCamera();

View File

@ -73,9 +73,7 @@
#include "simulation/TechnologyCollection.h" #include "simulation/TechnologyCollection.h"
#include "simulation/TriggerManager.h" #include "simulation/TriggerManager.h"
#ifndef NO_GUI #include "gui/scripting/JSInterface_IGUIObject.h"
# include "gui/scripting/JSInterface_IGUIObject.h"
#endif
extern bool g_TerrainModified; extern bool g_TerrainModified;
@ -1483,11 +1481,9 @@ JSFunctionSpec ScriptFunctionTable[] =
JS_FUNC("toggleTerritoryRendering", ToggleTerritoryRendering, 0) JS_FUNC("toggleTerritoryRendering", ToggleTerritoryRendering, 0)
// GUI // GUI
#ifndef NO_GUI
JS_FUNC("getGUIObjectByName", JSI_IGUIObject::getByName, 1) // external JS_FUNC("getGUIObjectByName", JSI_IGUIObject::getByName, 1) // external
JS_FUNC("getGUIGlobal", GetGuiGlobal, 0) JS_FUNC("getGUIGlobal", GetGuiGlobal, 0)
JS_FUNC("resetGUI", ResetGui, 0) JS_FUNC("resetGUI", ResetGui, 0)
#endif
// Events // Events
JS_FUNC("addGlobalHandler", AddGlobalHandler, 2) JS_FUNC("addGlobalHandler", AddGlobalHandler, 2)