Implement a fullscreen mode.

This commit is contained in:
Daniel Schepler 2005-03-28 01:54:21 +00:00
parent 6413a7d9e5
commit 9abc55fcfd
7 changed files with 76 additions and 15 deletions

View file

@ -93,10 +93,17 @@ static void lookAt(TGLfloat eyex, TGLfloat eyey, TGLfloat eyez, TGLfloat centerx
tglTranslatef(-eyex, -eyey, -eyez);
}
DriverTinyGL::DriverTinyGL(int screenW, int screenH, int screenBPP) {
_screen = SDL_SetVideoMode(screenW, screenH, screenBPP, SDL_HWSURFACE);
DriverTinyGL::DriverTinyGL(int screenW, int screenH, int screenBPP, bool fullscreen) {
Uint32 flags = SDL_HWSURFACE;
if (fullscreen)
flags |= SDL_FULLSCREEN;
_screen = SDL_SetVideoMode(screenW, screenH, screenBPP, flags);
if (_screen == NULL)
error("Could not initialize video");
_screenWidth = screenW;
_screenHeight = screenH;
_screenBPP = screenBPP;
_isFullscreen = fullscreen;
SDL_WM_SetCaption("Residual: Modified TinyGL - Software Renderer", "Residual");
@ -116,6 +123,17 @@ DriverTinyGL::~DriverTinyGL() {
ZB_close(_zb);
}
void DriverTinyGL::toggleFullscreenMode() {
Uint32 flags = SDL_HWSURFACE;
if (! _isFullscreen)
flags |= SDL_FULLSCREEN;
if (SDL_SetVideoMode(_screenWidth, _screenHeight, _screenBPP, flags) == 0)
warning("Could not change fullscreen mode");
else
_isFullscreen = ! _isFullscreen;
}
void DriverTinyGL::setupCamera(float fov, float nclip, float fclip, float roll) {
tglMatrixMode(TGL_PROJECTION);
tglLoadIdentity();