[client] opengl: remove dependency on SDL

This commit is contained in:
Quantum 2021-02-24 23:57:03 -05:00 committed by Geoffrey McRae
parent 798a1aadb5
commit 84e14edfe7

View File

@ -20,12 +20,11 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include "interface/renderer.h" #include "interface/renderer.h"
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <string.h>
#include <unistd.h> #include <unistd.h>
#include <malloc.h> #include <malloc.h>
#include <math.h> #include <math.h>
#include <SDL2/SDL_ttf.h>
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glx.h> #include <GL/glx.h>
@ -80,6 +79,20 @@ static struct Option opengl_options[] =
{0} {0}
}; };
struct IntPoint
{
int x;
int y;
};
struct IntRect
{
int x;
int y;
int w;
int h;
};
struct OpenGL_Options struct OpenGL_Options
{ {
bool mipmap; bool mipmap;
@ -110,7 +123,7 @@ struct Inst
bool reconfigure; bool reconfigure;
LG_DSGLContext glContext; LG_DSGLContext glContext;
SDL_Point window; struct IntPoint window;
float uiScale; float uiScale;
bool frameUpdate; bool frameUpdate;
@ -151,7 +164,7 @@ struct Inst
bool showFPS; bool showFPS;
bool fpsTexture; bool fpsTexture;
SDL_Rect fpsRect; struct IntRect fpsRect;
LG_Lock mouseLock; LG_Lock mouseLock;
LG_RendererCursor mouseCursor; LG_RendererCursor mouseCursor;
@ -165,7 +178,7 @@ struct Inst
bool newShape; bool newShape;
LG_RendererCursor mouseType; LG_RendererCursor mouseType;
bool mouseVisible; bool mouseVisible;
SDL_Rect mousePos; struct IntRect mousePos;
}; };
static bool _check_gl_error(unsigned int line, const char * name); static bool _check_gl_error(unsigned int line, const char * name);
@ -456,7 +469,7 @@ void opengl_on_alert(void * opaque, const LG_MsgAlert alert, const char * messag
if (!(a->text = this->font->render(this->alertFontObj, 0xffffff00, message))) if (!(a->text = this->font->render(this->alertFontObj, 0xffffff00, message)))
{ {
DEBUG_ERROR("Failed to render alert text: %s", TTF_GetError()); DEBUG_ERROR("Failed to render alert text");
free(a); free(a);
return; return;
} }