Fixes for Mac OS X (still no textures)
This commit is contained in:
@@ -70,6 +70,8 @@ namespace OpenArena
|
|||||||
uint32 FPS();
|
uint32 FPS();
|
||||||
void ParseCmds(const char*);
|
void ParseCmds(const char*);
|
||||||
void Print(int x, int y, const char* string, unsigned int set);
|
void Print(int x, int y, const char* string, unsigned int set);
|
||||||
|
void SetWindow(Window*);
|
||||||
|
Window* GetWindow();
|
||||||
|
|
||||||
/*Not Yet Implemented
|
/*Not Yet Implemented
|
||||||
void PlayerConnect(); // implement later
|
void PlayerConnect(); // implement later
|
||||||
@@ -105,7 +107,7 @@ namespace OpenArena
|
|||||||
//list<GL_MY_TEXTURE> textures;
|
//list<GL_MY_TEXTURE> textures;
|
||||||
Texture* textures;
|
Texture* textures;
|
||||||
Texture menuTextures[NUM_MENU_TEXTURES];
|
Texture menuTextures[NUM_MENU_TEXTURES];
|
||||||
|
Window* _window;
|
||||||
|
|
||||||
|
|
||||||
// private:
|
// private:
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include <GL/glx.h>
|
#include <GL/glx.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/extensions/xf86vmode.h>
|
//#include <X11/extensions/xf86vmode.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ namespace OpenArena
|
|||||||
GLXContext hRC;
|
GLXContext hRC;
|
||||||
XSetWindowAttributes attributes;
|
XSetWindowAttributes attributes;
|
||||||
bool doubleBuffered;
|
bool doubleBuffered;
|
||||||
XF86VidModeModeInfo vidMode;
|
//XF86VidModeModeInfo vidMode;
|
||||||
int x, y;
|
int x, y;
|
||||||
Display* display;
|
Display* display;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ namespace OpenArena
|
|||||||
{
|
{
|
||||||
Level::Level()
|
Level::Level()
|
||||||
{
|
{
|
||||||
|
_window = NULL;
|
||||||
textureNames = NULL;
|
textureNames = NULL;
|
||||||
numTextures = 0;
|
numTextures = 0;
|
||||||
textures = NULL;
|
textures = NULL;
|
||||||
@@ -432,11 +433,15 @@ namespace OpenArena
|
|||||||
|
|
||||||
void Level::LoadGLTextures()
|
void Level::LoadGLTextures()
|
||||||
{
|
{
|
||||||
|
printf("In LoadGLTextures: _window = %d\n", _window);
|
||||||
/*GLfloat light[4] = {1.0f,1.0f,1.0f,0.5f};
|
if(_window != NULL)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
GLfloat light[4] = {1.0f,1.0f,1.0f,0.5f};
|
||||||
glLightfv(GL_LIGHT1, GL_AMBIENT, light);
|
glLightfv(GL_LIGHT1, GL_AMBIENT, light);
|
||||||
glEnable(GL_LIGHT1);
|
glEnable(GL_LIGHT1);
|
||||||
glEnable(GL_LIGHTING);*/
|
glEnable(GL_LIGHTING);
|
||||||
|
*/
|
||||||
|
|
||||||
if(textures != NULL)
|
if(textures != NULL)
|
||||||
{
|
{
|
||||||
@@ -456,8 +461,11 @@ namespace OpenArena
|
|||||||
|
|
||||||
//Load the console background image
|
//Load the console background image
|
||||||
if(!menuTextures[GL_MY_TEXTURE_CONSOLEBACKGROUND].Load(gamedir + "textures/menu/con_back.tga"))
|
if(!menuTextures[GL_MY_TEXTURE_CONSOLEBACKGROUND].Load(gamedir + "textures/menu/con_back.tga"))
|
||||||
|
{
|
||||||
menuTextures[GL_MY_TEXTURE_CONSOLEBACKGROUND].Load("oa/textures/menu/con_back.bmp");
|
menuTextures[GL_MY_TEXTURE_CONSOLEBACKGROUND].Load("oa/textures/menu/con_back.bmp");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint32 Level::FPS()
|
uint32 Level::FPS()
|
||||||
{
|
{
|
||||||
@@ -1222,4 +1230,14 @@ namespace OpenArena
|
|||||||
}
|
}
|
||||||
consoleOutput[0] = line;
|
consoleOutput[0] = line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Level::SetWindow(Window* window)
|
||||||
|
{
|
||||||
|
_window = window;
|
||||||
|
}
|
||||||
|
|
||||||
|
Window* Level::GetWindow()
|
||||||
|
{
|
||||||
|
return _window;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -145,6 +145,8 @@ int main(int argc, char** argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
level.SetWindow(g_Screen);
|
||||||
|
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
while(XPending(g_Screen.GetDisplay()) > 0)
|
while(XPending(g_Screen.GetDisplay()) > 0)
|
||||||
|
|||||||
@@ -145,6 +145,9 @@ int main(int argc, char** argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
level.SetWindow(&g_Screen);
|
||||||
|
level.LoadGLTextures();
|
||||||
|
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
while(XPending(g_Screen.GetDisplay()) > 0)
|
while(XPending(g_Screen.GetDisplay()) > 0)
|
||||||
|
|||||||
@@ -71,7 +71,9 @@ namespace OpenArena
|
|||||||
{
|
{
|
||||||
if(Loaded())
|
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;
|
minFilter = GL_LINEAR;
|
||||||
magFilter = GL_LINEAR;
|
magFilter = GL_LINEAR;
|
||||||
filename = "";
|
filename = "";
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ void OpenArena::Window::Close()
|
|||||||
|
|
||||||
if(_fullscreen)
|
if(_fullscreen)
|
||||||
{
|
{
|
||||||
XF86VidModeSwitchToMode(display, screen, &vidMode);
|
// XF86VidModeSwitchToMode(display, screen, &vidMode);
|
||||||
XF86VidModeSetViewPort(display, screen, 0, 0);
|
// XF86VidModeSetViewPort(display, screen, 0, 0);
|
||||||
}
|
}
|
||||||
XCloseDisplay(display);
|
XCloseDisplay(display);
|
||||||
}
|
}
|
||||||
@@ -222,27 +222,27 @@ bool OpenArena::Window::Open()
|
|||||||
int glxMajorVersion;
|
int glxMajorVersion;
|
||||||
int glxMinorVersion;
|
int glxMinorVersion;
|
||||||
int modeNum;
|
int modeNum;
|
||||||
XF86VidModeModeInfo** modes;
|
// XF86VidModeModeInfo** modes;
|
||||||
Atom wmDelete;
|
Atom wmDelete;
|
||||||
::Window winDummy;
|
::Window winDummy;
|
||||||
unsigned int borderDummy;
|
unsigned int borderDummy;
|
||||||
|
|
||||||
display = XOpenDisplay(0);
|
display = XOpenDisplay(0);
|
||||||
screen = DefaultScreen(display);
|
screen = DefaultScreen(display);
|
||||||
XF86VidModeQueryVersion(display, &vidModeMajorVersion, &vidModeMinorVersion);
|
//XF86VidModeQueryVersion(display, &vidModeMajorVersion, &vidModeMinorVersion);
|
||||||
printf("XF86VidModeExtension-Version %d.%d\n", vidModeMajorVersion, vidModeMinorVersion);
|
//printf("XF86VidModeExtension-Version %d.%d\n", vidModeMajorVersion, vidModeMinorVersion);
|
||||||
|
|
||||||
XF86VidModeGetAllModeLines(display, screen, &modeNum, &modes);
|
//XF86VidModeGetAllModeLines(display, screen, &modeNum, &modes);
|
||||||
vidMode = *modes[0];
|
//vidMode = *modes[0];
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<modeNum; i++)
|
for(i=0; i<modeNum; i++)
|
||||||
{
|
{
|
||||||
//Add a check for colordepth here
|
//Add a check for colordepth here
|
||||||
if((modes[i]->hdisplay == _width) && (modes[i]->vdisplay == _height))
|
// if((modes[i]->hdisplay == _width) && (modes[i]->vdisplay == _height))
|
||||||
{
|
// {
|
||||||
bestMode = i;
|
// bestMode = i;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
vi = glXChooseVisual(display, screen, attrListDbl);
|
vi = glXChooseVisual(display, screen, attrListDbl);
|
||||||
@@ -274,9 +274,9 @@ bool OpenArena::Window::Open()
|
|||||||
|
|
||||||
if(_fullscreen)
|
if(_fullscreen)
|
||||||
{
|
{
|
||||||
XF86VidModeSwitchToMode(display, screen, modes[bestMode]);
|
// XF86VidModeSwitchToMode(display, screen, modes[bestMode]);
|
||||||
XF86VidModeSetViewPort(display, screen, 0, 0);
|
// XF86VidModeSetViewPort(display, screen, 0, 0);
|
||||||
XFree(modes);
|
// XFree(modes);
|
||||||
|
|
||||||
attributes.override_redirect = true;
|
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);
|
window = XCreateWindow(display, RootWindow(display, vi->screen), 0, 0, _width, _height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect, &attributes);
|
||||||
|
|||||||
@@ -257,6 +257,8 @@ int WINAPI WinMain( HINSTANCE hInstance,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
level.SetWindow(g_Screen);
|
||||||
|
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
while (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
|
while (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
|
||||||
|
|||||||
Reference in New Issue
Block a user