all repos — mgba @ 5d3b6d5fd84dee29cb706075c08011c83ed10621

mGBA Game Boy Advance Emulator

src/gba/gui/gui-runner.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 GUI_RUNNER_H
 7#define GUI_RUNNER_H
 8
 9#include "gba/context/context.h"
10#include "util/gui.h"
11
12enum GBAGUIInput {
13	GBA_GUI_INPUT_INCREASE_BRIGHTNESS = GUI_INPUT_USER_START,
14	GBA_GUI_INPUT_DECREASE_BRIGHTNESS
15};
16
17struct GBAGUIBackground {
18	struct GUIBackground d;
19	struct GBAGUIRunner* p;
20
21	uint32_t* screenshot;
22	int screenshotId;
23};
24
25struct GBAGUIRunnerLux {
26	struct GBALuminanceSource d;
27	int luxLevel;
28};
29
30struct GBAGUIRunner {
31	struct GBAContext context;
32	struct GUIParams params;
33
34	struct GBAGUIBackground background;
35	struct GBAGUIRunnerLux luminanceSource;
36
37	void (*setup)(struct GBAGUIRunner*);
38	void (*teardown)(struct GBAGUIRunner*);
39	void (*gameLoaded)(struct GBAGUIRunner*);
40	void (*gameUnloaded)(struct GBAGUIRunner*);
41	void (*prepareForFrame)(struct GBAGUIRunner*);
42	void (*drawFrame)(struct GBAGUIRunner*, bool faded);
43	void (*drawScreenshot)(struct GBAGUIRunner*, const uint32_t* pixels, bool faded);
44	void (*paused)(struct GBAGUIRunner*);
45	void (*unpaused)(struct GBAGUIRunner*);
46	uint16_t (*pollGameInput)(struct GBAGUIRunner*);
47};
48
49void GBAGUIInit(struct GBAGUIRunner*, const char* port);
50void GBAGUIDeinit(struct GBAGUIRunner*);
51void GBAGUIRunloop(struct GBAGUIRunner*);
52
53#endif