SimpleMessageBox are supported.

Use: SDL_ShowSimpleMessageBox
This commit is contained in:
Kirigaya Kazuto 2017-03-21 13:58:48 +08:00
parent 3e0b0739ba
commit 2c1f055a49
2 changed files with 23 additions and 0 deletions

View File

@ -488,6 +488,24 @@ namespace MiniEngine
winrnd.rnd.reset(SDL_CreateRenderer(wnd.get(), -1, flags), SDL_DestroyRenderer); winrnd.rnd.reset(SDL_CreateRenderer(wnd.get(), -1, flags), SDL_DestroyRenderer);
} }
int Window::showSimpleMessageBox(MessageBoxType type,std::string Title,std::string Message)
{
Uint32 flags=0;
switch(type)
{
case MessageBoxType::Error:
flags=SDL_MESSAGEBOX_ERROR;
break;
case MessageBoxType::Information:
flags=SDL_MESSAGEBOX_INFORMATION;
break;
case MessageBoxType::Warning:
flags=SDL_MESSAGEBOX_WARNING;
break;
}
return SDL_ShowSimpleMessageBox(flags,Title.c_str(),Message.c_str(),wnd.get());
}
Font::Font(std::string FontFileName, int size) throw(ErrorViewer) Font::Font(std::string FontFileName, int size) throw(ErrorViewer)
{ {
if (use(FontFileName, size) != 0) if (use(FontFileName, size) != 0)

View File

@ -163,6 +163,8 @@ namespace MiniEngine
friend class Window; friend class Window;
}; };
enum class MessageBoxType { Error,Warning,Information };
class Window class Window
{ {
public: public:
@ -186,6 +188,9 @@ namespace MiniEngine
void setResizable(bool resizable); void setResizable(bool resizable);
/// Use UTF8 in Title and Message please.
int showSimpleMessageBox(MessageBoxType type,std::string Title,std::string Message);
void show(); void show();
void hide(); void hide();
void raise(); void raise();