Skip to content

Commit 4d6a8e3

Browse files
committed
Rework SDL_INIT_TIMER for SDL3
No longer exists in SDL3, so simple compat is to mock it out to a macro that is zero in SDL3.
1 parent c5781dc commit 4d6a8e3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src_c/_pygame.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ PG_UnlockMutex(SDL_mutex *mutex)
115115
#define PG_FIND_VNUM_MINOR(ver) SDL_VERSIONNUM_MINOR(ver)
116116
#define PG_FIND_VNUM_MICRO(ver) SDL_VERSIONNUM_MICRO(ver)
117117

118+
#define PG_INIT_TIMER 0
119+
118120
#else /* ~SDL_VERSION_ATLEAST(3, 0, 0)*/
119121
#define PG_ShowCursor() SDL_ShowCursor(SDL_ENABLE)
120122
#define PG_HideCursor() SDL_ShowCursor(SDL_DISABLE)
@@ -180,6 +182,8 @@ PG_UnlockMutex(SDL_mutex *mutex)
180182
#define PG_FIND_VNUM_MINOR(ver) ver.minor
181183
#define PG_FIND_VNUM_MICRO(ver) ver.patch
182184

185+
#define PG_INIT_TIMER SDL_INIT_TIMER
186+
183187
#if SDL_VERSION_ATLEAST(2, 0, 14)
184188
#define PG_SurfaceHasRLE SDL_HasSurfaceRLE
185189
#else

src_c/base.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,10 @@ pg_init(PyObject *self, PyObject *_null)
341341

342342
/*nice to initialize timer, so startup time will reflec pg_init() time*/
343343
#if defined(WITH_THREAD) && !defined(MS_WIN32) && defined(SDL_INIT_EVENTTHREAD)
344-
pg_sdl_was_init = SDL_Init(SDL_INIT_EVENTTHREAD | SDL_INIT_TIMER |
344+
pg_sdl_was_init = SDL_Init(SDL_INIT_EVENTTHREAD | PG_INIT_TIMER |
345345
PG_INIT_NOPARACHUTE) == 0;
346346
#else
347-
pg_sdl_was_init = SDL_Init(SDL_INIT_TIMER | PG_INIT_NOPARACHUTE) == 0;
347+
pg_sdl_was_init = SDL_Init(PG_INIT_TIMER | PG_INIT_NOPARACHUTE) == 0;
348348
#endif
349349

350350
pg_env_blend_alpha_SDL2 = SDL_getenv("PYGAME_BLEND_ALPHA_SDL2");

0 commit comments

Comments
 (0)