/** \return True if window is minimized. */\r
virtual bool isWindowMinimized() const = 0;\r
\r
+ //! Checks if the Irrlicht window is maximized\r
+ //! Only fully works on SDL. Returns false, or the last value set via\r
+ //! maximizeWindow() and restoreWindow(), on other backends.\r
+ /** \return True if window is maximized. */\r
+ virtual bool isWindowMaximized() const = 0;\r
+\r
//! Checks if the Irrlicht window is running in fullscreen mode\r
/** \return True if window is fullscreen. */\r
virtual bool isFullscreen() const = 0;\r
Bits(32),\r
ZBufferBits(24),\r
Fullscreen(false),\r
+ WindowMaximized(false),\r
WindowResizable(2),\r
Stencilbuffer(true),\r
Vsync(false),\r
Bits = other.Bits;\r
ZBufferBits = other.ZBufferBits;\r
Fullscreen = other.Fullscreen;\r
+ WindowMaximized = other.WindowMaximized;\r
WindowResizable = other.WindowResizable;\r
Stencilbuffer = other.Stencilbuffer;\r
Vsync = other.Vsync;\r
/** Otherwise the device runs in windowed mode. Default: false. */\r
bool Fullscreen;\r
\r
+ //! Maximised window. (Only supported on SDL.) Default: false\r
+ bool WindowMaximized;\r
+\r
//! Should a non-fullscreen window be resizable.\r
/** Might not be supported by all devices. Ignored when Fullscreen is true.\r
Values: 0 = not resizable, 1 = resizable, 2 = system decides default itself\r
currentTouchedCount(0),\r
#endif\r
Width(param.WindowSize.Width), Height(param.WindowSize.Height),\r
- WindowHasFocus(false), WindowMinimized(false),\r
+ WindowHasFocus(false), WindowMinimized(false), WindowMaximized(param.WindowMaximized),\r
ExternalWindow(false), AutorepeatSupport(0)\r
{\r
#ifdef _DEBUG\r
return;\r
\r
createGUIAndScene();\r
+\r
+ if (param.WindowMaximized)\r
+ maximizeWindow();\r
}\r
\r
\r
}\r
\r
\r
+//! returns last state from maximizeWindow() and restoreWindow()\r
+bool CIrrDeviceLinux::isWindowMaximized() const\r
+{\r
+ return WindowMaximized;\r
+}\r
+\r
+\r
//! returns color format of the window.\r
video::ECOLOR_FORMAT CIrrDeviceLinux::getColorFormat() const\r
{\r
}\r
\r
XMapWindow(XDisplay, XWindow);\r
+\r
+ WindowMaximized = true;\r
#endif\r
}\r
\r
}\r
\r
XMapWindow(XDisplay, XWindow);\r
+\r
+ WindowMaximized = false;\r
#endif\r
}\r
\r
//! returns if window is minimized.\r
bool isWindowMinimized() const override;\r
\r
+ //! returns last state from maximizeWindow() and restoreWindow()\r
+ bool isWindowMaximized() const override;\r
+\r
//! returns color format of the window.\r
video::ECOLOR_FORMAT getColorFormat() const override;\r
\r
u32 Width, Height;\r
bool WindowHasFocus;\r
bool WindowMinimized;\r
+ bool WindowMaximized;\r
bool ExternalWindow;\r
int AutorepeatSupport;\r
\r
Window((SDL_Window*)param.WindowId), SDL_Flags(0),\r
MouseX(0), MouseY(0), MouseXRel(0), MouseYRel(0), MouseButtonStates(0),\r
Width(param.WindowSize.Width), Height(param.WindowSize.Height),\r
- Resizable(param.WindowResizable == 1 ? true : false), WindowMinimized(false)\r
+ Resizable(param.WindowResizable == 1 ? true : false)\r
{\r
#ifdef _DEBUG\r
setDebugName("CIrrDeviceSDL");\r
// create keymap\r
createKeyMap();\r
\r
- if ( CreationParams.Fullscreen )\r
+ if (CreationParams.Fullscreen) {\r
SDL_Flags |= SDL_WINDOW_FULLSCREEN;\r
- else if ( Resizable )\r
- SDL_Flags |= SDL_WINDOW_RESIZABLE;\r
+ } else {\r
+ if (Resizable)\r
+ SDL_Flags |= SDL_WINDOW_RESIZABLE;\r
+ if (CreationParams.WindowMaximized)\r
+ SDL_Flags |= SDL_WINDOW_MAXIMIZED;\r
+ }\r
if (CreationParams.DriverType == video::EDT_OPENGL)\r
{\r
SDL_Flags |= SDL_WINDOW_OPENGL;\r
createWindow();\r
}\r
\r
+\r
SDL_VERSION(&Info.version);\r
\r
#ifndef _IRR_EMSCRIPTEN_PLATFORM_\r
case SDL_WINDOWEVENT:\r
switch (SDL_event.window.event)\r
{\r
- case SDL_WINDOWEVENT_MAXIMIZED:\r
- WindowMinimized = true;\r
- break;\r
- case SDL_WINDOWEVENT_RESTORED:\r
- WindowMinimized = false;\r
- break;\r
case SDL_WINDOWEVENT_RESIZED:\r
if ((SDL_event.window.data1 != (int)Width) || (SDL_event.window.data2 != (int)Height))\r
{\r
//! Minimizes window if possible\r
void CIrrDeviceSDL::minimizeWindow()\r
{\r
- if (Window) {\r
+ if (Window)\r
SDL_MinimizeWindow(Window);\r
- }\r
}\r
\r
\r
//! Maximize window\r
void CIrrDeviceSDL::maximizeWindow()\r
{\r
- // do nothing\r
+ if (Window)\r
+ SDL_MaximizeWindow(Window);\r
}\r
\r
//! Get the position of this window on screen\r
//! Restore original window size\r
void CIrrDeviceSDL::restoreWindow()\r
{\r
- // do nothing\r
+ if (Window)\r
+ SDL_RestoreWindow(Window);\r
+}\r
+\r
+bool CIrrDeviceSDL::isWindowMaximized() const\r
+{\r
+ return Window && (SDL_GetWindowFlags(Window) & SDL_WINDOW_MAXIMIZED) != 0;\r
}\r
\r
bool CIrrDeviceSDL::isFullscreen() const\r
//! returns if window has focus.\r
bool CIrrDeviceSDL::isWindowFocused() const\r
{\r
- return SDL_GetWindowFlags(Window) & SDL_WINDOW_INPUT_FOCUS;\r
+ return Window && (SDL_GetWindowFlags(Window) & SDL_WINDOW_INPUT_FOCUS) != 0;\r
}\r
\r
\r
//! returns if window is minimized.\r
bool CIrrDeviceSDL::isWindowMinimized() const\r
{\r
- return WindowMinimized;\r
+ return Window && (SDL_GetWindowFlags(Window) & SDL_WINDOW_MINIMIZED) != 0;\r
}\r
\r
\r
//! Restores the window size.\r
void restoreWindow() override;\r
\r
+ //! Checks if the window is maximized.\r
+ bool isWindowMaximized() const override;\r
+\r
//! Checks if the Irrlicht window is running in fullscreen mode\r
/** \return True if window is fullscreen. */\r
bool isFullscreen() const override;\r
u32 Width, Height;\r
\r
bool Resizable;\r
- bool WindowMinimized;\r
\r
struct SKeyMap\r
{\r
}\r
\r
\r
+//! Checks if the window is maximized.\r
+bool CIrrDeviceStub::isWindowMaximized() const\r
+{\r
+ return false;\r
+}\r
+\r
+\r
//! Checks if the window is running in fullscreen mode\r
bool CIrrDeviceStub::isFullscreen() const\r
{\r
//! Returns the operation system opertator object.\r
IOSOperator* getOSOperator() override;\r
\r
+ //! Checks if the window is maximized.\r
+ bool isWindowMaximized() const override;\r
+\r
//! Checks if the window is running in fullscreen mode.\r
bool isFullscreen() const override;\r
\r
//! Activate any joysticks, and generate events for them.\r
bool activateJoysticks(core::array<SJoystickInfo> & joystickInfo) override;\r
\r
- //! Activate accelerometer.\r
- bool activateAccelerometer(float updateInterval = 0.016666f) override;\r
- \r
- //! Deactivate accelerometer.\r
- bool deactivateAccelerometer() override;\r
- \r
- //! Is accelerometer active.\r
- bool isAccelerometerActive() override;\r
- \r
- //! Is accelerometer available.\r
- bool isAccelerometerAvailable() override;\r
- \r
- //! Activate gyroscope.\r
- bool activateGyroscope(float updateInterval = 0.016666f) override;\r
- \r
- //! Deactivate gyroscope.\r
- bool deactivateGyroscope() override;\r
- \r
- //! Is gyroscope active.\r
- bool isGyroscopeActive() override;\r
- \r
- //! Is gyroscope available.\r
- bool isGyroscopeAvailable() override;\r
- \r
- //! Activate device motion.\r
- bool activateDeviceMotion(float updateInterval = 0.016666f) override;\r
- \r
- //! Deactivate device motion.\r
- bool deactivateDeviceMotion() override;\r
- \r
- //! Is device motion active.\r
- bool isDeviceMotionActive() override;\r
- \r
- //! Is device motion available.\r
- bool isDeviceMotionAvailable() override;\r
+ //! Activate accelerometer.\r
+ bool activateAccelerometer(float updateInterval = 0.016666f) override;\r
+\r
+ //! Deactivate accelerometer.\r
+ bool deactivateAccelerometer() override;\r
+\r
+ //! Is accelerometer active.\r
+ bool isAccelerometerActive() override;\r
+\r
+ //! Is accelerometer available.\r
+ bool isAccelerometerAvailable() override;\r
+\r
+ //! Activate gyroscope.\r
+ bool activateGyroscope(float updateInterval = 0.016666f) override;\r
+\r
+ //! Deactivate gyroscope.\r
+ bool deactivateGyroscope() override;\r
+\r
+ //! Is gyroscope active.\r
+ bool isGyroscopeActive() override;\r
+\r
+ //! Is gyroscope available.\r
+ bool isGyroscopeAvailable() override;\r
+\r
+ //! Activate device motion.\r
+ bool activateDeviceMotion(float updateInterval = 0.016666f) override;\r
+\r
+ //! Deactivate device motion.\r
+ bool deactivateDeviceMotion() override;\r
+\r
+ //! Is device motion active.\r
+ bool isDeviceMotionActive() override;\r
+\r
+ //! Is device motion available.\r
+ bool isDeviceMotionAvailable() override;\r
\r
//! Set the maximal elapsed time between 2 clicks to generate doubleclicks for the mouse. It also affects tripleclick behavior.\r
//! When set to 0 no double- and tripleclicks will be generated.\r
//! constructor\r
CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)\r
: CIrrDeviceStub(params), HWnd(0), Resized(false),\r
- ExternalWindow(false), Win32CursorControl(0), JoyControl(0)\r
+ ExternalWindow(false), Win32CursorControl(0), JoyControl(0),\r
+ WindowMaximized(params.WindowMaximized)\r
{\r
#ifdef _DEBUG\r
setDebugName("CIrrDeviceWin32");\r
\r
// inform driver about the window size etc.\r
resizeIfNecessary();\r
+\r
+ if (params.WindowMaximized)\r
+ maximizeWindow();\r
}\r
\r
\r
}\r
\r
\r
+//! returns last state from maximizeWindow() and restoreWindow()\r
+bool CIrrDeviceWin32::isWindowMaximized() const\r
+{\r
+ return WindowMaximized;\r
+}\r
+\r
+\r
//! switches to fullscreen\r
bool CIrrDeviceWin32::switchToFullScreen()\r
{\r
GetWindowPlacement(HWnd, &wndpl);\r
wndpl.showCmd = SW_SHOWMAXIMIZED;\r
SetWindowPlacement(HWnd, &wndpl);\r
+\r
+ WindowMaximized = true;\r
}\r
\r
\r
GetWindowPlacement(HWnd, &wndpl);\r
wndpl.showCmd = SW_SHOWNORMAL;\r
SetWindowPlacement(HWnd, &wndpl);\r
+\r
+ WindowMaximized = false;\r
}\r
\r
core::position2di CIrrDeviceWin32::getWindowPosition()\r
//! returns if window is minimized\r
bool isWindowMinimized() const override;\r
\r
+ //! returns last state from maximizeWindow() and restoreWindow()\r
+ bool isWindowMaximized() const override;\r
+\r
//! notifies the device that it should close itself\r
void closeDevice() override;\r
\r
CCursorControl* Win32CursorControl;\r
\r
SJoystickWin32Control* JoyControl;\r
+\r
+ bool WindowMaximized;\r
};\r
\r
} // end namespace irr\r