[client] all: move all SDL specific code into displayservers/sdl

This commit is contained in:
Geoffrey McRae
2021-01-26 21:46:30 +11:00
parent 7ff5da4d62
commit ca5c3938e4
24 changed files with 569 additions and 406 deletions

View File

@@ -177,7 +177,7 @@ enum ConfigStatus
};
static void deconfigure(struct Inst * this);
static enum ConfigStatus configure(struct Inst * this, SDL_Window *window);
static enum ConfigStatus configure(struct Inst * this);
static void update_mouse_shape(struct Inst * this, bool * newShape);
static bool draw_frame(struct Inst * this);
static void draw_mouse(struct Inst * this);
@@ -235,8 +235,11 @@ bool opengl_create(void ** opaque, const LG_RendererParams params)
return true;
}
bool opengl_initialize(void * opaque, Uint32 * sdlFlags)
bool opengl_initialize(void * opaque)
{
//FIXME
return false;
#if 0
struct Inst * this = (struct Inst *)opaque;
if (!this)
return false;
@@ -252,6 +255,7 @@ bool opengl_initialize(void * opaque, Uint32 * sdlFlags)
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE , 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE , 8);
return true;
#endif
}
void opengl_deinitialize(void * opaque)
@@ -492,16 +496,17 @@ void bitmap_to_texture(LG_FontBitmap * bitmap, GLuint texture)
glBindTexture(GL_TEXTURE_2D, 0);
}
bool opengl_render_startup(void * opaque, SDL_Window * window)
bool opengl_render_startup(void * opaque)
{
//FIXME
return false;
#if 0
struct Inst * this = (struct Inst *)opaque;
this->glContext = SDL_GL_CreateContext(window);
this->glContext = app_getGLContext();
if (!this->glContext)
{
DEBUG_ERROR("Failed to create the OpenGL context");
return false;
}
DEBUG_INFO("Vendor : %s", glGetString(GL_VENDOR ));
DEBUG_INFO("Renderer: %s", glGetString(GL_RENDERER));
@@ -549,15 +554,16 @@ bool opengl_render_startup(void * opaque, SDL_Window * window)
SDL_GL_SetSwapInterval(this->opt.vsync ? 1 : 0);
this->renderStarted = true;
return true;
#endif
}
bool opengl_render(void * opaque, SDL_Window * window, LG_RendererRotate rotate)
bool opengl_render(void * opaque, LG_RendererRotate rotate)
{
struct Inst * this = (struct Inst *)opaque;
if (!this)
return false;
switch(configure(this, window))
switch(configure(this))
{
case CONFIG_STATUS_ERROR:
DEBUG_ERROR("configure failed");
@@ -657,11 +663,11 @@ bool opengl_render(void * opaque, SDL_Window * window, LG_RendererRotate rotate)
if (this->opt.preventBuffer)
{
SDL_GL_SwapWindow(window);
app_glSwapBuffers();
glFinish();
}
else
SDL_GL_SwapWindow(window);
app_glSwapBuffers();
this->mouseUpdate = false;
return true;
@@ -879,7 +885,7 @@ static bool _check_gl_error(unsigned int line, const char * name)
return true;
}
static enum ConfigStatus configure(struct Inst * this, SDL_Window *window)
static enum ConfigStatus configure(struct Inst * this)
{
LG_LOCK(this->formatLock);
if (!this->reconfigure)