Skip to content

Commit

Permalink
Remove newlines from SDL_Log() messages
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 29, 2025
1 parent 4ce8b81 commit a11037f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions examples/editbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ static bool HandleMouseDown(EditBox *edit, float x, float y)
int textX = (int)SDL_roundf(x - edit->rect.x);
int textY = (int)SDL_roundf(y - edit->rect.y);
if (!TTF_GetTextSubStringForPoint(edit->text, textX, textY, &substring)) {
SDL_Log("Couldn't get cursor location: %s\n", SDL_GetError());
SDL_Log("Couldn't get cursor location: %s", SDL_GetError());
return false;
}

Expand All @@ -737,7 +737,7 @@ static bool HandleMouseMotion(EditBox *edit, float x, float y)
int textX = (int)SDL_roundf(x - edit->rect.x);
int textY = (int)SDL_roundf(y - edit->rect.y);
if (!TTF_GetTextSubStringForPoint(edit->text, textX, textY, &substring)) {
SDL_Log("Couldn't get cursor location: %s\n", SDL_GetError());
SDL_Log("Couldn't get cursor location: %s", SDL_GetError());
return false;
}

Expand Down
24 changes: 12 additions & 12 deletions examples/showfont.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ static void HandleKeyDown(Scene *scene, SDL_Event *event)
TTF_SetFontWrapAlignment(scene->font, TTF_HORIZONTAL_ALIGN_LEFT);
break;
default:
SDL_Log("Unknown wrap alignment: %d\n", TTF_GetFontWrapAlignment(scene->font));
SDL_Log("Unknown wrap alignment: %d", TTF_GetFontWrapAlignment(scene->font));
break;
}
break;
Expand Down Expand Up @@ -313,7 +313,7 @@ int main(int argc, char *argv[])
if (num_fallbacks < MAX_FALLBACKS) {
fallback_font_files[num_fallbacks++] = argv[i];
} else {
SDL_Log("Too many fallback fonts (maximum = %d)\n", MAX_FALLBACKS);
SDL_Log("Too many fallback fonts (maximum = %d)", MAX_FALLBACKS);
return(1);
}
} else
Expand Down Expand Up @@ -426,7 +426,7 @@ int main(int argc, char *argv[])

/* Initialize the TTF library */
if (!TTF_Init()) {
SDL_Log("Couldn't initialize TTF: %s\n",SDL_GetError());
SDL_Log("Couldn't initialize TTF: %s",SDL_GetError());
result = 2;
goto done;
}
Expand All @@ -444,7 +444,7 @@ int main(int argc, char *argv[])
}
font = TTF_OpenFont(argv[0], ptsize);
if (font == NULL) {
SDL_Log("Couldn't load %g pt font from %s: %s\n",
SDL_Log("Couldn't load %g pt font from %s: %s",
ptsize, argv[0], SDL_GetError());
result = 2;
goto done;
Expand All @@ -459,7 +459,7 @@ int main(int argc, char *argv[])
for (i = 0; i < num_fallbacks; ++i) {
fallback_fonts[i] = TTF_OpenFont(fallback_font_files[i], ptsize);
if (!fallback_fonts[i]) {
SDL_Log("Couldn't load %g pt font from %s: %s\n",
SDL_Log("Couldn't load %g pt font from %s: %s",
ptsize, fallback_font_files[i], SDL_GetError());
result = 2;
goto done;
Expand Down Expand Up @@ -487,14 +487,14 @@ int main(int argc, char *argv[])
/* Create a window */
scene.window = SDL_CreateWindow("showfont demo", WIDTH, HEIGHT, 0);
if (!scene.window) {
SDL_Log("SDL_CreateWindow() failed: %s\n", SDL_GetError());
SDL_Log("SDL_CreateWindow() failed: %s", SDL_GetError());
result = 2;
goto done;
}
if (scene.textEngine == TextEngineSurface) {
scene.window_surface = SDL_GetWindowSurface(scene.window);
if (!scene.window_surface) {
SDL_Log("SDL_CreateWindowSurface() failed: %s\n", SDL_GetError());
SDL_Log("SDL_CreateWindowSurface() failed: %s", SDL_GetError());
result = 2;
goto done;
}
Expand All @@ -508,7 +508,7 @@ int main(int argc, char *argv[])
}
}
if (!scene.renderer) {
SDL_Log("SDL_CreateRenderer() failed: %s\n", SDL_GetError());
SDL_Log("SDL_CreateRenderer() failed: %s", SDL_GetError());
result = 2;
goto done;
}
Expand All @@ -517,15 +517,15 @@ int main(int argc, char *argv[])
case TextEngineSurface:
engine = TTF_CreateSurfaceTextEngine();
if (!engine) {
SDL_Log("Couldn't create surface text engine: %s\n", SDL_GetError());
SDL_Log("Couldn't create surface text engine: %s", SDL_GetError());
result = 2;
goto done;
}
break;
case TextEngineRenderer:
engine = TTF_CreateRendererTextEngine(scene.renderer);
if (!engine) {
SDL_Log("Couldn't create renderer text engine: %s\n", SDL_GetError());
SDL_Log("Couldn't create renderer text engine: %s", SDL_GetError());
result = 2;
goto done;
}
Expand Down Expand Up @@ -572,7 +572,7 @@ int main(int argc, char *argv[])
break;
}
if (text == NULL) {
SDL_Log("Couldn't render text: %s\n", SDL_GetError());
SDL_Log("Couldn't render text: %s", SDL_GetError());
result = 2;
goto done;
}
Expand All @@ -581,7 +581,7 @@ int main(int argc, char *argv[])
scene.messageRect.w = (float)text->w;
scene.messageRect.h = (float)text->h;
scene.message = SDL_CreateTextureFromSurface(scene.renderer, text);
SDL_Log("Font is generally %d big, and string is %d big\n",
SDL_Log("Font is generally %d big, and string is %d big",
TTF_GetFontHeight(font), text->h);

if (editbox) {
Expand Down
4 changes: 2 additions & 2 deletions examples/testapp.c
Original file line number Diff line number Diff line change
Expand Up @@ -929,14 +929,14 @@ int main(void)
if (!engine_surface) {
engine_surface = TTF_CreateSurfaceTextEngine();
if (!engine_surface) {
SDL_Log("Couldn't create surface text engine: %s\n", SDL_GetError());
SDL_Log("Couldn't create surface text engine: %s", SDL_GetError());
}
}

if (!engine_renderer) {
engine_renderer = TTF_CreateRendererTextEngine(renderer);
if (!engine_renderer) {
SDL_Log("Couldn't create renderer text engine: %s\n", SDL_GetError());
SDL_Log("Couldn't create renderer text engine: %s", SDL_GetError());
}

}
Expand Down

0 comments on commit a11037f

Please sign in to comment.