From d4cd6d6fc9236d0296cac813ee26bbe4bb540237 Mon Sep 17 00:00:00 2001 From: Benau Date: Sat, 6 Jun 2020 01:02:01 +0800 Subject: [PATCH] Add minimum window size --- lib/irrlicht/include/IrrlichtDevice.h | 1 + lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp | 6 ++++++ lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.h | 2 ++ src/main.cpp | 5 ++++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/irrlicht/include/IrrlichtDevice.h b/lib/irrlicht/include/IrrlichtDevice.h index 8082b5b08..70476d69c 100644 --- a/lib/irrlicht/include/IrrlichtDevice.h +++ b/lib/irrlicht/include/IrrlichtDevice.h @@ -318,6 +318,7 @@ namespace irr virtual s32 getBottomPadding() { return 0; } virtual s32 getLeftPadding() { return 0; } virtual s32 getRightPadding() { return 0; } + virtual void setWindowMinimumSize(u32 width, u32 height) {} //! Check if a driver type is supported by the engine. /** Even if true is returned the driver may not be available for a configuration requested when creating the device. */ diff --git a/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp b/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp index 3b85abd3c..9e12337fa 100644 --- a/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp +++ b/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp @@ -726,6 +726,12 @@ bool CIrrDeviceSDL::getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &brightne return false; } +void CIrrDeviceSDL::setWindowMinimumSize(u32 width, u32 height) +{ + if (Window) + SDL_SetWindowMinimumSize(Window, width, height); +} + //! returns color format of the window. video::ECOLOR_FORMAT CIrrDeviceSDL::getColorFormat() const { diff --git a/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.h b/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.h index 2c1c5532a..b2cda8bc1 100644 --- a/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.h +++ b/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.h @@ -95,6 +95,8 @@ namespace irr //! Get the current Gamma Value for the Display virtual bool getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &brightness, f32 &contrast ); + virtual void setWindowMinimumSize(u32 width, u32 height); + //! Get the device type virtual E_DEVICE_TYPE getType() const { diff --git a/src/main.cpp b/src/main.cpp index 9949f7d83..8b07de3cc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2168,7 +2168,10 @@ int main(int argc, char *argv[]) } Log::warn("main", "Screen size is too small!"); } - + else + { + irr_driver->getDevice()->setWindowMinimumSize(480, 480); + } #ifdef MOBILE_STK if (UserConfigParams::m_multitouch_controls == MULTITOUCH_CONTROLS_UNDEFINED) {