Use sdl on windows

This commit is contained in:
flyinghead 2020-03-21 15:25:02 +01:00
parent 5a1b7374e5
commit 8f92315207
3 changed files with 22 additions and 5 deletions

View File

@ -370,6 +370,7 @@ static HWND hWnd;
static bool windowClassRegistered;
static int window_x, window_y;
#if !defined(USE_SDL)
void CreateMainWindow()
{
if (hWnd != NULL)
@ -411,6 +412,7 @@ void CreateMainWindow()
theGLContext.SetWindow(hWnd);
theGLContext.SetDeviceContext(GetDC(hWnd));
}
#endif
void os_CreateWindow()
{

View File

@ -51,10 +51,21 @@ bool SDLGLGraphicsContext::Init()
glcontext = SDL_GL_CreateContext(window);
if (!glcontext)
{
ERROR_LOG(RENDERER, "Error creating SDL GL context");
SDL_DestroyWindow(window);
window = nullptr;
return false;
#ifndef GLES
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, 0);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
glcontext = SDL_GL_CreateContext(window);
if (!glcontext)
{
#endif
ERROR_LOG(RENDERER, "Error creating SDL GL context");
SDL_DestroyWindow(window);
window = nullptr;
return false;
#ifndef GLES
}
#endif
}
SDL_GL_MakeCurrent(window, NULL);
@ -69,8 +80,11 @@ bool SDLGLGraphicsContext::Init()
SDL_GL_MakeCurrent(window, glcontext);
#ifndef GLES
if (gl3wInit() == -1 || !gl3wIsSupported(3, 1))
if (gl3wInit() == -1 || !gl3wIsSupported(3, 0))
{
ERROR_LOG(RENDERER, "gl3wInit failed or GL 3.0 not supported");
return false;
}
#endif
PostInit();

View File

@ -268,6 +268,7 @@ else ifneq (,$(findstring win32,$(platform)))
PLATFORM_EXT := exe
CC = gcc
CXX = g++
USE_SDL = 1
ifeq ($(WITH_DYNAREC), x86)
X86_REC := 1
LDFLAGS += -m32