added toggle fullscreen

This commit is contained in:
James Turk 2003-01-25 19:55:13 +00:00
parent 7a64caf638
commit bd3a140858
2 changed files with 26 additions and 3 deletions

View File

@ -13,7 +13,7 @@
File: ZE_ZEngine.h <br>
Description: Header file for ZEngine class, the core of the ZEngine. <br>
Author(s): James Turk <br>
$Id: ZE_ZEngine.h,v 1.16 2003/01/24 19:43:59 cozman Exp $<br>
$Id: ZE_ZEngine.h,v 1.17 2003/01/25 19:55:13 cozman Exp $<br>
\file ZE_ZEngine.h
\brief Definition file for core ZEngine class.
@ -154,6 +154,15 @@ class ZEngine
**/
void CloseDisplay();
/*!
\brief Toggle fullscreen/windowed mode.
Safely toggles fullscreen/windowed mode, generally toggling modes will bring the need to reload images so it will
set the ImagesNeedReload state to true.
\since 0.8.2
**/
void ToggleFullscreen();
/////////////////
//Screen Access//
/////////////////

View File

@ -13,7 +13,7 @@
File: ZE_ZEngine.cpp <br>
Description: Implementation source file for ZEngine library main singleton class. <br>
Author(s): James Turk <br>
$Id: ZE_ZEngine.cpp,v 1.22 2003/01/24 19:41:54 cozman Exp $<br>
$Id: ZE_ZEngine.cpp,v 1.23 2003/01/25 19:55:13 cozman Exp $<br>
\file ZE_ZEngine.cpp
\brief Central source file for ZEngine.
@ -186,7 +186,7 @@ bool ZEngine::CreateDisplay(string title, string icon)
SDL_WM_SetCaption(title.c_str(),NULL);
else
{
SDL_WM_SetCaption(title.c_str(),icon.c_str());
SDL_WM_SetCaption(title.c_str(),title.c_str());
iconImg = LoadImage(icon);
SDL_WM_SetIcon(iconImg,NULL);
FreeImage(iconImg);
@ -249,6 +249,20 @@ void ZEngine::CloseDisplay()
fclose(mErrlog);
}
void ZEngine::ToggleFullscreen()
{
char *title,*icon;
#ifdef linux //SDL_WM_TF only works on Linux
SDL_WM_ToggleFullscreen(mScreen);
#else
SetupDisplay(mWidth,mHeight,mBPP,!mFullscreen);
SDL_WM_GetCaption(&title,&icon);
CreateDisplay(title);
#endif
SetReloadNeed(true);
mActive = true;
}
SDL_Surface *ZEngine::Display()
{
return mScreen;