Class SdlMessagebox
- java.lang.Object
-
- io.github.libsdl4j.api.messagebox.SdlMessagebox
-
public final class SdlMessagebox extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
SDL_ShowMessageBox(SDL_MessageBoxData messageboxdata, com.sun.jna.ptr.IntByReference buttonid)
Create a modal message box.static int
SDL_ShowSimpleMessageBox(int flags, String title, String message, SDL_Window window)
Display a simple modal message box.
-
-
-
Method Detail
-
SDL_ShowMessageBox
public static int SDL_ShowMessageBox(SDL_MessageBoxData messageboxdata, com.sun.jna.ptr.IntByReference buttonid)
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.
- Parameters:
messageboxdata
- the SDL_MessageBoxData structure with title, text and other optionsbuttonid
- the pointer to which user id of hit button should be copied- Returns:
- 0 on success or a negative error code on failure; call SDL_GetError() for more information.
- Since:
- This function is available since SDL 2.0.0.
- See Also:
SDL_ShowSimpleMessageBox(int, String, String, SDL_Window)
-
SDL_ShowSimpleMessageBox
public static int SDL_ShowSimpleMessageBox(int flags, String title, String message, SDL_Window window)
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 dialog
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.
- Parameters:
flags
- an SDL_MessageBoxFlags valuetitle
- UTF-8 title textmessage
- UTF-8 message textwindow
- the parent window, or null for no parent- Returns:
- 0 on success or a negative error code on failure; call SDL_GetError() for more information.
- Since:
- This function is available since SDL 2.0.0.
- See Also:
SDL_ShowMessageBox(SDL_MessageBoxData, IntByReference)
-
-