| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> |
| | | |
| | | This software is provided 'as-is', without any express or implied |
| | | warranty. In no event will the authors be held liable for any damages |
| | |
| | | |
| | | #include "SDL_hints.h" |
| | | #include "SDL_error.h" |
| | | #include "SDL_hints_c.h" |
| | | |
| | | |
| | | /* Assuming there aren't many hints set and they aren't being queried in |
| | |
| | | } |
| | | |
| | | SDL_bool |
| | | SDL_GetHintBoolean(const char *name, SDL_bool default_value) |
| | | SDL_GetStringBoolean(const char *value, SDL_bool default_value) |
| | | { |
| | | const char *hint = SDL_GetHint(name); |
| | | if (!hint || !*hint) { |
| | | if (!value || !*value) { |
| | | return default_value; |
| | | } |
| | | if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) { |
| | | if (*value == '0' || SDL_strcasecmp(value, "false") == 0) { |
| | | return SDL_FALSE; |
| | | } |
| | | return SDL_TRUE; |
| | | } |
| | | |
| | | SDL_bool |
| | | SDL_GetHintBoolean(const char *name, SDL_bool default_value) |
| | | { |
| | | const char *hint = SDL_GetHint(name); |
| | | return SDL_GetStringBoolean(hint, default_value); |
| | | } |
| | | |
| | | void |
| | | SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata) |
| | | { |