diff --git a/MiniEngine.cpp b/MiniEngine.cpp index 3592dce..6610d61 100644 --- a/MiniEngine.cpp +++ b/MiniEngine.cpp @@ -1243,6 +1243,11 @@ namespace MiniEngine return SDL_ShowSimpleMessageBox(flags,Title.c_str(),Message.c_str(),_get()); } + bool Window::isScreenKeyboardShown() + { + return SDL_IsScreenKeyboardShown(_get())==SDL_TRUE; + } + void Font::_set(TTF_Font* p) { _font.reset(p,TTF_CloseFont); @@ -1728,11 +1733,22 @@ namespace MiniEngine SDL_StartTextInput(); } + bool SDLSystem::IsTextInputActive() + { + return SDL_IsTextInputActive()==SDL_TRUE; + } + void SDLSystem::StopTextInput() { SDL_StopTextInput(); } + //static + bool SDLSystem::HasScreenKeyboardSupport() + { + return SDL_HasScreenKeyboardSupport()==SDL_TRUE; + } + /// Global Executor For class Timer Uint32 _global_timer_executor(Uint32 interval,void* param) { @@ -2099,6 +2115,11 @@ namespace MiniEngine return SDL_HasClipboardText()==SDL_TRUE; } + bool GetScanKeyState(SDL_Scancode code) + { + return SDL_GetKeyboardState(NULL)[code]; + } + }/// End of namespace MiniEngine /// The Following Functions are not avaliable in Visual Studio diff --git a/MiniEngine.h b/MiniEngine.h index 6420e6d..1641f8b 100644 --- a/MiniEngine.h +++ b/MiniEngine.h @@ -273,6 +273,7 @@ namespace MiniEngine class Window { public: + Window()=default; Window(std::string Title, int Width, int Height, std::initializer_list RendererFlags = { RendererType::Accelerated,RendererType::TargetTexture }, std::initializer_list WindowFlags = {WindowType::Shown} , @@ -281,15 +282,15 @@ namespace MiniEngine void setRenderer(RendererType Type) { - _internal_rndflagcalc=0; - _setRenderer(Type); + int flagcalc=0; + _setRenderer(flagcalc,Type); } template void setRenderer(RendererType Type,Args&&... args) { - _internal_rndflagcalc=0; - _setRenderer(Type,std::forward(args...)); + int flagcalc=0; + _setRenderer(flagcalc,Type,std::forward(args...)); } void setRenderer(std::initializer_list); @@ -324,23 +325,24 @@ namespace MiniEngine _DECL_DEPRECATED Surface getSurface(); + bool isScreenKeyboardShown(); + void release(); protected: template - void _setRenderer(RendererType Type,Args&&... args) + void _setRenderer(int& refcalc,RendererType Type,Args&&... args) { - _internal_rndflagcalc|=_render_caster(Type); + refcalc|=_render_caster(Type); _setRenderer(args...); } - void _setRenderer(RendererType Type) + void _setRenderer(int& refcalc,RendererType Type) { - _internal_rndflagcalc|=_render_caster(Type); - _setRenderer_Real(_internal_rndflagcalc); + refcalc|=_render_caster(Type); + _setRenderer_Real(refcalc); } private: void _setRenderer_Real(Uint32 flags); - Uint32 _internal_rndflagcalc; Uint32 _render_caster(RendererType); std::shared_ptr _wnd; @@ -489,8 +491,11 @@ namespace MiniEngine static Platform GetPlatform(); static void StartTextInput(); + static bool IsTextInputActive(); static void StopTextInput(); + bool HasScreenKeyboardSupport(); + class Android { public: @@ -654,6 +659,9 @@ namespace MiniEngine std::string GetClipboardText(); bool HasClipboardText(); + /// Experimental - For Experts: Use SDL ScanCode + bool GetScanKeyState(SDL_Scancode); + }/// End of namespace MiniEngine std::string UTF8ToGBK(std::string UTF8String);