From bd3a14085841ca1c3bb2e650c16c247942f3b4f1 Mon Sep 17 00:00:00 2001 From: James Turk Date: Sat, 25 Jan 2003 19:55:13 +0000 Subject: [PATCH] added toggle fullscreen --- include/ZE_ZEngine.h | 11 ++++++++++- src/ZE_ZEngine.cpp | 18 ++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/include/ZE_ZEngine.h b/include/ZE_ZEngine.h index 9550d33..9046168 100644 --- a/include/ZE_ZEngine.h +++ b/include/ZE_ZEngine.h @@ -13,7 +13,7 @@ File: ZE_ZEngine.h
Description: Header file for ZEngine class, the core of the ZEngine.
Author(s): James Turk
-$Id: ZE_ZEngine.h,v 1.16 2003/01/24 19:43:59 cozman Exp $
+$Id: ZE_ZEngine.h,v 1.17 2003/01/25 19:55:13 cozman Exp $
\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// ///////////////// diff --git a/src/ZE_ZEngine.cpp b/src/ZE_ZEngine.cpp index 51dc0cc..bc12ebb 100644 --- a/src/ZE_ZEngine.cpp +++ b/src/ZE_ZEngine.cpp @@ -13,7 +13,7 @@ File: ZE_ZEngine.cpp
Description: Implementation source file for ZEngine library main singleton class.
Author(s): James Turk
-$Id: ZE_ZEngine.cpp,v 1.22 2003/01/24 19:41:54 cozman Exp $
+$Id: ZE_ZEngine.cpp,v 1.23 2003/01/25 19:55:13 cozman Exp $
\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;