mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-04 17:06:25 +00:00
Implemented SDL_GetHintBoolean() to make it easier to check boolean hints
This commit is contained in:
@@ -234,12 +234,11 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hint = SDL_GetHint(SDL_HINT_RENDER_VSYNC);
|
||||
if (hint) {
|
||||
if (*hint == '0') {
|
||||
flags &= ~SDL_RENDERER_PRESENTVSYNC;
|
||||
} else {
|
||||
if (SDL_GetHint(SDL_HINT_RENDER_VSYNC)) {
|
||||
if (SDL_GetHintBoolean(SDL_HINT_RENDER_VSYNC, SDL_TRUE)) {
|
||||
flags |= SDL_RENDERER_PRESENTVSYNC;
|
||||
} else {
|
||||
flags &= ~SDL_RENDERER_PRESENTVSYNC;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -512,7 +512,6 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||
D3D_RenderData *data;
|
||||
SDL_SysWMinfo windowinfo;
|
||||
HRESULT result;
|
||||
const char *hint;
|
||||
D3DPRESENT_PARAMETERS pparams;
|
||||
IDirect3DSwapChain9 *chain;
|
||||
D3DCAPS9 caps;
|
||||
@@ -607,8 +606,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||
device_flags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
|
||||
}
|
||||
|
||||
hint = SDL_GetHint(SDL_HINT_RENDER_DIRECT3D_THREADSAFE);
|
||||
if (hint && SDL_atoi(hint)) {
|
||||
if (SDL_GetHintBoolean(SDL_HINT_RENDER_DIRECT3D_THREADSAFE, SDL_FALSE)) {
|
||||
device_flags |= D3DCREATE_MULTITHREADED;
|
||||
}
|
||||
|
||||
|
@@ -1000,7 +1000,6 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer)
|
||||
IDXGIDevice1 *dxgiDevice = NULL;
|
||||
HRESULT result = S_OK;
|
||||
UINT creationFlags;
|
||||
const char *hint;
|
||||
|
||||
/* This array defines the set of DirectX hardware feature levels this app will support.
|
||||
* Note the ordering should be preserved.
|
||||
@@ -1078,8 +1077,7 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer)
|
||||
creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
|
||||
|
||||
/* Make sure Direct3D's debugging feature gets used, if the app requests it. */
|
||||
hint = SDL_GetHint(SDL_HINT_RENDER_DIRECT3D11_DEBUG);
|
||||
if (hint && SDL_atoi(hint) > 0) {
|
||||
if (SDL_GetHintBoolean(SDL_HINT_RENDER_DIRECT3D11_DEBUG, SDL_FALSE)) {
|
||||
creationFlags |= D3D11_CREATE_DEVICE_DEBUG;
|
||||
}
|
||||
|
||||
|
@@ -390,7 +390,6 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||
{
|
||||
SDL_Renderer *renderer;
|
||||
GL_RenderData *data;
|
||||
const char *hint;
|
||||
GLint value;
|
||||
Uint32 window_flags;
|
||||
int profile_mask = 0, major = 0, minor = 0;
|
||||
@@ -528,8 +527,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||
}
|
||||
|
||||
/* Check for shader support */
|
||||
hint = SDL_GetHint(SDL_HINT_RENDER_OPENGL_SHADERS);
|
||||
if (!hint || *hint != '0') {
|
||||
if (SDL_GetHintBoolean(SDL_HINT_RENDER_OPENGL_SHADERS, SDL_TRUE)) {
|
||||
data->shaders = GL_CreateShaderContext();
|
||||
}
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_RENDER, "OpenGL shaders: %s",
|
||||
|
Reference in New Issue
Block a user