mirror of
https://github.com/love2d/love.git
synced 2026-08-13 17:10:54 +02:00
Added love.window.showMessageBox.
It has two variants: showMessageBox(type, title, message [, attachtowindow=true]), and showMessageBox(type, title, message, buttons [, attachtowindow=true]). The former shows a simple message box with a single OK button, and the latter displays several buttons. The buttons argument is an array of button names. The second variant returns the index of the pressed button, or 0 if the message box was closed some other way. showMessageBox will block until the message box is closed (and it can't be called on a separate thread.)
This commit is contained in:
@@ -74,6 +74,16 @@ bool Window::getConstant(Window::Setting in, const char *&out)
|
||||
return settings.find(in, out);
|
||||
}
|
||||
|
||||
bool Window::getConstant(const char *in, MessageBoxType &out)
|
||||
{
|
||||
return messageBoxTypes.find(in, out);
|
||||
}
|
||||
|
||||
bool Window::getConstant(MessageBoxType in, const char *&out)
|
||||
{
|
||||
return messageBoxTypes.find(in, out);
|
||||
}
|
||||
|
||||
StringMap<Window::Setting, Window::SETTING_MAX_ENUM>::Entry Window::settingEntries[] =
|
||||
{
|
||||
{"fullscreen", SETTING_FULLSCREEN},
|
||||
@@ -101,5 +111,14 @@ StringMap<Window::FullscreenType, Window::FULLSCREEN_TYPE_MAX_ENUM>::Entry Windo
|
||||
|
||||
StringMap<Window::FullscreenType, Window::FULLSCREEN_TYPE_MAX_ENUM> Window::fullscreenTypes(Window::fullscreenTypeEntries, sizeof(Window::fullscreenTypeEntries));
|
||||
|
||||
StringMap<Window::MessageBoxType, Window::MESSAGEBOX_MAX_ENUM>::Entry Window::messageBoxTypeEntries[] =
|
||||
{
|
||||
{"error", Window::MESSAGEBOX_ERROR},
|
||||
{"warning", Window::MESSAGEBOX_WARNING},
|
||||
{"info", Window::MESSAGEBOX_INFO},
|
||||
};
|
||||
|
||||
StringMap<Window::MessageBoxType, Window::MESSAGEBOX_MAX_ENUM> Window::messageBoxTypes(Window::messageBoxTypeEntries, sizeof(Window::messageBoxTypeEntries));
|
||||
|
||||
} // window
|
||||
} // love
|
||||
|
||||
Reference in New Issue
Block a user