Initial Commit
This commit is contained in:
37
thirdparty/SDL3-3.4.0/cmake/test/main_gui.c
vendored
Normal file
37
thirdparty/SDL3-3.4.0/cmake/test/main_gui.c
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
#define SDL_MAIN_USE_CALLBACKS
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
static SDL_Window *window;
|
||||
|
||||
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
|
||||
{
|
||||
return SDL_APP_CONTINUE;
|
||||
}
|
||||
|
||||
SDL_AppResult SDL_AppIterate(void *appstate)
|
||||
{
|
||||
SDL_Surface *screenSurface = NULL;
|
||||
screenSurface = SDL_GetWindowSurface(window);
|
||||
SDL_FillSurfaceRect(screenSurface, NULL, SDL_MapSurfaceRGB(screenSurface, 0xff, 0xff, 0xff));
|
||||
SDL_UpdateWindowSurface(window);
|
||||
return SDL_APP_CONTINUE;
|
||||
}
|
||||
|
||||
SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
|
||||
{
|
||||
if (!SDL_Init(SDL_INIT_VIDEO)) {
|
||||
SDL_Log("Could not initialize SDL: %s", SDL_GetError());
|
||||
return SDL_APP_FAILURE;
|
||||
}
|
||||
window = SDL_CreateWindow("Hello SDL", 640, 480, 0);
|
||||
if (!window) {
|
||||
SDL_Log("could not create window: %s", SDL_GetError());
|
||||
return SDL_APP_FAILURE;
|
||||
}
|
||||
return SDL_APP_CONTINUE;
|
||||
}
|
||||
|
||||
void SDL_AppQuit(void *appstate, SDL_AppResult result) {
|
||||
SDL_DestroyWindow(window);
|
||||
}
|
||||
Reference in New Issue
Block a user