From 88e891a048cc2b0c9f7b201bf62fa9845d182aeb Mon Sep 17 00:00:00 2001 From: ludolpif Date: Sun, 29 Nov 2026 00:01:11 +0100 Subject: feat(app): SDL3 Hello World with meson build files and scripts for linux only Signed-off-by: ludolpif --- src/app/main.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/app/main.c (limited to 'src/app') diff --git a/src/app/main.c b/src/app/main.c new file mode 100644 index 0000000..52f39c2 --- /dev/null +++ b/src/app/main.c @@ -0,0 +1,68 @@ +/* + * ASS (Advanced Streaming Software) - Thin Application Bootstrap + * This file is part of ASS. + * + * ASS is free software: you can redistribute it and/or modify it under the terms of the Affero GNU + * General Public License as published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * ASS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Affero GNU + * General Public License for more details. + * + * You should have received a copy of the Affero GNU General Public License along with ASS. + * If not, see + * + * Copyright 2026 ludolpif + */ + +#define SDL_MAIN_USE_CALLBACKS 1 +#include +#include +#include "ass_metadata.h" +#include "version.h" + +SDL_AppResult SDL_AppInit(void** appstate, int argc, char* argv[]) +{ + (void) argc; + (void) argv; + SDL_SetAppMetadata(ASS_APP_NAME, ASS_VERSION_STRING, ASS_APP_IDENTIFIER); + SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_CREATOR_STRING, ASS_APP_CREATOR); + SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_COPYRIGHT_STRING, ASS_APP_COPYRIGHT); + SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_URL_STRING, ASS_APP_URL); + SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_TYPE_STRING, ASS_APP_TYPE); + + + if (!SDL_Init(SDL_INIT_VIDEO)) { + return SDL_APP_FAILURE; + } + SDL_Window *window = SDL_CreateWindow("Hello World", 640, 480, 0); + if (!window) { + return SDL_APP_FAILURE; + } + + *appstate = window; + return SDL_APP_CONTINUE; +} + +SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event) +{ + (void) appstate; + if (event->type == SDL_EVENT_QUIT) { + return SDL_APP_SUCCESS; + } + return SDL_APP_CONTINUE; +} + +SDL_AppResult SDL_AppIterate(void* appstate) +{ + (void) appstate; + return SDL_APP_CONTINUE; +} + +void SDL_AppQuit(void* appstate, SDL_AppResult result) +{ + (void) result; + SDL_Window *window = (SDL_Window *)appstate; + SDL_DestroyWindow(window); +} -- cgit v1.2.3