diff --git a/include/level.h b/include/level.h index 37bf410..8a9d10d 100644 --- a/include/level.h +++ b/include/level.h @@ -70,7 +70,9 @@ namespace OpenArena uint32 FPS(); void ParseCmds(const char*); void Print(int x, int y, const char* string, unsigned int set); - + void SetWindow(Window*); + Window* GetWindow(); + /*Not Yet Implemented void PlayerConnect(); // implement later void PlayerDisconnect(); // implement later @@ -105,7 +107,7 @@ namespace OpenArena //list textures; Texture* textures; Texture menuTextures[NUM_MENU_TEXTURES]; - + Window* _window; // private: diff --git a/include/window.h b/include/window.h index 32439f8..0347452 100644 --- a/include/window.h +++ b/include/window.h @@ -15,7 +15,7 @@ #include #include #include -#include +//#include #include #endif @@ -82,7 +82,7 @@ namespace OpenArena GLXContext hRC; XSetWindowAttributes attributes; bool doubleBuffered; - XF86VidModeModeInfo vidMode; + //XF86VidModeModeInfo vidMode; int x, y; Display* display; #endif diff --git a/src/level.cpp b/src/level.cpp index aaf6770..dc8d557 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -37,6 +37,7 @@ namespace OpenArena { Level::Level() { + _window = NULL; textureNames = NULL; numTextures = 0; textures = NULL; @@ -432,31 +433,38 @@ namespace OpenArena void Level::LoadGLTextures() { - - /*GLfloat light[4] = {1.0f,1.0f,1.0f,0.5f}; - glLightfv(GL_LIGHT1, GL_AMBIENT, light); - glEnable(GL_LIGHT1); - glEnable(GL_LIGHTING);*/ - - if(textures != NULL) + printf("In LoadGLTextures: _window = %d\n", _window); + if(_window != NULL) { - delete [] textures; - } - - textures = new Texture[numTextures]; - - for(uint32 i=0; i 0) diff --git a/src/macosx.cpp b/src/macosx.cpp index ebea24a..40ba756 100644 --- a/src/macosx.cpp +++ b/src/macosx.cpp @@ -144,6 +144,9 @@ int main(int argc, char** argv) { return 1; } + + level.SetWindow(&g_Screen); + level.LoadGLTextures(); while(!done) { diff --git a/src/myglTexture.cpp b/src/myglTexture.cpp index b670e49..39e17f6 100644 --- a/src/myglTexture.cpp +++ b/src/myglTexture.cpp @@ -71,7 +71,9 @@ namespace OpenArena { if(Loaded()) { - FreeGLTexture(id); + //This is only temporarily removed for mac os x + //TODO make this work on all operating systems + //FreeGLTexture(id); minFilter = GL_LINEAR; magFilter = GL_LINEAR; filename = ""; diff --git a/src/window.cpp b/src/window.cpp index e108b3a..67997bf 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -61,8 +61,8 @@ void OpenArena::Window::Close() if(_fullscreen) { - XF86VidModeSwitchToMode(display, screen, &vidMode); - XF86VidModeSetViewPort(display, screen, 0, 0); +// XF86VidModeSwitchToMode(display, screen, &vidMode); +// XF86VidModeSetViewPort(display, screen, 0, 0); } XCloseDisplay(display); } @@ -222,27 +222,27 @@ bool OpenArena::Window::Open() int glxMajorVersion; int glxMinorVersion; int modeNum; - XF86VidModeModeInfo** modes; +// XF86VidModeModeInfo** modes; Atom wmDelete; ::Window winDummy; unsigned int borderDummy; display = XOpenDisplay(0); screen = DefaultScreen(display); - XF86VidModeQueryVersion(display, &vidModeMajorVersion, &vidModeMinorVersion); - printf("XF86VidModeExtension-Version %d.%d\n", vidModeMajorVersion, vidModeMinorVersion); + //XF86VidModeQueryVersion(display, &vidModeMajorVersion, &vidModeMinorVersion); + //printf("XF86VidModeExtension-Version %d.%d\n", vidModeMajorVersion, vidModeMinorVersion); - XF86VidModeGetAllModeLines(display, screen, &modeNum, &modes); - vidMode = *modes[0]; + //XF86VidModeGetAllModeLines(display, screen, &modeNum, &modes); + //vidMode = *modes[0]; int i; for(i=0; ihdisplay == _width) && (modes[i]->vdisplay == _height)) - { - bestMode = i; - } + // if((modes[i]->hdisplay == _width) && (modes[i]->vdisplay == _height)) + // { + // bestMode = i; + // } } vi = glXChooseVisual(display, screen, attrListDbl); @@ -274,9 +274,9 @@ bool OpenArena::Window::Open() if(_fullscreen) { - XF86VidModeSwitchToMode(display, screen, modes[bestMode]); - XF86VidModeSetViewPort(display, screen, 0, 0); - XFree(modes); + // XF86VidModeSwitchToMode(display, screen, modes[bestMode]); + // XF86VidModeSetViewPort(display, screen, 0, 0); + // XFree(modes); attributes.override_redirect = true; window = XCreateWindow(display, RootWindow(display, vi->screen), 0, 0, _width, _height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect, &attributes); diff --git a/src/windows.cpp b/src/windows.cpp index 535d024..a20346c 100644 --- a/src/windows.cpp +++ b/src/windows.cpp @@ -257,6 +257,8 @@ int WINAPI WinMain( HINSTANCE hInstance, return 0; } + level.SetWindow(g_Screen); + while(!done) { while (PeekMessage(&msg,NULL,0,0,PM_REMOVE))