all repos — mgba @ 37554a40ea338bfb2e3971e8854091c55f77faeb

mGBA Game Boy Advance Emulator

src/platform/sdl/main.h (view raw)

 1#ifndef SDL_MAIN_H
 2#define SDL_MAIN_H
 3
 4#include "renderers/video-software.h"
 5
 6#include "sdl-audio.h"
 7#include "sdl-events.h"
 8
 9#ifdef BUILD_GL
10#ifdef __APPLE__
11#include <OpenGL/gl.h>
12#else
13#include <GL/gl.h>
14#endif
15#endif
16
17#ifdef BUILD_RASPI
18#pragma GCC diagnostic push
19#pragma GCC diagnostic ignored "-Wunused-function"
20#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
21#include <SDL/SDL.h>
22#include <GLES2/gl2.h>
23#include <EGL/egl.h>
24
25#include <bcm_host.h>
26#pragma GCC diagnostic pop
27#endif
28
29struct SDLSoftwareRenderer {
30	struct GBAVideoSoftwareRenderer d;
31	struct GBASDLAudio audio;
32	struct GBASDLEvents events;
33
34#if SDL_VERSION_ATLEAST(2, 0, 0)
35	SDL_Window* window;
36#ifndef BUILD_GL
37	SDL_Texture* tex;
38	SDL_Renderer* sdlRenderer;
39#endif
40#endif
41
42	int viewportWidth;
43	int viewportHeight;
44	int ratio;
45
46#ifdef BUILD_GL
47	GLuint tex;
48#endif
49
50#ifdef BUILD_RASPI
51	EGLDisplay display;
52	EGLSurface surface;
53	EGLContext context;
54	EGL_DISPMANX_WINDOW_T window;
55	GLuint tex;
56	GLuint fragmentShader;
57	GLuint vertexShader;
58	GLuint program;
59	GLuint bufferObject;
60	GLuint texLocation;
61	GLuint positionLocation;
62#endif
63};
64
65bool GBASDLInit(struct SDLSoftwareRenderer* renderer);
66void GBASDLDeinit(struct SDLSoftwareRenderer* renderer);
67void GBASDLRunloop(struct GBAThread* context, struct SDLSoftwareRenderer* renderer);
68
69#endif
70