mirror of https://github.com/libsdl-org/SDL.git
snake: Add extended app metadata
All of these are optional, but nice-to-have, and we have reasonable values available for all of them. Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
ca82405d5a
commit
ee7f61fd9a
|
|
@ -281,12 +281,32 @@ SDL_AppResult SDL_AppIterate(void *appstate)
|
|||
return SDL_APP_CONTINUE;
|
||||
}
|
||||
|
||||
static const struct
|
||||
{
|
||||
const char *key;
|
||||
const char *value;
|
||||
} extended_metadata[] =
|
||||
{
|
||||
{ SDL_PROP_APP_METADATA_URL_STRING, "https://examples.libsdl.org/SDL3/game/01-snake/" },
|
||||
{ SDL_PROP_APP_METADATA_CREATOR_STRING, "SDL team" },
|
||||
{ SDL_PROP_APP_METADATA_COPYRIGHT_STRING, "Placed in the public domain" },
|
||||
{ SDL_PROP_APP_METADATA_TYPE_STRING, "game" }
|
||||
};
|
||||
|
||||
SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (!SDL_SetAppMetadata("Example Snake game", "1.0", "com.example.Snake")) {
|
||||
return SDL_APP_FAILURE;
|
||||
}
|
||||
|
||||
for (i = 0; i < SDL_arraysize(extended_metadata); i++) {
|
||||
if (!SDL_SetAppMetadataProperty(extended_metadata[i].key, extended_metadata[i].value)) {
|
||||
return SDL_APP_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!SDL_Init(SDL_INIT_VIDEO)) {
|
||||
return SDL_APP_FAILURE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue