diff --git a/lib/irrlicht/source/Irrlicht/CIrrDeviceAndroid.cpp b/lib/irrlicht/source/Irrlicht/CIrrDeviceAndroid.cpp index 95db25696..c5e9d00a9 100644 --- a/lib/irrlicht/source/Irrlicht/CIrrDeviceAndroid.cpp +++ b/lib/irrlicht/source/Irrlicht/CIrrDeviceAndroid.cpp @@ -89,7 +89,7 @@ CIrrDeviceAndroid::CIrrDeviceAndroid(const SIrrlichtCreationParameters& param) ExposedVideoData.OGLESAndroid.Window = Android->window; - getVideoModeList(); + createVideoModeList(); createDriver(); @@ -103,25 +103,26 @@ CIrrDeviceAndroid::~CIrrDeviceAndroid() Android->userData = NULL; } -video::IVideoModeList* CIrrDeviceAndroid::getVideoModeList() +void CIrrDeviceAndroid::createVideoModeList() { - if (Android == NULL || Android->window == NULL) - return NULL; - - core::dimension2d size = core::dimension2d( - ANativeWindow_getWidth(Android->window), - ANativeWindow_getHeight(Android->window)); - - CreationParams.WindowSize.Width = size.Width; - CreationParams.WindowSize.Height = size.Height; - - if (!VideoModeList.getVideoModeCount()) + if (VideoModeList.getVideoModeCount() > 0) + return; + + int width = ANativeWindow_getWidth(Android->window); + int height = ANativeWindow_getHeight(Android->window); + + if (width > 0 && height > 0) { - VideoModeList.addMode(size, 32); - VideoModeList.setDesktop(32, size); + CreationParams.WindowSize.Width = width; + CreationParams.WindowSize.Height = height; } - return &VideoModeList; + core::dimension2d size = core::dimension2d( + CreationParams.WindowSize.Width, + CreationParams.WindowSize.Height); + + VideoModeList.addMode(size, 32); + VideoModeList.setDesktop(32, size); } void CIrrDeviceAndroid::createDriver() diff --git a/lib/irrlicht/source/Irrlicht/CIrrDeviceAndroid.h b/lib/irrlicht/source/Irrlicht/CIrrDeviceAndroid.h index de2998ae9..dab160e2a 100644 --- a/lib/irrlicht/source/Irrlicht/CIrrDeviceAndroid.h +++ b/lib/irrlicht/source/Irrlicht/CIrrDeviceAndroid.h @@ -54,7 +54,6 @@ namespace irr virtual bool deactivateGyroscope(); virtual bool isGyroscopeActive(); virtual bool isGyroscopeAvailable(); - video::IVideoModeList* getVideoModeList(); class CCursorControl : public gui::ICursorControl { @@ -114,6 +113,7 @@ namespace irr void createDriver(); void createKeyMap(); + void createVideoModeList(); void getKeyChar(SEvent& event); video::SExposedVideoData& getExposedVideoData();