Changed Maneuvered code to use new config preprocessor macros
This commit is contained in:
296
src/window.cpp
296
src/window.cpp
@@ -1,54 +1,32 @@
|
|||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
#ifdef __linux
|
|
||||||
void OpenArena::Window::SwapBuffers()
|
void OpenArena::Window::SwapBuffers()
|
||||||
{
|
{
|
||||||
|
#if defined USE_GLX
|
||||||
if(doubleBuffered)
|
if(doubleBuffered)
|
||||||
{
|
{
|
||||||
glXSwapBuffers(display, window);
|
glXSwapBuffers(display, window);
|
||||||
}
|
}
|
||||||
}
|
#elif defined USE_AGL
|
||||||
#endif
|
aglSwapBuffers(aglContext);
|
||||||
#ifdef __APPLE__
|
#elif defined USE_CGL
|
||||||
void OpenArena::Window::SwapBuffers()
|
CGLFlushDrawable(cglContext);
|
||||||
{
|
#elif defined USE_WGL
|
||||||
if(doubleBuffered)
|
|
||||||
{
|
|
||||||
glXSwapBuffers(display, window);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef WIN32
|
|
||||||
void OpenArena::Window::SwapBuffers()
|
|
||||||
{
|
|
||||||
::SwapBuffers(deviceContext);
|
::SwapBuffers(deviceContext);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __linux
|
|
||||||
void OpenArena::Window::Close()
|
void OpenArena::Window::Close()
|
||||||
{
|
{
|
||||||
if(hRC)
|
#if defined USE_GLX
|
||||||
{
|
|
||||||
if(!glXMakeCurrent(display, None, NULL))
|
|
||||||
{
|
|
||||||
printf("Could not release drawing context.\n");
|
|
||||||
}
|
|
||||||
glXDestroyContext(display, hRC);
|
|
||||||
hRC = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(_fullscreen)
|
if(_fullscreen)
|
||||||
{
|
{
|
||||||
|
#if defined HAVE_XF86VIDMODE
|
||||||
XF86VidModeSwitchToMode(display, screen, &vidMode);
|
XF86VidModeSwitchToMode(display, screen, &vidMode);
|
||||||
XF86VidModeSetViewPort(display, screen, 0, 0);
|
XF86VidModeSetViewPort(display, screen, 0, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
XCloseDisplay(display);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef __APPLE__
|
|
||||||
void OpenArena::Window::Close()
|
|
||||||
{
|
|
||||||
if(hRC)
|
if(hRC)
|
||||||
{
|
{
|
||||||
if(!glXMakeCurrent(display, None, NULL))
|
if(!glXMakeCurrent(display, None, NULL))
|
||||||
@@ -59,26 +37,19 @@ void OpenArena::Window::Close()
|
|||||||
hRC = NULL;
|
hRC = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XCloseDisplay(display);
|
||||||
|
#elif defined USE_AGL
|
||||||
|
#elif defined USE_CGL
|
||||||
|
#elif defined USE_WGL
|
||||||
if(_fullscreen)
|
if(_fullscreen)
|
||||||
{
|
|
||||||
// XF86VidModeSwitchToMode(display, screen, &vidMode);
|
|
||||||
// XF86VidModeSetViewPort(display, screen, 0, 0);
|
|
||||||
}
|
|
||||||
XCloseDisplay(display);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef WIN32
|
|
||||||
void OpenArena::Window::Close()
|
|
||||||
{
|
|
||||||
if (_fullscreen)
|
|
||||||
{
|
{
|
||||||
ChangeDisplaySettings(NULL, 0);
|
ChangeDisplaySettings(NULL, 0);
|
||||||
ShowCursor(true/*false*/);
|
ShowCursor(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (glContext)
|
if(glContext)
|
||||||
{
|
{
|
||||||
if (!wglMakeCurrent(NULL, NULL))
|
if(!wglMakeCurrent(NULL, NULL))
|
||||||
MessageBox(NULL,"Release Of DC And RC Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
|
MessageBox(NULL,"Release Of DC And RC Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
|
||||||
|
|
||||||
if (!wglDeleteContext(glContext))
|
if (!wglDeleteContext(glContext))
|
||||||
@@ -104,13 +75,14 @@ void OpenArena::Window::Close()
|
|||||||
MessageBox(NULL,"Could Not Unregister Class.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
|
MessageBox(NULL,"Could Not Unregister Class.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
|
||||||
instance=NULL;
|
instance=NULL;
|
||||||
}
|
}
|
||||||
}//End OpenArena::Window::Close()
|
#endif
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __linux
|
|
||||||
bool OpenArena::Window::Open()
|
bool OpenArena::Window::Open()
|
||||||
{
|
{
|
||||||
XVisualInfo* vi;
|
#if defined USE_GLX
|
||||||
|
XVisualInfo* vi;
|
||||||
Colormap cmap;
|
Colormap cmap;
|
||||||
int bestMode = 0;
|
int bestMode = 0;
|
||||||
int vidModeMajorVersion;
|
int vidModeMajorVersion;
|
||||||
@@ -118,13 +90,17 @@ bool OpenArena::Window::Open()
|
|||||||
int glxMajorVersion;
|
int glxMajorVersion;
|
||||||
int glxMinorVersion;
|
int glxMinorVersion;
|
||||||
int modeNum;
|
int modeNum;
|
||||||
|
#if defined HAVE_XF86VIDMODE
|
||||||
XF86VidModeModeInfo** modes;
|
XF86VidModeModeInfo** modes;
|
||||||
|
#endif
|
||||||
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);
|
||||||
|
|
||||||
|
#if defined HAVE_XF86VIDMODE
|
||||||
XF86VidModeQueryVersion(display, &vidModeMajorVersion, &vidModeMinorVersion);
|
XF86VidModeQueryVersion(display, &vidModeMajorVersion, &vidModeMinorVersion);
|
||||||
printf("XF86VidModeExtension-Version %d.%d\n", vidModeMajorVersion, vidModeMinorVersion);
|
printf("XF86VidModeExtension-Version %d.%d\n", vidModeMajorVersion, vidModeMinorVersion);
|
||||||
|
|
||||||
@@ -140,9 +116,10 @@ bool OpenArena::Window::Open()
|
|||||||
bestMode = i;
|
bestMode = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
vi = glXChooseVisual(display, screen, attrListDbl);
|
vi = glXChooseVisual(display, screen, attrListDbl);
|
||||||
if(vi == NULL)
|
if(vi == NULL){
|
||||||
vi = glXChooseVisual(display, screen, attrListSgl);
|
vi = glXChooseVisual(display, screen, attrListSgl);
|
||||||
doubleBuffered = false;
|
doubleBuffered = false;
|
||||||
printf("Only Singlebuffered Visual!\n");
|
printf("Only Singlebuffered Visual!\n");
|
||||||
@@ -169,9 +146,11 @@ bool OpenArena::Window::Open()
|
|||||||
|
|
||||||
if(_fullscreen)
|
if(_fullscreen)
|
||||||
{
|
{
|
||||||
|
#if defined HAVE_XF86VIDMODE
|
||||||
XF86VidModeSwitchToMode(display, screen, modes[bestMode]);
|
XF86VidModeSwitchToMode(display, screen, modes[bestMode]);
|
||||||
XF86VidModeSetViewPort(display, screen, 0, 0);
|
XF86VidModeSetViewPort(display, screen, 0, 0);
|
||||||
XFree(modes);
|
XFree(modes);
|
||||||
|
#endif
|
||||||
|
|
||||||
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);
|
||||||
@@ -209,116 +188,9 @@ bool OpenArena::Window::Open()
|
|||||||
}
|
}
|
||||||
_initializer->Initialize();
|
_initializer->Initialize();
|
||||||
return true;
|
return true;
|
||||||
}
|
#elif defined USE_AGL
|
||||||
#endif
|
#elif defined USE_CGL
|
||||||
#ifdef __APPLE__
|
#elif defined USE_WGL
|
||||||
bool OpenArena::Window::Open()
|
|
||||||
{
|
|
||||||
XVisualInfo* vi;
|
|
||||||
Colormap cmap;
|
|
||||||
int bestMode = 0;
|
|
||||||
int vidModeMajorVersion;
|
|
||||||
int vidModeMinorVersion;
|
|
||||||
int glxMajorVersion;
|
|
||||||
int glxMinorVersion;
|
|
||||||
int modeNum;
|
|
||||||
// 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);
|
|
||||||
|
|
||||||
//XF86VidModeGetAllModeLines(display, screen, &modeNum, &modes);
|
|
||||||
//vidMode = *modes[0];
|
|
||||||
|
|
||||||
int i;
|
|
||||||
for(i=0; i<modeNum; i++)
|
|
||||||
{
|
|
||||||
//Add a check for colordepth here
|
|
||||||
// if((modes[i]->hdisplay == _width) && (modes[i]->vdisplay == _height))
|
|
||||||
// {
|
|
||||||
// bestMode = i;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
vi = glXChooseVisual(display, screen, attrListDbl);
|
|
||||||
if(vi == NULL)
|
|
||||||
{
|
|
||||||
vi = glXChooseVisual(display, screen, attrListSgl);
|
|
||||||
doubleBuffered = false;
|
|
||||||
printf("Only Singlebuffered Visual!\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
doubleBuffered = true;
|
|
||||||
printf("Got Doublebuffered Visual!\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
glXQueryVersion(display, &glxMajorVersion, & glxMinorVersion);
|
|
||||||
printf("glX-Version %d.%d\n", glxMajorVersion, glxMinorVersion);
|
|
||||||
|
|
||||||
hRC = glXCreateContext(display, vi, 0, GL_TRUE);
|
|
||||||
cmap = XCreateColormap(display, RootWindow(display, vi->screen), vi->visual, AllocNone);
|
|
||||||
attributes.colormap = cmap;
|
|
||||||
attributes.border_pixel = 0;
|
|
||||||
|
|
||||||
attributes.event_mask = ExposureMask |
|
|
||||||
KeyPressMask | KeyReleaseMask |
|
|
||||||
ButtonPressMask | ButtonReleaseMask |
|
|
||||||
// PointerMotionMask | ButtonMotionMask |
|
|
||||||
StructureNotifyMask;
|
|
||||||
|
|
||||||
if(_fullscreen)
|
|
||||||
{
|
|
||||||
// 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);
|
|
||||||
XWarpPointer(display, None, window, 0, 0, 0, 0, 0, 0);
|
|
||||||
XMapRaised(display, window);
|
|
||||||
XGrabKeyboard(display, window, true, GrabModeAsync, GrabModeAsync, CurrentTime);
|
|
||||||
XGrabPointer(display, window, true, ButtonPressMask, GrabModeAsync, GrabModeAsync, window, None, CurrentTime);
|
|
||||||
XDefineCursor(display, window, CreateFullscreenCursor());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
window = XCreateWindow(display, RootWindow(display, vi->screen), 0, 0, _width, _height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap | CWEventMask, &attributes);
|
|
||||||
wmDelete = XInternAtom(display, "WM_DELETE_WINDOW", true);
|
|
||||||
XSetWMProtocols(display, window, &wmDelete, 1);
|
|
||||||
XSetStandardProperties(display, window, GetName(), GetName(), None, NULL, 0, NULL);
|
|
||||||
XMapRaised(display, window);
|
|
||||||
XDefineCursor(display, window, CreateWindowedCursor());
|
|
||||||
}
|
|
||||||
|
|
||||||
glXMakeCurrent(display, window, hRC);
|
|
||||||
unsigned int twidth, theight, depth;
|
|
||||||
XGetGeometry(display, window, &winDummy, &x, &y, &twidth, &theight, &borderDummy, &depth);
|
|
||||||
_colorDepth = (char)depth;
|
|
||||||
_height = (short)twidth;
|
|
||||||
_width = (short)theight;
|
|
||||||
printf("Resolution %dx%d\n", twidth, theight);
|
|
||||||
printf("Depth %d\n", depth);
|
|
||||||
if(glXIsDirect(display, hRC))
|
|
||||||
{
|
|
||||||
printf("Congrats, you have Direct Rendering!\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("Sorry, no Direct Rendering possible!\n");
|
|
||||||
}
|
|
||||||
_initializer->Initialize();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef WIN32
|
|
||||||
bool OpenArena::Window::Open()
|
|
||||||
{
|
|
||||||
unsigned int PixelFormat;
|
unsigned int PixelFormat;
|
||||||
WNDCLASS wc;
|
WNDCLASS wc;
|
||||||
DWORD dwExStyle;
|
DWORD dwExStyle;
|
||||||
@@ -443,8 +315,8 @@ bool OpenArena::Window::Open()
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
bool OpenArena::Window::Open(string title, int width, int height, int bits, bool fullscreenflag)
|
bool OpenArena::Window::Open(string title, int width, int height, int bits, bool fullscreenflag)
|
||||||
{
|
{
|
||||||
@@ -512,23 +384,9 @@ void OpenArena::Window::Resize(GLsizei width, GLsizei height)
|
|||||||
_resizer->Resize(width, height);
|
_resizer->Resize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __linux
|
OpenArena::Vec2i OpenArena::Window::GetMousePosition()
|
||||||
Display* OpenArena::Window::GetDisplay()
|
|
||||||
{
|
|
||||||
return display;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
Display* OpenArena::Window::GetDisplay()
|
|
||||||
{
|
|
||||||
return display;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __linux
|
|
||||||
Vec2i OpenArena::Window::GetMousePosition()
|
|
||||||
{
|
{
|
||||||
|
#ifdef USE_GLX
|
||||||
::Window rootWindow;
|
::Window rootWindow;
|
||||||
::Window childWindow;
|
::Window childWindow;
|
||||||
int rootX;
|
int rootX;
|
||||||
@@ -544,59 +402,32 @@ Vec2i OpenArena::Window::GetMousePosition()
|
|||||||
{
|
{
|
||||||
return Vec2i(mouseX, mouseY);
|
return Vec2i(mouseX, mouseY);
|
||||||
}
|
}
|
||||||
}
|
#elif USE_AGL
|
||||||
#endif
|
#elif USE_CGL
|
||||||
#ifdef __APPLE__
|
POINT pos;
|
||||||
OpenArena::Vec2i OpenArena::Window::GetMousePosition()
|
|
||||||
{
|
|
||||||
::Window rootWindow;
|
|
||||||
::Window childWindow;
|
|
||||||
int rootX;
|
|
||||||
int rootY;
|
|
||||||
int mouseX;
|
|
||||||
int mouseY;
|
|
||||||
unsigned int mask;
|
|
||||||
if(!XQueryPointer(display, window, &rootWindow, &childWindow, &rootX, &rootY, &mouseX, &mouseY, &mask))
|
|
||||||
{
|
|
||||||
return Vec2i(-1,-1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return Vec2i(mouseX, mouseY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef WIN32
|
|
||||||
OpenArena::Vec2i OpenArena::Window::GetMousePosition()
|
|
||||||
{
|
|
||||||
POINT pos;
|
|
||||||
GetCursorPos(&pos);
|
GetCursorPos(&pos);
|
||||||
return Vec2i(pos.x, pos.y);
|
return Vec2i(pos.x, pos.y);
|
||||||
|
#elif USE_WGL
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __linux
|
|
||||||
void OpenArena::Window::SetMousePosition(Vec2i pos)
|
|
||||||
{
|
|
||||||
Vec2i middle = Vec2i(_width, _height)/2;
|
|
||||||
XWarpPointer(display, None, window, 0, 0, 0, 0, middle.x, middle.y);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef __APPLE__
|
|
||||||
void OpenArena::Window::SetMousePosition(Vec2i pos)
|
|
||||||
{
|
|
||||||
Vec2i middle = Vec2i(_width, _height)/2;
|
|
||||||
XWarpPointer(display, None, window, 0, 0, 0, 0, middle.x, middle.y);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef WIN32
|
|
||||||
void OpenArena::Window::SetMousePosition(Vec2i pos)
|
void OpenArena::Window::SetMousePosition(Vec2i pos)
|
||||||
{
|
{
|
||||||
|
#if defined USE_GLX
|
||||||
|
XWarpPointer(display, None, window, 0, 0, 0, 0, pos.x, pos.y);
|
||||||
|
#elif defined USE_AGL
|
||||||
|
#elif defined USE_CGL
|
||||||
|
#elif defined USE_WGL
|
||||||
SetCursorPos(pos.x, pos.y);
|
SetCursorPos(pos.x, pos.y);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef USE_GLX
|
||||||
|
Display* OpenArena::Window::GetDisplay()
|
||||||
|
{
|
||||||
|
return display;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __linux
|
|
||||||
Cursor OpenArena::Window::CreateWindowedCursor()
|
Cursor OpenArena::Window::CreateWindowedCursor()
|
||||||
{
|
{
|
||||||
return CreateFullscreenCursor();
|
return CreateFullscreenCursor();
|
||||||
@@ -614,22 +445,3 @@ Cursor OpenArena::Window::CreateFullscreenCursor()
|
|||||||
return cur;
|
return cur;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef __APPLE__
|
|
||||||
Cursor OpenArena::Window::CreateWindowedCursor()
|
|
||||||
{
|
|
||||||
return CreateFullscreenCursor();
|
|
||||||
}
|
|
||||||
|
|
||||||
Cursor OpenArena::Window::CreateFullscreenCursor()
|
|
||||||
{
|
|
||||||
Pixmap pixmap = XCreatePixmap(display, window, 1, 1, 1);
|
|
||||||
XColor color;
|
|
||||||
color.pixel = 0;
|
|
||||||
color.red = 0;
|
|
||||||
color.flags = DoRed;
|
|
||||||
Cursor cur = XCreatePixmapCursor(display, pixmap, pixmap, &color, &color, 0, 0);
|
|
||||||
XFreePixmap(display, pixmap);
|
|
||||||
return cur;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|||||||
110
src/window.h
110
src/window.h
@@ -1,28 +1,35 @@
|
|||||||
#ifndef __window_h__
|
#ifndef __window_h__
|
||||||
#define __window_h__
|
#define __window_h__
|
||||||
|
|
||||||
#include "screen.h"
|
#if defined HAVE_CONFIG_H
|
||||||
#ifdef __linux
|
#include "config.h"
|
||||||
#include <GL/gl.h>
|
|
||||||
#include <GL/glx.h>
|
|
||||||
#include <X11/extensions/xf86vmode.h>
|
|
||||||
#include <X11/keysym.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#include "screen.h"
|
||||||
#include <GL/gl.h>
|
|
||||||
#include <GL/glu.h>
|
#if defined USE_GLX
|
||||||
#include <GL/glx.h>
|
#include <GL/gl.h>
|
||||||
#include <X11/Xlib.h>
|
#include <GL/glu.h> //maybe not necessary
|
||||||
#include <X11/Xutil.h>
|
#include <GL/glx.h>
|
||||||
//#include <X11/extensions/xf86vmode.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/Xutil.h>
|
||||||
|
#include <X11/keysym.h>
|
||||||
|
#if defined HAVE_XF86VIDMODE
|
||||||
|
#include <X11/extensions/xf86vmode.h>
|
||||||
|
#endif
|
||||||
|
#elif defined USE_AGL
|
||||||
|
#include <AGL/agl.h>
|
||||||
|
#include <OpenGL/gl.h>
|
||||||
|
#elif defined USE_CGL
|
||||||
|
#include <OpenGL/OpenGL.h>
|
||||||
|
#include <OpenGL/gl.h>
|
||||||
|
#elif defined USE_WGL
|
||||||
|
#include <windows.h>
|
||||||
|
#include <GL/gl.h>
|
||||||
|
#include <GL/glu.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <windows.h>
|
|
||||||
#include <GL/gl.h>
|
|
||||||
#include <GL/glu.h>
|
|
||||||
#endif
|
#endif
|
||||||
#include "vector.h"
|
#include "vector.h"
|
||||||
|
|
||||||
@@ -353,49 +360,38 @@ namespace OpenArena
|
|||||||
*/
|
*/
|
||||||
void SetMousePosition(Vec2i pos);
|
void SetMousePosition(Vec2i pos);
|
||||||
|
|
||||||
#ifdef __linux
|
#ifdef USE_GLX
|
||||||
Display* GetDisplay();
|
Display* GetDisplay();
|
||||||
|
|
||||||
private:
|
|
||||||
Cursor CreateWindowedCursor();
|
|
||||||
Cursor CreateFullscreenCursor();
|
|
||||||
int screen;
|
|
||||||
::Window window;
|
|
||||||
GLXContext hRC;
|
|
||||||
XSetWindowAttributes attributes;
|
|
||||||
bool doubleBuffered;
|
|
||||||
XF86VidModeModeInfo vidMode;
|
|
||||||
int x, y;
|
|
||||||
Display* display;
|
|
||||||
#endif
|
|
||||||
#ifdef __APPLE__
|
|
||||||
Display* GetDisplay();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Cursor CreateWindowedCursor();
|
|
||||||
Cursor CreateFullscreenCursor();
|
|
||||||
int screen;
|
|
||||||
::Window window;
|
|
||||||
GLXContext hRC;
|
|
||||||
XSetWindowAttributes attributes;
|
|
||||||
bool doubleBuffered;
|
|
||||||
//XF86VidModeModeInfo vidMode;
|
|
||||||
int x, y;
|
|
||||||
Display* display;
|
|
||||||
#endif
|
#endif
|
||||||
private:
|
private:
|
||||||
|
#ifdef USE_GLX
|
||||||
|
Cursor CreateWindowedCursor();
|
||||||
|
Cursor CreateFullscreenCursor();
|
||||||
|
int screen;
|
||||||
|
::Window window;
|
||||||
|
GLXContext hRC;
|
||||||
|
XSetWindowAttributes attributes;
|
||||||
|
bool doubleBuffered;
|
||||||
|
#if defined HAVE_XF86VIDMODE
|
||||||
|
XF86VidModeModeInfo vidMode;
|
||||||
|
#endif
|
||||||
|
int x, y;
|
||||||
|
Display* display;
|
||||||
|
#elif defined USE_WGL
|
||||||
|
HGLRC glContext;
|
||||||
|
HWND window;
|
||||||
|
HDC deviceContext;
|
||||||
|
HINSTANCE instance;
|
||||||
|
#endif
|
||||||
Resizer* _resizer;
|
Resizer* _resizer;
|
||||||
Initializer* _initializer;
|
Initializer* _initializer;
|
||||||
#ifdef WIN32
|
|
||||||
HGLRC glContext;
|
|
||||||
HWND window;
|
|
||||||
HDC deviceContext;
|
|
||||||
HINSTANCE instance;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef WIN32
|
#if defined USE_GLX
|
||||||
|
static int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 4, GLX_GREEN_SIZE, 4, GLX_BLUE_SIZE, 4, GLX_DEPTH_SIZE, 16, None};
|
||||||
|
static int attrListDbl[] = {GLX_RGBA, GLX_DOUBLEBUFFER, GLX_RED_SIZE, 4, GLX_GREEN_SIZE, 4, GLX_BLUE_SIZE, 4, GLX_DEPTH_SIZE, 16, None};
|
||||||
|
#elif defined USE_WGL
|
||||||
/*!
|
/*!
|
||||||
* \brief
|
* \brief
|
||||||
* Write brief comment for WndProc here.
|
* Write brief comment for WndProc here.
|
||||||
@@ -428,13 +424,5 @@ namespace OpenArena
|
|||||||
*/
|
*/
|
||||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||||
#endif
|
#endif
|
||||||
#ifdef __linux
|
|
||||||
static int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 4, GLX_GREEN_SIZE, 4, GLX_BLUE_SIZE, 4, GLX_DEPTH_SIZE, 16, None};
|
|
||||||
static int attrListDbl[] = {GLX_RGBA, GLX_DOUBLEBUFFER, GLX_RED_SIZE, 4, GLX_GREEN_SIZE, 4, GLX_BLUE_SIZE, 4, GLX_DEPTH_SIZE, 16, None};
|
|
||||||
#endif
|
|
||||||
#ifdef __APPLE__
|
|
||||||
static int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 4, GLX_GREEN_SIZE, 4, GLX_BLUE_SIZE, 4, GLX_DEPTH_SIZE, 16, None};
|
|
||||||
static int attrListDbl[] = {GLX_RGBA, GLX_DOUBLEBUFFER, GLX_RED_SIZE, 4, GLX_GREEN_SIZE, 4, GLX_BLUE_SIZE, 4, GLX_DEPTH_SIZE, 16, None};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user