diff --git a/source/main.cpp b/source/main.cpp
index 046ee855d7..e48a11f080 100755
--- a/source/main.cpp
+++ b/source/main.cpp
@@ -15,9 +15,9 @@
#include "vfs.h"
#include "ia32.h"
-///// janwas I added this
+#ifndef NO_GUI
#include "gui/GUI.h"
-/////
+#endif
u32 game_ticks;
@@ -118,6 +118,8 @@ static int set_vmode(int w, int h, int bpp)
}
+// break out of main loop
+static bool quit = false;
static bool handler(const SDL_Event& ev)
{
@@ -131,7 +133,8 @@ static bool handler(const SDL_Event& ev)
switch(c)
{
case SDLK_ESCAPE:
- exit(0);
+ quit = true;
+ break;
}
break;
@@ -200,10 +203,10 @@ const float x = 600.0f, y = 512.0f;
glprintf("%d FPS", fps);
- ////// janwas
+#ifndef NO_GUI
glLoadIdentity();
g_GUI.Draw();
- //////
+#endif
// restore
@@ -230,13 +233,6 @@ int main(int argc, char* argv[])
detect();
- ///// janwas: place this wherever
- new CGUI; // we should have a place for all singleton news
- g_GUI.Initialize();
- g_GUI.LoadXMLFile("hello.xml");
- //g_GUI.LoadXMLFile("sprite1.xml");
- /////
-
// init SDL
if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_NOPARACHUTE) < 0)
{
@@ -273,11 +269,27 @@ glEnable (GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
+
+
+// TODO: all loading should go through the VFS; for now, we allow normal access
+// this has to come before VFS init, as it changes the current dir
+#ifndef NO_GUI
+ new CGUI; // we should have a place for all singleton news
+ g_GUI.Initialize();
+ g_GUI.LoadXMLFile("hello.xml");
+ //g_GUI.LoadXMLFile("sprite1.xml");
+#endif
+
+
vfs_set_root(argv[0], "data");
// tex = tex_load("0adlogo2.bmp");
// tex_upload(tex);
font = font_load("verdana.fnt");
+
+
+
+
terr_init();
in_add_handler(handler);
@@ -287,7 +299,7 @@ in_add_handler(terr_handler);
const double TICK_TIME = 30e-3; // [s]
double time0 = get_time();
- for(;;)
+ while(!quit)
{
// TODO: limiter in case simulation can't keep up?
double time1 = get_time();
@@ -305,10 +317,10 @@ in_add_handler(terr_handler);
calc_fps();
}
- ///// Janwas place this wherever
+#ifndef NO_GUI
g_GUI.Destroy();
delete CGUI::GetSingletonPtr(); // again, we should have all singleton deletes somewhere
- /////
+#endif
return 0;
}
diff --git a/source/vc6/ps.dsp b/source/vc6/ps.dsp
index cfba8a91bf..0beba8dd67 100755
--- a/source/vc6/ps.dsp
+++ b/source/vc6/ps.dsp
@@ -235,15 +235,23 @@ SOURCE=..\gui\CGUISprite.h
# End Source File
# Begin Source File
-SOURCE=..\gui\GUI.cpp
-# End Source File
-# Begin Source File
-
SOURCE=..\gui\GUI.h
# End Source File
# Begin Source File
-SOURCE=..\gui\guimain.cpp
+SOURCE=..\gui\GUIbase.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\gui\GUIbase.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\gui\GUIutil.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\gui\GUIutil.h
# End Source File
# Begin Source File
diff --git a/source/vc7/ps.vcproj b/source/vc7/ps.vcproj
index 679e744fcd..6c584e5a6d 100755
--- a/source/vc7/ps.vcproj
+++ b/source/vc7/ps.vcproj
@@ -204,12 +204,16 @@
RelativePath="..\gui\CGUISprite.cpp"/>
-
+ RelativePath="..\gui\GUIbase.cpp"/>
+
+
+