Use SDL2 to create iOS device
This commit is contained in:
parent
23a26648d8
commit
ea0380ae16
@ -89,7 +89,8 @@
|
||||
|
||||
#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) || defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||
#define _IRR_IOS_PLATFORM_
|
||||
#define _IRR_COMPILE_WITH_IOS_DEVICE_
|
||||
#undef _IRR_COMPILE_WITH_IOS_DEVICE_
|
||||
#define _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
#define _IRR_COMPILE_WITH_OGLES2_
|
||||
#else
|
||||
#ifndef NO_IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
|
@ -29,12 +29,13 @@ namespace irr
|
||||
IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io, CIrrDeviceSDL* device);
|
||||
IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io, CIrrDeviceSDL* device);
|
||||
io::IFileSystem* io, CIrrDeviceSDL* device, u32 default_fb);
|
||||
|
||||
} // end namespace video
|
||||
|
||||
} // end namespace irr
|
||||
|
||||
extern "C" void init_objc(SDL_SysWMinfo* info, float* ns, float* top, float* bottom, float* left, float* right);
|
||||
|
||||
namespace irr
|
||||
{
|
||||
@ -42,9 +43,10 @@ namespace irr
|
||||
//! constructor
|
||||
CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
|
||||
: CIrrDeviceStub(param),
|
||||
Window(0), Context(0),
|
||||
Window(0), Context(0), NativeScale(1.0f),
|
||||
MouseX(0), MouseY(0), MouseButtonStates(0),
|
||||
Width(param.WindowSize.Width), Height(param.WindowSize.Height),
|
||||
TopPadding(0), BottomPadding(0), LeftPadding(0), RightPadding(0),
|
||||
WindowHasFocus(false), WindowMinimized(false), Resizable(false)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
@ -73,7 +75,15 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
|
||||
{
|
||||
SDL_VERSION(&Info.version);
|
||||
|
||||
SDL_GetWindowWMInfo(Window, &Info);
|
||||
if (!SDL_GetWindowWMInfo(Window, &Info))
|
||||
return;
|
||||
#ifdef IOS_STK
|
||||
init_objc(&Info, &NativeScale, &TopPadding, &BottomPadding, &LeftPadding, &RightPadding);
|
||||
Width *= NativeScale;
|
||||
Height *= NativeScale;
|
||||
CreationParams.WindowSize.Width = Width;
|
||||
CreationParams.WindowSize.Height = Height;
|
||||
#endif
|
||||
core::stringc sdlversion = "SDL Version ";
|
||||
sdlversion += Info.version.major;
|
||||
sdlversion += ".";
|
||||
@ -164,6 +174,10 @@ bool CIrrDeviceSDL::createWindow()
|
||||
CreationParams.DriverType == video::EDT_OGLES2)
|
||||
flags |= SDL_WINDOW_OPENGL;
|
||||
|
||||
#ifdef MOBILE_STK
|
||||
flags |= SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_MAXIMIZED;
|
||||
#endif
|
||||
|
||||
tryCreateOpenGLContext(flags);
|
||||
if (!Window || !Context)
|
||||
{
|
||||
@ -344,7 +358,11 @@ void CIrrDeviceSDL::createDriver()
|
||||
case video::EDT_OGLES2:
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
VideoDriver = video::createOGLES2Driver(CreationParams, FileSystem, this);
|
||||
u32 default_fb = 0;
|
||||
#ifdef MOBILE_STK
|
||||
default_fb = Info.info.uikit.framebuffer;
|
||||
#endif
|
||||
VideoDriver = video::createOGLES2Driver(CreationParams, FileSystem, this, default_fb);
|
||||
#else
|
||||
os::Printer::log("No OpenGL ES 2.0 support compiled in.", ELL_ERROR);
|
||||
#endif
|
||||
@ -501,29 +519,33 @@ bool CIrrDeviceSDL::run()
|
||||
break;
|
||||
|
||||
case SDL_WINDOWEVENT:
|
||||
if (SDL_event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED &&
|
||||
((SDL_event.window.data1 != (int)Width) || (SDL_event.window.data2 != (int)Height)))
|
||||
{
|
||||
Width = SDL_event.window.data1;
|
||||
Height = SDL_event.window.data2;
|
||||
if (VideoDriver)
|
||||
VideoDriver->OnResize(core::dimension2d<u32>(Width, Height));
|
||||
}
|
||||
else if (SDL_event.window.event == SDL_WINDOWEVENT_MINIMIZED)
|
||||
{
|
||||
WindowMinimized = true;
|
||||
}
|
||||
else if (SDL_event.window.event == SDL_WINDOWEVENT_MAXIMIZED)
|
||||
{
|
||||
WindowMinimized = false;
|
||||
}
|
||||
else if (SDL_event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED)
|
||||
{
|
||||
WindowHasFocus = true;
|
||||
}
|
||||
else if (SDL_event.window.event == SDL_WINDOWEVENT_FOCUS_LOST)
|
||||
{
|
||||
WindowHasFocus = false;
|
||||
u32 new_width = SDL_event.window.data1 * NativeScale;
|
||||
u32 new_height = SDL_event.window.data2 * NativeScale;
|
||||
if (SDL_event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED &&
|
||||
((new_width != Width) || (new_height != Height)))
|
||||
{
|
||||
Width = new_width;
|
||||
Height = new_height;
|
||||
if (VideoDriver)
|
||||
VideoDriver->OnResize(core::dimension2d<u32>(Width, Height));
|
||||
}
|
||||
else if (SDL_event.window.event == SDL_WINDOWEVENT_MINIMIZED)
|
||||
{
|
||||
WindowMinimized = true;
|
||||
}
|
||||
else if (SDL_event.window.event == SDL_WINDOWEVENT_MAXIMIZED)
|
||||
{
|
||||
WindowMinimized = false;
|
||||
}
|
||||
else if (SDL_event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED)
|
||||
{
|
||||
WindowHasFocus = true;
|
||||
}
|
||||
else if (SDL_event.window.event == SDL_WINDOWEVENT_FOCUS_LOST)
|
||||
{
|
||||
WindowHasFocus = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -613,14 +635,14 @@ video::IVideoModeList* CIrrDeviceSDL::getVideoModeList()
|
||||
if (SDL_GetDesktopDisplayMode(0, &mode) == 0)
|
||||
{
|
||||
VideoModeList.setDesktop(SDL_BITSPERPIXEL(mode.format),
|
||||
core::dimension2d<u32>(mode.w, mode.h));
|
||||
core::dimension2d<u32>(mode.w * NativeScale, mode.h * NativeScale));
|
||||
}
|
||||
|
||||
for (int i = 0; i < mode_count; i++)
|
||||
{
|
||||
if (SDL_GetDisplayMode(0, i, &mode) == 0)
|
||||
{
|
||||
VideoModeList.addMode(core::dimension2d<u32>(mode.w, mode.h),
|
||||
VideoModeList.addMode(core::dimension2d<u32>(mode.w * NativeScale, mode.h * NativeScale),
|
||||
SDL_BITSPERPIXEL(mode.format));
|
||||
}
|
||||
}
|
||||
|
@ -107,6 +107,28 @@ namespace irr
|
||||
|
||||
SDL_Window* getWindow() const { return Window; }
|
||||
|
||||
const SDL_SysWMinfo& getWMInfo() const { return Info; }
|
||||
|
||||
virtual s32 getTopPadding()
|
||||
{
|
||||
return TopPadding * NativeScale;
|
||||
}
|
||||
|
||||
virtual s32 getBottomPadding()
|
||||
{
|
||||
return BottomPadding * NativeScale;
|
||||
}
|
||||
|
||||
virtual s32 getLeftPadding()
|
||||
{
|
||||
return LeftPadding * NativeScale;
|
||||
}
|
||||
|
||||
virtual s32 getRightPadding()
|
||||
{
|
||||
return RightPadding * NativeScale;
|
||||
}
|
||||
|
||||
//! Implementation of the linux cursor control
|
||||
class CCursorControl : public gui::ICursorControl
|
||||
{
|
||||
@ -210,11 +232,17 @@ namespace irr
|
||||
SDL_Window* Window;
|
||||
SDL_GLContext Context;
|
||||
|
||||
f32 NativeScale;
|
||||
s32 MouseX, MouseY;
|
||||
u32 MouseButtonStates;
|
||||
|
||||
u32 Width, Height;
|
||||
|
||||
f32 TopPadding;
|
||||
f32 BottomPadding;
|
||||
f32 LeftPadding;
|
||||
f32 RightPadding;
|
||||
|
||||
bool WindowHasFocus;
|
||||
bool WindowMinimized;
|
||||
bool Resizable;
|
||||
|
@ -9,160 +9,16 @@
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_IOS_DEVICE_
|
||||
|
||||
#include "CIrrDeviceStub.h"
|
||||
#include "IrrlichtDevice.h"
|
||||
#include "IImagePresenter.h"
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
namespace irr
|
||||
{
|
||||
class CIrrDeviceiOS : public CIrrDeviceStub, public video::IImagePresenter
|
||||
{
|
||||
public:
|
||||
CIrrDeviceiOS(const SIrrlichtCreationParameters& params);
|
||||
void swapBuffers();
|
||||
void beginScene();
|
||||
virtual ~CIrrDeviceiOS();
|
||||
|
||||
virtual bool run();
|
||||
virtual void yield();
|
||||
virtual void sleep(u32 timeMs, bool pauseTimer);
|
||||
|
||||
virtual void setWindowCaption(const wchar_t* text);
|
||||
virtual void setWindowClass(const char* text) {}
|
||||
virtual bool moveWindow(int x, int y) { return false; }
|
||||
virtual bool isWindowActive() const;
|
||||
virtual bool isWindowFocused() const;
|
||||
virtual bool isWindowMinimized() const;
|
||||
|
||||
virtual bool present(video::IImage* surface, void * windowId = 0, core::rect<s32>* src = 0);
|
||||
|
||||
virtual void closeDevice();
|
||||
|
||||
virtual void setResizable(bool resize = false);
|
||||
|
||||
virtual void minimizeWindow();
|
||||
virtual void maximizeWindow();
|
||||
virtual void restoreWindow();
|
||||
|
||||
virtual bool getWindowPosition(int* x, int* y);
|
||||
|
||||
virtual bool activateAccelerometer(float updateInterval);
|
||||
virtual bool deactivateAccelerometer();
|
||||
virtual bool isAccelerometerActive();
|
||||
virtual bool isAccelerometerAvailable();
|
||||
virtual bool activateGyroscope(float updateInterval);
|
||||
virtual bool deactivateGyroscope();
|
||||
virtual bool isGyroscopeActive();
|
||||
virtual bool isGyroscopeAvailable();
|
||||
virtual bool activateDeviceMotion(float updateInterval) ;
|
||||
virtual bool deactivateDeviceMotion() ;
|
||||
virtual bool isDeviceMotionActive();
|
||||
virtual bool isDeviceMotionAvailable();
|
||||
virtual E_DEVICE_TYPE getType() const;
|
||||
virtual u32 getScreenHeight() const { return 0; }
|
||||
virtual u32 getOnScreenKeyboardHeight() const { return 0; }
|
||||
virtual s32 getMovedHeight() const { return 0; }
|
||||
virtual void toggleOnScreenKeyboard(bool show, s32 type = 0) {}
|
||||
virtual void registerGetMovedHeightFunction(HeightFunc) {}
|
||||
|
||||
//! Returns true if system has touch device
|
||||
virtual bool supportsTouchDevice() const { return true; }
|
||||
|
||||
//! Returns true if system has hardware keyboard attached
|
||||
virtual bool hasHardwareKeyboard() const { return false; }
|
||||
|
||||
//! Returns true if system has native on screen keyboard
|
||||
virtual bool hasOnScreenKeyboard() const { return false; }
|
||||
|
||||
//! Get a unique touch id per touch, create one if it's a new touch
|
||||
size_t getTouchId(void* touch)
|
||||
{
|
||||
auto it = m_touch_id_map.find(touch);
|
||||
if (it == m_touch_id_map.end())
|
||||
{
|
||||
std::set<size_t> ids;
|
||||
for (auto& p : m_touch_id_map)
|
||||
ids.insert(p.second);
|
||||
size_t cur_id = 0;
|
||||
while (true)
|
||||
{
|
||||
if (ids.find(cur_id) == ids.end())
|
||||
break;
|
||||
cur_id++;
|
||||
}
|
||||
m_touch_id_map[touch] = cur_id;
|
||||
return cur_id;
|
||||
}
|
||||
return it->second;
|
||||
}
|
||||
|
||||
//! Remove a unique touch id, free it for future usage
|
||||
void removeTouchId(void* touch)
|
||||
{
|
||||
m_touch_id_map.erase(touch);
|
||||
}
|
||||
|
||||
//! Clear all unique touch ids, used when the app out focused
|
||||
void clearAllTouchIds()
|
||||
{
|
||||
m_touch_id_map.clear();
|
||||
}
|
||||
void setUpsideDown(bool val) { m_upside_down = val; }
|
||||
void setPaddings(float top, float bottom, float left, float right)
|
||||
{
|
||||
m_top_padding = top;
|
||||
m_bottom_padding = bottom;
|
||||
m_left_padding = left;
|
||||
m_right_padding = right;
|
||||
}
|
||||
static std::string getSystemLanguageCode();
|
||||
static void openURLiOS(const char* url);
|
||||
virtual s32 getTopPadding()
|
||||
{
|
||||
return m_top_padding * m_native_scale;
|
||||
}
|
||||
virtual s32 getBottomPadding()
|
||||
{
|
||||
return m_bottom_padding * m_native_scale;
|
||||
}
|
||||
virtual s32 getLeftPadding()
|
||||
{
|
||||
return m_left_padding * m_native_scale;
|
||||
}
|
||||
virtual s32 getRightPadding()
|
||||
{
|
||||
return m_right_padding * m_native_scale;
|
||||
}
|
||||
static void debugPrint(const char* line);
|
||||
private:
|
||||
void createWindow();
|
||||
void createViewAndDriver();
|
||||
|
||||
void* DataStorage;
|
||||
|
||||
bool Close;
|
||||
|
||||
std::map<void*, size_t> m_touch_id_map;
|
||||
bool m_upside_down;
|
||||
float m_top_padding;
|
||||
float m_bottom_padding;
|
||||
float m_left_padding;
|
||||
float m_right_padding;
|
||||
float m_native_scale;
|
||||
};
|
||||
|
||||
namespace CIrrDeviceiOS
|
||||
{
|
||||
std::string getSystemLanguageCode();
|
||||
void openURLiOS(const char* url);
|
||||
void debugPrint(const char* line);
|
||||
}
|
||||
|
||||
#define _IRR_COMPILE_WITH_IOS_BUILTIN_MAIN_
|
||||
#ifdef _IRR_COMPILE_WITH_IOS_BUILTIN_MAIN_
|
||||
extern int ios_main(int argc, char *argv[]);
|
||||
extern void override_default_params_for_mobile();
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@
|
||||
#include "os.h"
|
||||
#include "IrrlichtDevice.h"
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_IOS_DEVICE_)
|
||||
#ifdef IOS_STK
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#include <OpenGLES/ES2/glext.h>
|
||||
#else
|
||||
@ -44,20 +44,7 @@ namespace video
|
||||
bool useCoreContext = true;
|
||||
|
||||
//! constructor and init code
|
||||
#ifdef _IRR_COMPILE_WITH_IOS_DEVICE_
|
||||
COGLES2Driver::COGLES2Driver(const SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io, IrrlichtDevice* device, u32 default_fb)
|
||||
: CNullDriver(io, params.WindowSize), COGLES2ExtensionHandler(),
|
||||
BridgeCalls(0), CurrentRenderMode(ERM_NONE), ResetRenderStates(true),
|
||||
Transformation3DChanged(true), AntiAlias(params.AntiAlias),
|
||||
RenderTargetTexture(0), CurrentRendertargetSize(0, 0),
|
||||
ColorFormat(ECF_R8G8B8), Params(params), m_default_fb(default_fb)
|
||||
{
|
||||
m_device = device;
|
||||
useCoreContext = !params.ForceLegacyDevice;
|
||||
genericDriverInit(params.WindowSize, params.Stencilbuffer);
|
||||
}
|
||||
#else
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
COGLES2Driver::COGLES2Driver(const SIrrlichtCreationParameters& params,
|
||||
const SExposedVideoData& data, io::IFileSystem* io,
|
||||
IrrlichtDevice* device)
|
||||
@ -164,7 +151,7 @@ namespace video
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
COGLES2Driver::COGLES2Driver(const SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io, CIrrDeviceSDL* device)
|
||||
io::IFileSystem* io, CIrrDeviceSDL* device, u32 default_fb)
|
||||
: CNullDriver(io, params.WindowSize), COGLES2ExtensionHandler(),
|
||||
BridgeCalls(0), CurrentRenderMode(ERM_NONE), ResetRenderStates(true),
|
||||
Transformation3DChanged(true), AntiAlias(params.AntiAlias),
|
||||
@ -173,6 +160,7 @@ namespace video
|
||||
{
|
||||
genericDriverInit(params.WindowSize, params.Stencilbuffer);
|
||||
m_device = device;
|
||||
m_default_fb = default_fb;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -488,8 +476,6 @@ namespace video
|
||||
os::Printer::log("Could not swap buffers for OpenGL-ES2 driver.");
|
||||
return false;
|
||||
}
|
||||
#elif defined(_IRR_COMPILE_WITH_IOS_DEVICE_)
|
||||
static_cast<CIrrDeviceiOS*>(m_device)->swapBuffers();
|
||||
#elif defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
SDL_GL_SwapWindow(static_cast<CIrrDeviceSDL*>(m_device)->getWindow());
|
||||
#endif
|
||||
@ -503,8 +489,10 @@ namespace video
|
||||
const SExposedVideoData& videoData, core::rect<s32>* sourceRect)
|
||||
{
|
||||
CNullDriver::beginScene(backBuffer, zBuffer, color);
|
||||
#if defined(_IRR_COMPILE_WITH_IOS_DEVICE_)
|
||||
static_cast<CIrrDeviceiOS*>(m_device)->beginScene();
|
||||
#ifdef IOS_STK
|
||||
CIrrDeviceSDL* sdl = static_cast<CIrrDeviceSDL*>(m_device);
|
||||
const SDL_SysWMinfo& info = sdl->getWMInfo();
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, info.info.uikit.framebuffer);
|
||||
#endif
|
||||
|
||||
GLbitfield mask = 0;
|
||||
@ -2886,7 +2874,7 @@ namespace irr
|
||||
namespace video
|
||||
{
|
||||
|
||||
#if !defined(_IRR_COMPILE_WITH_IOS_DEVICE_) && (defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_COMPILE_WITH_SDL_DEVICE_) || defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_))
|
||||
#if !defined(_IRR_COMPILE_WITH_IOS_DEVICE_) && (defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_))
|
||||
IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params,
|
||||
video::SExposedVideoData& data, io::IFileSystem* io, IrrlichtDevice* device)
|
||||
{
|
||||
@ -2934,10 +2922,10 @@ namespace video
|
||||
// -----------------------------------
|
||||
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io, CIrrDeviceSDL* device)
|
||||
io::IFileSystem* io, CIrrDeviceSDL* device, u32 default_fb)
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
return new COGLES2Driver(params, io, device);
|
||||
return new COGLES2Driver(params, io, device, default_fb);
|
||||
#else
|
||||
return 0;
|
||||
#endif // _IRR_COMPILE_WITH_OGLES2_
|
||||
|
@ -64,7 +64,7 @@ namespace video
|
||||
friend class COGLES2Texture;
|
||||
|
||||
public:
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_COMPILE_WITH_SDL_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
COGLES2Driver(const SIrrlichtCreationParameters& params,
|
||||
const SExposedVideoData& data,
|
||||
io::IFileSystem* io, IrrlichtDevice* device);
|
||||
@ -81,12 +81,8 @@ namespace video
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
COGLES2Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, CIrrDeviceSDL* device);
|
||||
#endif
|
||||
COGLES2Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, CIrrDeviceSDL* device, u32 default_fb);
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_IOS_DEVICE_)
|
||||
COGLES2Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io,
|
||||
IrrlichtDevice* device, u32 default_fb);
|
||||
virtual u32 getDefaultFramebuffer() const { return m_default_fb; }
|
||||
#endif
|
||||
|
||||
@ -482,7 +478,7 @@ namespace video
|
||||
ContextManagerEGL* EglContext;
|
||||
bool EglContextExternal;
|
||||
#endif
|
||||
#if defined(_IRR_COMPILE_WITH_IOS_DEVICE_)
|
||||
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
u32 m_default_fb;
|
||||
#endif
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
#if defined(_IRR_COMPILE_WITH_IOS_DEVICE_)
|
||||
#ifdef IOS_STK
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#include <OpenGLES/ES2/glext.h>
|
||||
#else
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_IOS_DEVICE_)
|
||||
#ifdef IOS_STK
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#include <OpenGLES/ES2/glext.h>
|
||||
#else
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "irrString.h"
|
||||
|
||||
#if !defined(_IRR_COMPILE_WITH_IOS_DEVICE_)
|
||||
#ifndef IOS_STK
|
||||
#include <GLES2/gl2.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
#include <EGL/egl.h>
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_IOS_DEVICE_)
|
||||
#ifdef IOS_STK
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#else
|
||||
#include <GLES2/gl2.h>
|
||||
|
@ -348,13 +348,11 @@ void IrrDriver::createListOfVideoModes()
|
||||
{
|
||||
const int w = modes->getVideoModeResolution(i).Width;
|
||||
const int h = modes->getVideoModeResolution(i).Height;
|
||||
#ifndef IOS_STK
|
||||
// IOS returns the nativebounds in non uniform size
|
||||
|
||||
if ((h < MIN_SUPPORTED_HEIGHT || w < MIN_SUPPORTED_WIDTH) &&
|
||||
(!(h==600 && w==800 && UserConfigParams::m_artist_debug_mode) &&
|
||||
(!(h==720 && w==1280 && ALLOW_1280_X_720 == true))))
|
||||
continue;
|
||||
#endif
|
||||
|
||||
VideoMode mode(w, h);
|
||||
m_modes.push_back( mode );
|
||||
@ -585,6 +583,24 @@ void IrrDriver::initDevice()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef IOS_STK
|
||||
// After real device is created reload video mode list with native scale
|
||||
video::IVideoModeList* modes = m_device->getVideoModeList();
|
||||
if (UserConfigParams::m_fullscreen)
|
||||
{
|
||||
const core::dimension2d<u32> ssize = modes->getDesktopResolution();
|
||||
if (ssize.Width < 1 || ssize.Height < 1)
|
||||
{
|
||||
Log::warn("irr_driver", "Unknown desktop resolution.");
|
||||
}
|
||||
UserConfigParams::m_width = ssize.Width;
|
||||
UserConfigParams::m_height = ssize.Height;
|
||||
m_modes.clear();
|
||||
VideoMode mode(UserConfigParams::m_width, UserConfigParams::m_height);
|
||||
m_modes.push_back(mode);
|
||||
}
|
||||
#endif
|
||||
|
||||
m_scene_manager = m_device->getSceneManager();
|
||||
m_gui_env = m_device->getGUIEnvironment();
|
||||
m_video_driver = m_device->getVideoDriver();
|
||||
|
@ -2396,7 +2396,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
delete file_manager;
|
||||
|
||||
#ifdef IOS_STK
|
||||
// App store may not like this, but this can happen if player uses keyboard to quit stk
|
||||
exit(0);
|
||||
return 0;
|
||||
#else
|
||||
return 0 ;
|
||||
#endif
|
||||
} // main
|
||||
|
||||
// ============================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user