all repos — mgba @ c45315b96b3322e4b29f933b27d461f2a73e7bc7

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	GBA_GUI_INPUT_SCREEN_MODE,
16};
17
18struct GBAGUIBackground {
19	struct GUIBackground d;
20	struct GBAGUIRunner* p;
21
22	uint32_t* screenshot;
23	int screenshotId;
24};
25
26struct GBAGUIRunnerLux {
27	struct GBALuminanceSource d;
28	int luxLevel;
29};
30
31struct GBAGUIRunner {
32	struct GBAContext context;
33	struct GUIParams params;
34
35	struct GBAGUIBackground background;
36	struct GBAGUIRunnerLux luminanceSource;
37
38	struct GUIMenuItem* configExtra;
39	size_t nConfigExtra;
40
41	void (*setup)(struct GBAGUIRunner*);
42	void (*teardown)(struct GBAGUIRunner*);
43	void (*gameLoaded)(struct GBAGUIRunner*);
44	void (*gameUnloaded)(struct GBAGUIRunner*);
45	void (*prepareForFrame)(struct GBAGUIRunner*);
46	void (*drawFrame)(struct GBAGUIRunner*, bool faded);
47	void (*drawScreenshot)(struct GBAGUIRunner*, const uint32_t* pixels, bool faded);
48	void (*paused)(struct GBAGUIRunner*);
49	void (*unpaused)(struct GBAGUIRunner*);
50	void (*incrementScreenMode)(struct GBAGUIRunner*);
51	uint16_t (*pollGameInput)(struct GBAGUIRunner*);
52};
53
54void GBAGUIInit(struct GBAGUIRunner*, const char* port);
55void GBAGUIDeinit(struct GBAGUIRunner*);
56void GBAGUIRunloop(struct GBAGUIRunner*);
57
58#endif