Skip to content

Commit

Permalink
fix build after SDL_WaitEvent return type change in SDL3
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Nov 5, 2023
1 parent b98704a commit 9ca6c7d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
4 changes: 1 addition & 3 deletions examples/showfont.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ int main(int argc, char *argv[])
/* Wait for a keystroke, and blit text on mouse press */
done = 0;
while (!done) {
if (SDL_WaitEvent(&event) < 0) {
if (!SDL_WaitEvent(&event)) {
SDL_Log("SDL_PullEvent() error: %s\n", SDL_GetError());
done = 1;
continue;
Expand Down Expand Up @@ -368,5 +368,3 @@ int main(int argc, char *argv[])
/* Not reached, but fixes compiler warnings */
return 0;
}

/* vi: set ts=4 sw=4 expandtab: */
21 changes: 1 addition & 20 deletions examples/testapp.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,6 @@ static const char *test_strings[] = {
"hvlSZ6jE2BU9ImjUjQiY255GA5ASfUUx",
"e9o4tBCA9TCpilOI05UyHzes6s8lP9lQ",
"gJyC26gZsCKR8wSp9kNMYKJRRgA3u45U1DWdzPCWv1SUEKi3Wdo3zNFTWiMcCfcl5A0MzOhbqRee7OP13NruY WP0ufGiB4W9RBWqgSy7umnE6puTyCc9WhPOzdLz168BhQwYetZkADWibObi8jcYajuUv54zxXkXQwC1B8lAi8rIH9lmIy0G10fQ832HKiLx"


};
static const int test_strings_count = SDL_arraysize(test_strings);
static const char *font_path = NULL;
Expand All @@ -350,7 +348,7 @@ static int wait_for_input(void)
SDL_Event event;

while (!done) {
if (SDL_WaitEvent(&event) < 0) {
if (!SDL_WaitEvent(&event)) {
quit("Event handling");
}

Expand Down Expand Up @@ -633,8 +631,6 @@ int main(void)
T_min = SDL_min(T_min, T2 - T1); \




if (SDL_Init(SDL_INIT_VIDEO) < 0) {
quit("SDL init failed");
}
Expand Down Expand Up @@ -693,20 +689,12 @@ int main(void)

//seed=1673390190; replay=1; font_style=9; kerning=1; sdf=0; wrap=1; wrap_size=94; w_align=2; outline=7; curr_size=42; render_mode=1; curr_str=75; curr_font=1997; hinting=1; fg_alpha=90; // light Blended







if (replay) {
SDL_Log("Replay with string _%s_", test_strings[curr_str]);
}


while (1)
{

/* Normal mode <space>, try all combination {strings}x{render_mode} and exit
This updates "render_mode" and "curr_str" */
if (!mode_random_test && !replay) {
Expand Down Expand Up @@ -817,8 +805,6 @@ int main(void)
}
#endif



{
// static const char *hinting_desc[] = { "normal", "light", "light_subpix", "mono", "none" };
// static const char *hinting_desc[] = { "normal", "light", "light_subpix", "lcd_subpix", "mono", "none" };
Expand All @@ -836,7 +822,6 @@ int main(void)
}
}


/* Get some console output out in case we crash next... */
if (! mode_random_test) {
char title[1024];
Expand Down Expand Up @@ -889,8 +874,6 @@ int main(void)
SDL_Log("font_style=%d; kerning=%d; wrap=%d; wrap_size=%d; outline=%d; curr_size=%d; render_mode=%d; curr_str=%d; curr_font=%d; hinting=%d;",
font_style, kerning, wrap, wrap_size, outline, curr_size, render_mode, curr_str, curr_font, hinting);
#endif


}

/* pick a string */
Expand Down Expand Up @@ -1066,7 +1049,6 @@ int main(void)

SDL_RenderClear(renderer);


text_texture = SDL_CreateTextureFromSurface(renderer, text_surface);
if (text_texture == NULL) {
SDL_Log("Cannot create texture from surface(w=%d h=%d): %s", text_surface->w, text_surface->h, SDL_GetError());
Expand Down Expand Up @@ -1274,4 +1256,3 @@ static void random_input(void)

return;
}

2 comments on commit 9ca6c7d

@sezero
Copy link
Contributor Author

@sezero sezero commented on 9ca6c7d Nov 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slouken: This is correct, yes?

@slouken
Copy link
Collaborator

@slouken slouken commented on 9ca6c7d Nov 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep!

Please sign in to comment.