mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-11-04 01:34:38 +00:00 
			
		
		
		
	examples: add basic app metadata to all existing examples.
This commit is contained in:
		@@ -21,6 +21,8 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    SDL_AudioSpec spec;
 | 
					    SDL_AudioSpec spec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example Audio Simple Playback", "1.0", "com.example.audio-simple-playback");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -53,6 +53,8 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    SDL_AudioSpec spec;
 | 
					    SDL_AudioSpec spec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example Simple Audio Playback Callback", "1.0", "com.example.audio-simple-playback-callback");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,6 +31,8 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			|||||||
    SDL_AudioSpec spec;
 | 
					    SDL_AudioSpec spec;
 | 
				
			||||||
    char *wav_path = NULL;
 | 
					    char *wav_path = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example Audio Load Wave", "1.0", "com.example.audio-load-wav");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,6 +26,8 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			|||||||
    SDL_CameraID *devices = NULL;
 | 
					    SDL_CameraID *devices = NULL;
 | 
				
			||||||
    int devcount = 0;
 | 
					    int devcount = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example Camera Read and Draw", "1.0", "com.example.camera-read-and-draw");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_CAMERA)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_CAMERA)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,6 +23,8 @@ static float previous_touch_y = -1.0f;
 | 
				
			|||||||
/* This function runs once at startup. */
 | 
					/* This function runs once at startup. */
 | 
				
			||||||
SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
					SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example Pen Drawing Lines", "1.0", "com.example.pen-drawing-lines");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,6 +17,8 @@ static SDL_Renderer *renderer = NULL;
 | 
				
			|||||||
/* This function runs once at startup. */
 | 
					/* This function runs once at startup. */
 | 
				
			||||||
SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
					SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example Renderer Clear", "1.0", "com.example.renderer-clear");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,6 +19,8 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    int i;
 | 
					    int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example Renderer Primitives", "1.0", "com.example.renderer-primitives");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,6 +16,8 @@ static SDL_Renderer *renderer = NULL;
 | 
				
			|||||||
/* This function runs once at startup. */
 | 
					/* This function runs once at startup. */
 | 
				
			||||||
SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
					SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example Renderer Lines", "1.0", "com.example.renderer-lines");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,6 +36,8 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    int i;
 | 
					    int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example Renderer Points", "1.0", "com.example.renderer-points");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,6 +19,8 @@ static SDL_Renderer *renderer = NULL;
 | 
				
			|||||||
/* This function runs once at startup. */
 | 
					/* This function runs once at startup. */
 | 
				
			||||||
SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
					SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example Renderer Rectangles", "1.0", "com.example.renderer-rectangles");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,6 +25,8 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			|||||||
    SDL_Surface *surface = NULL;
 | 
					    SDL_Surface *surface = NULL;
 | 
				
			||||||
    char *bmp_path = NULL;
 | 
					    char *bmp_path = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example Renderer Textures", "1.0", "com.example.renderer-textures");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,6 +22,8 @@ static SDL_Texture *texture = NULL;
 | 
				
			|||||||
/* This function runs once at startup. */
 | 
					/* This function runs once at startup. */
 | 
				
			||||||
SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
					SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example Renderer Streaming Textures", "1.0", "com.example.renderer-streaming-textures");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,6 +25,8 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			|||||||
    SDL_Surface *surface = NULL;
 | 
					    SDL_Surface *surface = NULL;
 | 
				
			||||||
    char *bmp_path = NULL;
 | 
					    char *bmp_path = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example Renderer Rotating Textures", "1.0", "com.example.renderer-rotating-textures");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,6 +25,8 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			|||||||
    SDL_Surface *surface = NULL;
 | 
					    SDL_Surface *surface = NULL;
 | 
				
			||||||
    char *bmp_path = NULL;
 | 
					    char *bmp_path = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example Renderer Scaling Textures", "1.0", "com.example.renderer-scaling-textures");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,6 +25,8 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			|||||||
    SDL_Surface *surface = NULL;
 | 
					    SDL_Surface *surface = NULL;
 | 
				
			||||||
    char *bmp_path = NULL;
 | 
					    char *bmp_path = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example Renderer Geometry", "1.0", "com.example.renderer-geometry");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,6 +25,8 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			|||||||
    SDL_Surface *surface = NULL;
 | 
					    SDL_Surface *surface = NULL;
 | 
				
			||||||
    char *bmp_path = NULL;
 | 
					    char *bmp_path = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example Renderer Color Mods", "1.0", "com.example.renderer-color-mods");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,6 +25,8 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			|||||||
    SDL_Surface *surface = NULL;
 | 
					    SDL_Surface *surface = NULL;
 | 
				
			||||||
    char *bmp_path = NULL;
 | 
					    char *bmp_path = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example Renderer Viewport", "1.0", "com.example.renderer-viewport");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,6 +32,8 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			|||||||
    SDL_Surface *surface = NULL;
 | 
					    SDL_Surface *surface = NULL;
 | 
				
			||||||
    char *bmp_path = NULL;
 | 
					    char *bmp_path = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example Renderer Clipping Rectangle", "1.0", "com.example.renderer-cliprect");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,6 +34,8 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			|||||||
    SDL_Surface *surface = NULL;
 | 
					    SDL_Surface *surface = NULL;
 | 
				
			||||||
    char *bmp_path = NULL;
 | 
					    char *bmp_path = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example Renderer Read Pixels", "1.0", "com.example.renderer-read-pixels");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,6 +16,8 @@ static SDL_Renderer *renderer = NULL;
 | 
				
			|||||||
/* This function runs once at startup. */
 | 
					/* This function runs once at startup. */
 | 
				
			||||||
SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
					SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    SDL_SetAppMetadata("Example HUMAN READABLE NAME", "1.0", "com.example.CATEGORY-NAME");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO)) {
 | 
				
			||||||
        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
					        SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
 | 
				
			||||||
        return SDL_APP_FAILURE;
 | 
					        return SDL_APP_FAILURE;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user