add LowLevelWindow
This commit is contained in:
@@ -24,6 +24,9 @@
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "StepMania.h"
|
||||
|
||||
#include "arch/arch.h"
|
||||
#include "arch/LowLevelWindow/LowLevelWindow.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
RageDisplay* DISPLAY = NULL;
|
||||
@@ -31,15 +34,12 @@ RageDisplay* DISPLAY = NULL;
|
||||
////////////
|
||||
// Globals
|
||||
////////////
|
||||
bool g_Windowed;
|
||||
GLenum g_vertMode = GL_TRIANGLES;
|
||||
RageTimer g_LastCheckTimer;
|
||||
int g_iNumVerts;
|
||||
int g_iFPS, g_iVPF, g_iCFPS;
|
||||
|
||||
int g_PerspectiveMode = 0;
|
||||
|
||||
int g_CurrentHeight, g_CurrentWidth, g_CurrentBPP;
|
||||
int g_ModelMatrixCnt=0;
|
||||
int RageDisplay::GetFPS() const { return g_iFPS; }
|
||||
int RageDisplay::GetVPF() const { return g_iVPF; }
|
||||
@@ -58,6 +58,9 @@ PFNGLCOLORTABLEPARAMETERIVPROC GLExt::glGetColorTableParameterivEXT;
|
||||
* no GL_T2F_C4F_V3F. */
|
||||
const GLenum RageVertexFormat = GL_T2F_C4F_N3F_V3F;
|
||||
|
||||
|
||||
LowLevelWindow *wind;
|
||||
|
||||
void GetGLExtensions(set<string> &ext)
|
||||
{
|
||||
const char *buf = (const char *)glGetString(GL_EXTENSIONS);
|
||||
@@ -74,7 +77,9 @@ RageDisplay::RageDisplay( bool windowed, int width, int height, int bpp, int rat
|
||||
LOG->Trace( "RageDisplay::RageDisplay()" );
|
||||
|
||||
m_oglspecs = new oglspecs_t;
|
||||
|
||||
|
||||
wind = MakeLowLevelWindow();
|
||||
|
||||
SetVideoMode( windowed, width, height, bpp, rate, vsync );
|
||||
|
||||
// Log driver details
|
||||
@@ -158,7 +163,7 @@ void RageDisplay::SetupOpenGL()
|
||||
|
||||
RageDisplay::~RageDisplay()
|
||||
{
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
delete wind;
|
||||
delete m_oglspecs;
|
||||
}
|
||||
|
||||
@@ -179,9 +184,9 @@ void RageDisplay::SetupExtensions()
|
||||
m_oglspecs->EXT_paletted_texture = HasExtension("GL_EXT_paletted_texture");
|
||||
|
||||
/* Find extension functions. */
|
||||
GLExt::wglSwapIntervalEXT = (PWSWAPINTERVALEXTPROC) SDL_GL_GetProcAddress("wglSwapIntervalEXT");
|
||||
GLExt::glColorTableEXT = (PFNGLCOLORTABLEPROC) SDL_GL_GetProcAddress("glColorTableEXT");
|
||||
GLExt::glGetColorTableParameterivEXT = (PFNGLCOLORTABLEPARAMETERIVPROC) SDL_GL_GetProcAddress("glGetColorTableParameterivEXT");
|
||||
GLExt::wglSwapIntervalEXT = (PWSWAPINTERVALEXTPROC) wind->GetProcAddress("wglSwapIntervalEXT");
|
||||
GLExt::glColorTableEXT = (PFNGLCOLORTABLEPROC) wind->GetProcAddress("glColorTableEXT");
|
||||
GLExt::glGetColorTableParameterivEXT = (PFNGLCOLORTABLEPARAMETERIVPROC) wind->GetProcAddress("glGetColorTableParameterivEXT");
|
||||
|
||||
/* Make sure we have all components for detected extensions. */
|
||||
if(m_oglspecs->WGL_EXT_swap_control)
|
||||
@@ -207,82 +212,14 @@ void RageDisplay::SetupExtensions()
|
||||
bool RageDisplay::SetVideoMode( bool windowed, int width, int height, int bpp, int rate, bool vsync )
|
||||
{
|
||||
// LOG->Trace( "RageDisplay::SetVideoMode( %d, %d, %d, %d, %d, %d )", windowed, width, height, bpp, rate, vsync );
|
||||
if(!SDL_WasInit(SDL_INIT_VIDEO))
|
||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||
bool NewOpenGLContext = wind->SetVideoMode( windowed, width, height, bpp, rate, vsync );
|
||||
|
||||
int flags = 0;
|
||||
if( !windowed )
|
||||
flags |= SDL_FULLSCREEN;
|
||||
flags |= SDL_DOUBLEBUF;
|
||||
flags |= SDL_RESIZABLE;
|
||||
flags |= SDL_OPENGL;
|
||||
|
||||
g_Windowed = windowed;
|
||||
SDL_ShowCursor( g_Windowed );
|
||||
|
||||
ASSERT( bpp == 16 || bpp == 32 );
|
||||
switch( bpp )
|
||||
if(NewOpenGLContext)
|
||||
{
|
||||
case 16:
|
||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
|
||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
|
||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
|
||||
break;
|
||||
case 32:
|
||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
||||
}
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, true);
|
||||
|
||||
#ifdef SDL_HAS_REFRESH_RATE
|
||||
if(rate == REFRESH_DEFAULT)
|
||||
SDL_SM_SetRefreshRate(0);
|
||||
else
|
||||
SDL_SM_SetRefreshRate(rate);
|
||||
#endif
|
||||
|
||||
bool NewOpenGLContext = false;
|
||||
|
||||
SDL_Surface *screen = SDL_SetVideoMode(width, height, bpp, flags);
|
||||
if(!screen)
|
||||
RageException::Throw("SDL_SetVideoMode failed: %s", SDL_GetError());
|
||||
|
||||
/* XXX: This event only exists in the SDL tree, and is only needed in
|
||||
* Windows. Eventually, it'll probably get upstreamed, and once it's
|
||||
* in the real branch we can remove this #if. */
|
||||
#if defined(WIN32)
|
||||
SDL_Event e;
|
||||
if(SDL_PeepEvents(&e, 1, SDL_GETEVENT, SDL_OPENGLRESETMASK))
|
||||
{
|
||||
LOG->Trace("New OpenGL context");
|
||||
|
||||
/* We have a new OpenGL context, so we have to tell our textures that
|
||||
* their OpenGL texture number is invalid. */
|
||||
if(TEXTUREMAN)
|
||||
TEXTUREMAN->InvalidateTextures();
|
||||
|
||||
SDL_WM_SetCaption("StepMania", "StepMania");
|
||||
|
||||
NewOpenGLContext = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
/* Find out what we really got. */
|
||||
int r,g,b,a, colorbits, depth, stencil;
|
||||
|
||||
SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &r);
|
||||
SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &g);
|
||||
SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &b);
|
||||
SDL_GL_GetAttribute(SDL_GL_ALPHA_SIZE, &a);
|
||||
SDL_GL_GetAttribute(SDL_GL_BUFFER_SIZE, &colorbits);
|
||||
SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &depth);
|
||||
SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, &stencil);
|
||||
LOG->Info("Got %i bpp (%i%i%i%i), %i depth, %i stencil",
|
||||
colorbits, r, g, b, a, depth, stencil);
|
||||
}
|
||||
|
||||
SetupOpenGL();
|
||||
@@ -298,10 +235,6 @@ bool RageDisplay::SetVideoMode( bool windowed, int width, int height, int bpp, i
|
||||
GLExt::wglSwapIntervalEXT(vsync);
|
||||
}
|
||||
|
||||
g_CurrentWidth = screen->w;
|
||||
g_CurrentHeight = screen->h;
|
||||
g_CurrentBPP = bpp;
|
||||
|
||||
SetViewport(0,0);
|
||||
|
||||
/* Clear any junk that's in the framebuffer. */
|
||||
@@ -377,8 +310,7 @@ void RageDisplay::DumpOpenGLDebugInfo()
|
||||
|
||||
void RageDisplay::ResolutionChanged(int width, int height)
|
||||
{
|
||||
g_CurrentWidth = width;
|
||||
g_CurrentHeight = height;
|
||||
wind->ResolutionChanged(width, height);
|
||||
|
||||
SetViewport(0,0);
|
||||
|
||||
@@ -391,10 +323,10 @@ void RageDisplay::SetViewport(int shift_left, int shift_down)
|
||||
{
|
||||
/* left and down are on a 0..SCREEN_WIDTH, 0..SCREEN_HEIGHT scale.
|
||||
* Scale them to the actual viewport range. */
|
||||
shift_left = int( shift_left * float(g_CurrentWidth) / SCREEN_WIDTH );
|
||||
shift_down = int( shift_down * float(g_CurrentWidth) / SCREEN_WIDTH );
|
||||
shift_left = int( shift_left * float(wind->GetWidth()) / SCREEN_WIDTH );
|
||||
shift_down = int( shift_down * float(wind->GetWidth()) / SCREEN_WIDTH );
|
||||
|
||||
glViewport(shift_left, -shift_down, g_CurrentWidth, g_CurrentHeight);
|
||||
glViewport(shift_left, -shift_down, wind->GetWidth(), wind->GetHeight());
|
||||
}
|
||||
|
||||
int RageDisplay::GetMaxTextureSize() const
|
||||
@@ -412,7 +344,7 @@ void RageDisplay::Clear()
|
||||
|
||||
void RageDisplay::Flip()
|
||||
{
|
||||
SDL_GL_SwapBuffers();
|
||||
wind->SwapBuffers();
|
||||
g_iFramesRenderedSinceLastCheck++;
|
||||
g_iFramesRenderedSinceLastReset++;
|
||||
|
||||
@@ -454,21 +386,21 @@ void RageDisplay::SaveScreenshot( CString sPath )
|
||||
ASSERT( sPath.Right(3).CompareNoCase("bmp") == 0 ); // we can only save bitmaps
|
||||
|
||||
SDL_Surface *image = SDL_CreateRGBSurface(
|
||||
SDL_SWSURFACE, g_CurrentWidth, g_CurrentHeight,
|
||||
SDL_SWSURFACE, wind->GetWidth(), wind->GetHeight(),
|
||||
24, 0x0000FF, 0x00FF00, 0xFF0000, 0x000000);
|
||||
SDL_Surface *temp = SDL_CreateRGBSurface(
|
||||
SDL_SWSURFACE, g_CurrentWidth, g_CurrentHeight,
|
||||
SDL_SWSURFACE, wind->GetWidth(), wind->GetHeight(),
|
||||
24, 0x0000FF, 0x00FF00, 0xFF0000, 0x000000);
|
||||
|
||||
glReadPixels(0, 0, g_CurrentWidth, g_CurrentHeight, GL_RGB,
|
||||
glReadPixels(0, 0, wind->GetWidth(), wind->GetHeight(), GL_RGB,
|
||||
GL_UNSIGNED_BYTE, image->pixels);
|
||||
|
||||
// flip vertically
|
||||
for( int y=0; y<g_CurrentHeight; y++ )
|
||||
for( int y=0; y<wind->GetHeight(); y++ )
|
||||
memcpy(
|
||||
(char *)temp->pixels + 3 * g_CurrentWidth * y,
|
||||
(char *)image->pixels + 3 * g_CurrentWidth * (g_CurrentHeight-1-y),
|
||||
3*g_CurrentWidth );
|
||||
(char *)temp->pixels + 3 * wind->GetWidth() * y,
|
||||
(char *)image->pixels + 3 * wind->GetWidth() * (wind->GetHeight()-1-y),
|
||||
3*wind->GetWidth() );
|
||||
|
||||
SDL_SaveBMP( temp, sPath );
|
||||
|
||||
@@ -479,7 +411,7 @@ void RageDisplay::SaveScreenshot( CString sPath )
|
||||
|
||||
bool RageDisplay::IsWindowed() const
|
||||
{
|
||||
return g_Windowed;
|
||||
return wind->IsWindowed();
|
||||
}
|
||||
|
||||
void RageDisplay::DrawQuad( const RageVertex v[4] ) // upper-left, upper-right, lower-right, lower-left
|
||||
@@ -582,8 +514,8 @@ void RageDisplay::DrawLoop_LinesAndPoints( const RageVertex v[], int iNumVerts,
|
||||
/* Our line width is wrt the regular internal SCREEN_WIDTHxSCREEN_HEIGHT screen,
|
||||
* but these width functions actually want raster sizes (that is, actual pixels).
|
||||
* Scale the line width and point size by the average ratio of the scale. */
|
||||
float WidthVal = float(g_CurrentWidth) / SCREEN_WIDTH;
|
||||
float HeightVal = float(g_CurrentHeight) / SCREEN_HEIGHT;
|
||||
float WidthVal = float(wind->GetWidth()) / SCREEN_WIDTH;
|
||||
float HeightVal = float(wind->GetHeight()) / SCREEN_HEIGHT;
|
||||
LineWidth *= (WidthVal + HeightVal) / 2;
|
||||
|
||||
/* Clamp the width to the hardware max for both lines and points (whichever
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Microsoft Developer Studio Project File - Name="StepMania" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 60000
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
@@ -57,10 +57,10 @@ LINK32=link.exe
|
||||
# SUBTRACT LINK32 /verbose /pdb:none
|
||||
# Begin Special Build Tool
|
||||
IntDir=.\../Release6
|
||||
TargetDir=\stepmania\stepmania
|
||||
TargetDir=\temp\stepmania
|
||||
TargetName=StepMania
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
|
||||
# End Special Build Tool
|
||||
|
||||
@@ -92,10 +92,10 @@ LINK32=link.exe
|
||||
# SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
|
||||
# Begin Special Build Tool
|
||||
IntDir=.\../Debug6
|
||||
TargetDir=\stepmania\stepmania
|
||||
TargetDir=\temp\stepmania
|
||||
TargetName=StepMania-debug
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
|
||||
# End Special Build Tool
|
||||
|
||||
@@ -752,6 +752,22 @@ SOURCE=.\arch\MovieTexture\MovieTexture_DShowHelper.cpp
|
||||
SOURCE=.\arch\MovieTexture\MovieTexture_DShowHelper.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "LowLevelWindow"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\arch\LowLevelWindow\LowLevelWindow.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\arch\LowLevelWindow\LowLevelWindow_SDL.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\arch\LowLevelWindow\LowLevelWindow_SDL.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\arch\arch.cpp
|
||||
|
||||
@@ -898,6 +898,19 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
RelativePath="arch\MovieTexture\MovieTexture_DShowHelper.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="LowLevelWindow"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath="arch\LowLevelWindow\LowLevelWindow.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="arch\LowLevelWindow\LowLevelWindow_SDL.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="arch\LowLevelWindow\LowLevelWindow_SDL.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="system"
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef LOW_LEVEL_WINDOW_H
|
||||
#define LOW_LEVEL_WINDOW_H
|
||||
|
||||
/* This handles low-level operations that OGL 1.x doesn't give us. Normally,
|
||||
* we use SDL. Note that not all SDL operations go here; however, nothing
|
||||
* outside of this can assume that SDL has VIDEO initialized. */
|
||||
class LowLevelWindow
|
||||
{
|
||||
public:
|
||||
virtual ~LowLevelWindow() { }
|
||||
|
||||
virtual void *GetProcAddress(CString s) = 0;
|
||||
|
||||
/* Set the video mode as close to the requested settings as possible. They're
|
||||
* hints only; it's better to get the wrong mode than to bail out. */
|
||||
virtual bool SetVideoMode( bool windowed, int width, int height, int bpp, int rate, bool vsync ) = 0;
|
||||
|
||||
virtual void SwapBuffers() = 0;
|
||||
|
||||
/* This is currently only called when we get SDL resize events; any other
|
||||
* models can probably ignore this. */
|
||||
virtual void ResolutionChanged(int width, int height) { }
|
||||
|
||||
virtual bool IsWindowed() const = 0;
|
||||
virtual int GetWidth() const = 0;
|
||||
virtual int GetHeight() const = 0;
|
||||
virtual int GetBPP() const = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,106 @@
|
||||
#include "global.h"
|
||||
#include "LowLevelWindow_SDL.h"
|
||||
|
||||
#include "RageLog.h"
|
||||
#include "RageDisplay.h" // for REFRESH_DEFAULT
|
||||
|
||||
#include "SDL_utils.h"
|
||||
|
||||
LowLevelWindow_SDL::LowLevelWindow_SDL()
|
||||
{
|
||||
if(!SDL_WasInit(SDL_INIT_VIDEO))
|
||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||
|
||||
Windowed = false;
|
||||
}
|
||||
|
||||
LowLevelWindow_SDL::~LowLevelWindow_SDL()
|
||||
{
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
}
|
||||
|
||||
void *LowLevelWindow_SDL::GetProcAddress(CString s)
|
||||
{
|
||||
return SDL_GL_GetProcAddress(s);
|
||||
}
|
||||
|
||||
bool LowLevelWindow_SDL::SetVideoMode( bool windowed, int width, int height, int bpp, int rate, bool vsync )
|
||||
{
|
||||
int flags = SDL_DOUBLEBUF | SDL_RESIZABLE | SDL_OPENGL;
|
||||
if( !windowed )
|
||||
flags |= SDL_FULLSCREEN;
|
||||
|
||||
Windowed = windowed;
|
||||
SDL_ShowCursor( Windowed );
|
||||
|
||||
ASSERT( bpp == 16 || bpp == 32 );
|
||||
switch( bpp )
|
||||
{
|
||||
case 16:
|
||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
|
||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
|
||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
|
||||
break;
|
||||
case 32:
|
||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
||||
}
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, true);
|
||||
|
||||
#ifdef SDL_HAS_REFRESH_RATE
|
||||
if(rate == REFRESH_DEFAULT)
|
||||
SDL_SM_SetRefreshRate(0);
|
||||
else
|
||||
SDL_SM_SetRefreshRate(rate);
|
||||
#endif
|
||||
|
||||
SDL_Surface *screen = SDL_SetVideoMode(width, height, bpp, flags);
|
||||
if(!screen)
|
||||
RageException::Throw("SDL_SetVideoMode failed: %s", SDL_GetError());
|
||||
|
||||
bool NewOpenGLContext = false;
|
||||
|
||||
/* XXX: This event only exists in the SDL tree, and is only needed in
|
||||
* Windows. Eventually, it'll probably get upstreamed, and once it's
|
||||
* in the real branch we can remove this #if. */
|
||||
#if defined(WIN32)
|
||||
SDL_Event e;
|
||||
if(SDL_PeepEvents(&e, 1, SDL_GETEVENT, SDL_OPENGLRESETMASK))
|
||||
{
|
||||
LOG->Trace("New OpenGL context");
|
||||
|
||||
SDL_WM_SetCaption("StepMania", "StepMania");
|
||||
|
||||
NewOpenGLContext = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
/* Find out what we really got. */
|
||||
int r,g,b,a, colorbits, depth, stencil;
|
||||
|
||||
SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &r);
|
||||
SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &g);
|
||||
SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &b);
|
||||
SDL_GL_GetAttribute(SDL_GL_ALPHA_SIZE, &a);
|
||||
SDL_GL_GetAttribute(SDL_GL_BUFFER_SIZE, &colorbits);
|
||||
SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &depth);
|
||||
SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, &stencil);
|
||||
LOG->Info("Got %i bpp (%i%i%i%i), %i depth, %i stencil",
|
||||
colorbits, r, g, b, a, depth, stencil);
|
||||
}
|
||||
|
||||
CurrentWidth = screen->w;
|
||||
CurrentHeight = screen->h;
|
||||
CurrentBPP = bpp;
|
||||
|
||||
return NewOpenGLContext;
|
||||
}
|
||||
|
||||
void LowLevelWindow_SDL::SwapBuffers()
|
||||
{
|
||||
SDL_GL_SwapBuffers();
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef LOW_LEVEL_WINDOW_SDL_H
|
||||
#define LOW_LEVEL_WINDOW_SDL_H
|
||||
|
||||
#include "LowLevelWindow.h"
|
||||
|
||||
class LowLevelWindow_SDL: public LowLevelWindow
|
||||
{
|
||||
bool Windowed;
|
||||
int CurrentHeight, CurrentWidth, CurrentBPP;
|
||||
|
||||
public:
|
||||
LowLevelWindow_SDL();
|
||||
~LowLevelWindow_SDL();
|
||||
void *GetProcAddress(CString s);
|
||||
bool SetVideoMode( bool windowed, int width, int height, int bpp, int rate, bool vsync );
|
||||
void SwapBuffers();
|
||||
void ResolutionChanged(int width, int height) { CurrentWidth = width; CurrentHeight = height; }
|
||||
|
||||
bool IsWindowed() const { return Windowed; }
|
||||
int GetWidth() const { return CurrentWidth; }
|
||||
int GetHeight() const { return CurrentHeight; }
|
||||
int GetBPP() const { return CurrentBPP; }
|
||||
};
|
||||
#undef ARCH_LOW_LEVEL_WINDOW
|
||||
#define ARCH_LOW_LEVEL_WINDOW LowLevelWindow_SDL
|
||||
|
||||
#endif
|
||||
@@ -23,6 +23,7 @@
|
||||
LoadingWindow *MakeLoadingWindow() { return new ARCH_LOADING_WINDOW; }
|
||||
ErrorDialog *MakeErrorDialog() { return new ARCH_ERROR_DIALOG; }
|
||||
ArchHooks *MakeArchHooks() { return new ARCH_HOOKS; }
|
||||
LowLevelWindow *MakeLowLevelWindow() { return new ARCH_LOW_LEVEL_WINDOW; }
|
||||
|
||||
void MakeInputHandlers(vector<InputHandler *> &Add)
|
||||
{
|
||||
|
||||
@@ -7,10 +7,12 @@ class LoadingWindow;
|
||||
class RageSoundDriver;
|
||||
class ArchHooks;
|
||||
class InputHandler;
|
||||
class LowLevelWindow;
|
||||
|
||||
ErrorDialog *MakeErrorDialog();
|
||||
LoadingWindow *MakeLoadingWindow();
|
||||
ArchHooks *MakeArchHooks();
|
||||
LowLevelWindow *MakeLowLevelWindow();
|
||||
|
||||
void MakeInputHandlers(vector<InputHandler *> &Add);
|
||||
RageSoundDriver *MakeRageSoundDriver(CString drivers);
|
||||
|
||||
@@ -6,9 +6,11 @@
|
||||
|
||||
/* Load default fallback drivers; some of these may be overridden by arch-specific drivers. */
|
||||
#include "LoadingWindow/LoadingWindow_SDL.h"
|
||||
/* XXX: null, none, Null--pick one */
|
||||
#include "ErrorDialog/ErrorDialog_null.h"
|
||||
#include "ArchHooks/ArchHooks_none.h"
|
||||
#include "Sound/RageSoundDriver_Null.h"
|
||||
#include "LowLevelWindow/LowLevelWindow_SDL.h"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user