I disregarded hints until now because they didn’t click with me.
But after looking into them, I’m even more confused.
- each hint is actually a macro for a literal string
- SDL_hints is an array of pointers to SDL_hint structs (linked list? (since they have ->next))
- something with SDL_env
- the array of hint pointers gets looped over to find the string literal that fits (why are string literals used? one would imagine strcmp() is super slow compared to just making the macro a number)
- then you can somehow change the setting by passing a value (given to you in a comment next to the hint macro) with SDL_SetHint()
in SDL_events.c, you have
static int SDL_EventLoggingVerbosity = 0;, that tells you the value can be 0-4 “as defined in SDL_HINT_EVENT_LOGGING”, and when you go find
SDL_HINT_EVENT_LOGGING, you see it is used in an SDL_AddHintCallback. I guess I now understand how hints are set, and how their callback is being added so you can change the value.
Let’s take a look at another example:
So unless I am wrong and couldn’t find the link, it would appear that using
SDL_RenderSetVSync(), wouldn’t return the current state of VSYNC.
Which brings me to the confusions about Hints. What are they and what are they used for?