Changed: Partially abstracted the windows version of OpenArena::Window CreateGLWindow and KillGLWindow are now part of the Window class ResizeGLScene and InitGL are now callbacks
This commit is contained in:
@@ -43,8 +43,8 @@ static float currentTime;
|
|||||||
|
|
||||||
void InitControls(); // Sets up player controls
|
void InitControls(); // Sets up player controls
|
||||||
int InitGL(); // All setup for OpenGL goes here
|
int InitGL(); // All setup for OpenGL goes here
|
||||||
GLvoid ReSizeGLScene(GLsizei width, GLsizei height); // Resize and initialize the GL window
|
void ReSizeGLScene(GLsizei width, GLsizei height); // Resize and initialize the GL window
|
||||||
GLvoid KillGLWindow(GLvoid); //Properly kill the window
|
|
||||||
bool CreateGLWindow(string title, int width, int height, int bits, bool fullscreenflag);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -18,9 +18,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
//These three are windows specific
|
//These this is windows specific
|
||||||
static HDC hDC=NULL; // Private GDI device context
|
|
||||||
static HGLRC hRC=NULL; // Permanent rendering context
|
|
||||||
static HINSTANCE hInstance; // Application instance
|
static HINSTANCE hInstance; // Application instance
|
||||||
#endif
|
#endif
|
||||||
extern OpenArena::Window g_Screen;
|
extern OpenArena::Window g_Screen;
|
||||||
|
|||||||
@@ -3,17 +3,26 @@
|
|||||||
|
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#ifdef __linux
|
#ifdef __linux
|
||||||
|
#include <GL/gl.h>
|
||||||
#include <GL/glx.h>
|
#include <GL/glx.h>
|
||||||
#include <X11/extensions/xf86vmode.h>
|
#include <X11/extensions/xf86vmode.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#include <GL/gl.h>
|
||||||
|
#include <GL/glu.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace OpenArena
|
namespace OpenArena
|
||||||
{
|
{
|
||||||
|
typedef void (*ResizeFunc)(GLsizei width, GLsizei height);
|
||||||
|
typedef int (*InitFunc)();
|
||||||
|
|
||||||
class Window: public SCREEN
|
class Window: public SCREEN
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#ifdef __linux
|
#ifdef __linux
|
||||||
Display* display;
|
Display* display;
|
||||||
int screen;
|
int screen;
|
||||||
::Window window;
|
::Window window;
|
||||||
@@ -22,8 +31,38 @@ namespace OpenArena
|
|||||||
bool doubleBuffered;
|
bool doubleBuffered;
|
||||||
XF86VidModeModeInfo vidMode;
|
XF86VidModeModeInfo vidMode;
|
||||||
int x, y;
|
int x, y;
|
||||||
#endif
|
private:
|
||||||
|
#endif
|
||||||
|
#ifdef WIN32
|
||||||
|
HGLRC glContext;
|
||||||
|
HWND window;
|
||||||
|
private:
|
||||||
|
HDC deviceContext;
|
||||||
|
HINSTANCE instance;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
Window();
|
||||||
|
~Window();
|
||||||
|
void Close();
|
||||||
|
bool Open();
|
||||||
|
bool Open(string title, int width, int height, int bits, bool fullscreenflag); //make that string a const char* after this works
|
||||||
|
void SetOnInit(InitFunc function);
|
||||||
|
void SetOnResize(ResizeFunc function);
|
||||||
|
void SwapBuffers();
|
||||||
|
|
||||||
|
private:
|
||||||
|
ResizeFunc OnResize;
|
||||||
|
InitFunc OnInit;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void DefaultResize(GLsizei width, GLsizei height);
|
||||||
|
int DefaultInit();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user