2010-09-01 10:28:37 +00:00
|
|
|
/* ZZ Open GL graphics plugin
|
|
|
|
* Copyright (c)2009-2010 zeydlitz@gmail.com, arcum42@gmail.com
|
|
|
|
* Based on Zerofrog's ZeroGS KOSMOS (c)2005-2008
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2010-09-06 12:23:45 +00:00
|
|
|
#ifndef GLWIN_H_INCLUDED
|
|
|
|
#define GLWIN_H_INCLUDED
|
|
|
|
|
2010-09-01 10:28:37 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
#define GL_WIN32_WINDOW
|
|
|
|
#else
|
|
|
|
#define GL_X11_WINDOW
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#undef CreateWindow // Undo Windows.h global namespace pollution
|
|
|
|
|
2010-11-14 01:38:10 +00:00
|
|
|
extern void SetDeviceSize(int nNewWidth, int nNewHeight);
|
|
|
|
extern void OnFKey(int key, int shift);
|
|
|
|
|
2010-09-01 10:28:37 +00:00
|
|
|
class GLWindow
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
#ifdef GL_X11_WINDOW
|
|
|
|
Display *glDisplay;
|
|
|
|
GLXContext context;
|
|
|
|
XVisualInfo *vi;
|
|
|
|
|
|
|
|
Window glWindow;
|
|
|
|
XSetWindowAttributes attr;
|
|
|
|
|
|
|
|
bool CreateVisual();
|
|
|
|
void GetGLXVersion();
|
|
|
|
void GetWindowSize();
|
2010-09-05 15:47:09 +00:00
|
|
|
void UpdateGrabKey();
|
2010-09-08 11:16:27 +00:00
|
|
|
void Force43Ratio();
|
2012-04-29 18:50:07 +00:00
|
|
|
bool CreateContextGL(int, int);
|
2011-06-12 14:48:36 +00:00
|
|
|
void CreateContextGL();
|
2010-09-01 10:28:37 +00:00
|
|
|
#endif
|
|
|
|
bool fullScreen, doubleBuffered;
|
|
|
|
u32 width, height, depth;
|
|
|
|
|
|
|
|
public:
|
2010-11-10 11:15:48 +00:00
|
|
|
char title[256];
|
2010-11-14 01:38:10 +00:00
|
|
|
Size backbuffer;
|
2010-11-10 11:15:48 +00:00
|
|
|
|
2010-09-01 10:28:37 +00:00
|
|
|
void SwapGLBuffers();
|
|
|
|
bool ReleaseContext();
|
2010-09-05 15:47:09 +00:00
|
|
|
|
|
|
|
#ifdef GL_X11_WINDOW
|
|
|
|
void ToggleFullscreen();
|
|
|
|
#endif
|
2010-09-01 10:28:37 +00:00
|
|
|
|
|
|
|
bool CreateWindow(void *pDisplay);
|
|
|
|
void CloseWindow();
|
|
|
|
bool DisplayWindow(int _width, int _height);
|
|
|
|
void SetTitle(char *strtitle);
|
|
|
|
void ResizeCheck();
|
2010-11-09 12:04:07 +00:00
|
|
|
void ProcessEvents();
|
2010-11-14 01:38:10 +00:00
|
|
|
|
|
|
|
void UpdateWindowSize(int nNewWidth, int nNewHeight)
|
|
|
|
{
|
|
|
|
FUNCLOG
|
|
|
|
backbuffer.w = std::max(nNewWidth, 16);
|
|
|
|
backbuffer.h = std::max(nNewHeight, 16);
|
2010-09-01 10:28:37 +00:00
|
|
|
|
2010-11-14 01:38:10 +00:00
|
|
|
if (!(conf.fullscreen()))
|
|
|
|
{
|
|
|
|
conf.width = nNewWidth;
|
|
|
|
conf.height = nNewHeight;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2010-09-05 15:47:09 +00:00
|
|
|
|
2010-09-06 12:23:45 +00:00
|
|
|
extern GLWindow GLWin;
|
|
|
|
|
|
|
|
#endif // GLWIN_H_INCLUDED
|