all repos — mgba @ 7b78906772a65078c6a8098c9b63f4aa12301fea

mGBA Game Boy Advance Emulator

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

  1/* Copyright (c) 2013-2015 Jeffrey Pfau
  2 *
  3 * This Source Code Form is subject to the terms of the Mozilla Public
  4 * License, v. 2.0. If a copy of the MPL was not distributed with this
  5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  6#ifndef SDL_MAIN_H
  7#define SDL_MAIN_H
  8
  9#include <mgba-util/common.h>
 10
 11CXX_GUARD_START
 12
 13#include "sdl-audio.h"
 14#include "sdl-events.h"
 15
 16#ifdef BUILD_GL
 17#include "platform/opengl/gl.h"
 18#endif
 19
 20#ifdef BUILD_RASPI
 21#pragma GCC diagnostic push
 22#pragma GCC diagnostic ignored "-Wunused-function"
 23#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
 24#include <SDL/SDL.h>
 25#include <EGL/egl.h>
 26
 27#include <bcm_host.h>
 28#pragma GCC diagnostic pop
 29#endif
 30
 31#if defined(BUILD_GLES2) || defined(USE_EPOXY)
 32#include "platform/opengl/gles2.h"
 33#endif
 34
 35#ifdef USE_PIXMAN
 36#include <pixman.h>
 37#endif
 38
 39struct mCore;
 40struct mSDLRenderer {
 41	struct mCore* core;
 42	color_t* outputBuffer;
 43
 44	struct mSDLAudio audio;
 45	struct mSDLEvents events;
 46	struct mSDLPlayer player;
 47
 48	bool (*init)(struct mSDLRenderer* renderer);
 49	void (*runloop)(struct mSDLRenderer* renderer, void* user);
 50	void (*deinit)(struct mSDLRenderer* renderer);
 51
 52#if SDL_VERSION_ATLEAST(2, 0, 0)
 53	SDL_Window* window;
 54	SDL_Texture* sdlTex;
 55	SDL_Renderer* sdlRenderer;
 56	SDL_GLContext* glCtx;
 57#endif
 58
 59	unsigned width;
 60	unsigned height;
 61	int viewportWidth;
 62	int viewportHeight;
 63	int ratio;
 64
 65	bool lockAspectRatio;
 66	bool lockIntegerScaling;
 67	bool interframeBlending;
 68	bool filter;
 69
 70#ifdef BUILD_GL
 71	struct mGLContext gl;
 72#endif
 73#if defined(BUILD_GLES2) || defined(USE_EPOXY)
 74	struct mGLES2Context gl2;
 75#endif
 76
 77#ifdef USE_PIXMAN
 78	pixman_image_t* pix;
 79	pixman_image_t* screenpix;
 80#endif
 81
 82#ifdef BUILD_RASPI
 83	EGLDisplay eglDisplay;
 84	EGLSurface eglSurface;
 85	EGLContext eglContext;
 86	EGL_DISPMANX_WINDOW_T eglWindow;
 87#endif
 88
 89#ifdef BUILD_PANDORA
 90	int fb;
 91	int odd;
 92	void* base[2];
 93#endif
 94};
 95
 96void mSDLSWCreate(struct mSDLRenderer* renderer);
 97
 98#ifdef BUILD_GL
 99void mSDLGLCreate(struct mSDLRenderer* renderer);
100#endif
101
102#if defined(BUILD_GLES2) || defined(USE_EPOXY)
103void mSDLGLES2Create(struct mSDLRenderer* renderer);
104#endif
105
106CXX_GUARD_END
107
108#endif