Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <SDL.h>
- int main()
- {
- // uint32_t windowStyleSDL = SDL_WINDOW_VULKAN;
- SDL_SetHint("SDL_VIDEO_X11_REQUIRE_XRANDR", "1"); // workaround for misbuilt SDL libraries on X11.
- // SDL_SetHint(SDL_HINT_MOUSE_RELATIVE_MODE_SHOW_CURSOR, "1"); // When relative mouse mode is acive, don't hide cursor.
- SDL_SetHint(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "0"); // Don't warp the cursor to the center in relative mouse mode.
- if (SDL_Init((SDL_INIT_EVERYTHING ^ SDL_INIT_AUDIO) | SDL_INIT_NOPARACHUTE) != 0)
- std::cout << "SDL could not be inited.\n";
- SDL_version CompileTimeSDLVersion;
- SDL_version RunTimeSDLVersion;
- SDL_VERSION(&CompileTimeSDLVersion);
- SDL_GetVersion(&RunTimeSDLVersion);
- int SdlRevisionNum = SDL_GetRevisionNumber();
- const char *SdlRevision = SDL_GetRevision();
- std::cout << "Init SDL version: " << (unsigned int)RunTimeSDLVersion.major << "."
- << (unsigned int)RunTimeSDLVersion.minor << "." << (unsigned int)RunTimeSDLVersion.patch
- << " revision: " << SdlRevisionNum << " (" << SdlRevision << ") (compiled against: " << (unsigned int)CompileTimeSDLVersion.major
- << "." << (unsigned int)CompileTimeSDLVersion.minor << "."
- << (unsigned int)CompileTimeSDLVersion.patch << ")\n";
- const char *SdlVideoDriver = SDL_GetCurrentVideoDriver();
- if (SdlVideoDriver)
- std::cout << "Using SDL video driver: " << SdlVideoDriver << "\n";
- SDL_StartTextInput();
- const char *title = "Title";
- const char *message = "message";
- SDL_MessageBoxButtonData *buttons = new SDL_MessageBoxButtonData[2];
- buttons[0].flags = SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT;
- buttons[0].text = "Yes";
- buttons[0].buttonid = 1;
- buttons[1].flags = SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT;
- buttons[1].text = "No";
- buttons[1].buttonid = 0;
- SDL_MessageBoxData messageBoxData =
- {
- SDL_MESSAGEBOX_INFORMATION,
- NULL,
- title,
- message,
- 2,
- buttons,
- NULL
- };
- int buttonPressed = -1;
- if (SDL_ShowMessageBox(&messageBoxData, &buttonPressed) == -1)
- std::cout << "Messagebox could not be shown\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement