SDL 3.0
|
#include <SDL3/SDL_stdinc.h>
#include <SDL3/SDL_error.h>
#include <SDL3/SDL_video.h>
#include <SDL3/SDL_begin_code.h>
#include <SDL3/SDL_close_code.h>
Go to the source code of this file.
Data Structures | |
struct | SDL_MessageBoxButtonData |
struct | SDL_MessageBoxColor |
struct | SDL_MessageBoxColorScheme |
struct | SDL_MessageBoxData |
Macros | |
#define | SDL_MESSAGEBOX_ERROR 0x00000010u |
#define | SDL_MESSAGEBOX_WARNING 0x00000020u |
#define | SDL_MESSAGEBOX_INFORMATION 0x00000040u |
#define | SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT 0x00000080u |
#define | SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT 0x00000100u |
#define | SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT 0x00000001u |
#define | SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT 0x00000002u |
Typedefs | |
typedef Uint32 | SDL_MessageBoxFlags |
typedef Uint32 | SDL_MessageBoxButtonFlags |
Functions | |
bool | SDL_ShowMessageBox (const SDL_MessageBoxData *messageboxdata, int *buttonid) |
bool | SDL_ShowSimpleMessageBox (SDL_MessageBoxFlags flags, const char *title, const char *message, SDL_Window *window) |
#define SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT 0x00000002u |
Marks the default button when escape is hit
Definition at line 75 of file SDL_messagebox.h.
#define SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT 0x00000001u |
Marks the default button when return is hit
Definition at line 74 of file SDL_messagebox.h.
#define SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT 0x00000080u |
buttons placed left to right
Definition at line 64 of file SDL_messagebox.h.
#define SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT 0x00000100u |
buttons placed right to left
Definition at line 65 of file SDL_messagebox.h.
#define SDL_MESSAGEBOX_ERROR 0x00000010u |
error dialog
Definition at line 61 of file SDL_messagebox.h.
#define SDL_MESSAGEBOX_INFORMATION 0x00000040u |
informational dialog
Definition at line 63 of file SDL_messagebox.h.
#define SDL_MESSAGEBOX_WARNING 0x00000020u |
warning dialog
Definition at line 62 of file SDL_messagebox.h.
typedef Uint32 SDL_MessageBoxButtonFlags |
SDL_MessageBoxButtonData flags.
Definition at line 72 of file SDL_messagebox.h.
typedef Uint32 SDL_MessageBoxFlags |
SDL offers a simple message box API, which is useful for simple alerts, such as informing the user when something fatal happens at startup without the need to build a UI for it (or informing the user before your UI is ready).
These message boxes are native system dialogs where possible.
There is both a customizable function (SDL_ShowMessageBox()) that offers lots of options for what to display and reports on what choice the user made, and also a much-simplified version (SDL_ShowSimpleMessageBox()), merely takes a text message and title, and waits until the user presses a single "OK" UI button. Often, this is all that is necessary. Message box flags.
If supported will display warning icon, etc.
Definition at line 59 of file SDL_messagebox.h.
An enumeration of indices inside the colors array of SDL_MessageBoxColorScheme.
Enumerator | |
---|---|
SDL_MESSAGEBOX_COLOR_BACKGROUND | |
SDL_MESSAGEBOX_COLOR_TEXT | |
SDL_MESSAGEBOX_COLOR_BUTTON_BORDER | |
SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND | |
SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED | |
SDL_MESSAGEBOX_COLOR_COUNT | Size of the colors array of SDL_MessageBoxColorScheme. |
Definition at line 103 of file SDL_messagebox.h.
|
extern |
Create a modal message box.
If your needs aren't complex, it might be easier to use SDL_ShowSimpleMessageBox.
This function should be called on the thread that created the parent window, or on the main thread if the messagebox has no parent. It will block execution of that thread until the user clicks a button or closes the messagebox.
This function may be called at any time, even before SDL_Init(). This makes it useful for reporting errors like a failure to create a renderer or OpenGL context.
On X11, SDL rolls its own dialog box with X11 primitives instead of a formal toolkit like GTK+ or Qt.
Note that if SDL_Init() would fail because there isn't any available video target, this function is likely to fail for the same reasons. If this is a concern, check the return value from this function and fall back to writing to stderr if you can.
messageboxdata | the SDL_MessageBoxData structure with title, text and other options. |
buttonid | the pointer to which user id of hit button should be copied. |
|
extern |
Display a simple modal message box.
If your needs aren't complex, this function is preferred over SDL_ShowMessageBox.
flags
may be any of the following:
SDL_MESSAGEBOX_ERROR
: error dialogSDL_MESSAGEBOX_WARNING
: warning dialogSDL_MESSAGEBOX_INFORMATION
: informational dialogThis function should be called on the thread that created the parent window, or on the main thread if the messagebox has no parent. It will block execution of that thread until the user clicks a button or closes the messagebox.
This function may be called at any time, even before SDL_Init(). This makes it useful for reporting errors like a failure to create a renderer or OpenGL context.
On X11, SDL rolls its own dialog box with X11 primitives instead of a formal toolkit like GTK+ or Qt.
Note that if SDL_Init() would fail because there isn't any available video target, this function is likely to fail for the same reasons. If this is a concern, check the return value from this function and fall back to writing to stderr if you can.
flags | an SDL_MessageBoxFlags value. |
title | UTF-8 title text. |
message | UTF-8 message text. |
window | the parent window, or NULL for no parent. |