all repos — mgba @ 8615defda763c928eadb4c0919081a74b6bd28fc

mGBA Game Boy Advance Emulator

src/gba/gui/gui-runner.h (view raw)

 1/* Copyright (c) 2013-2016 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 "util/common.h"
10
11#include "gba/gui/remap.h"
12#include "gba/hardware.h"
13#include "util/circle-buffer.h"
14#include "util/gui.h"
15
16enum mGUIInput {
17	mGUI_INPUT_INCREASE_BRIGHTNESS = GUI_INPUT_USER_START,
18	mGUI_INPUT_DECREASE_BRIGHTNESS,
19	mGUI_INPUT_SCREEN_MODE,
20};
21
22struct mGUIBackground {
23	struct GUIBackground d;
24	struct mGUIRunner* p;
25
26	uint32_t* screenshot;
27	int screenshotId;
28};
29
30struct mCore;
31struct mGUIRunnerLux {
32	struct GBALuminanceSource d;
33	int luxLevel;
34};
35
36struct mGUIRunner {
37	struct mCore* core;
38	struct GUIParams params;
39
40	struct mGUIBackground background;
41	struct mGUIRunnerLux luminanceSource;
42
43	struct GUIMenuItem* configExtra;
44	size_t nConfigExtra;
45
46	struct GUIInputKeys* keySources;
47
48	float fps;
49	int64_t lastFpsCheck;
50	int32_t totalDelta;
51	struct CircleBuffer fpsBuffer;
52
53	void (*setup)(struct mGUIRunner*);
54	void (*teardown)(struct mGUIRunner*);
55	void (*gameLoaded)(struct mGUIRunner*);
56	void (*gameUnloaded)(struct mGUIRunner*);
57	void (*prepareForFrame)(struct mGUIRunner*);
58	void (*drawFrame)(struct mGUIRunner*, bool faded);
59	void (*drawScreenshot)(struct mGUIRunner*, const uint32_t* pixels, bool faded);
60	void (*paused)(struct mGUIRunner*);
61	void (*unpaused)(struct mGUIRunner*);
62	void (*incrementScreenMode)(struct mGUIRunner*);
63	uint16_t (*pollGameInput)(struct mGUIRunner*);
64};
65
66void mGUIInit(struct mGUIRunner*, const char* port);
67void mGUIDeinit(struct mGUIRunner*);
68void mGUIRun(struct mGUIRunner*, const char* path);
69void mGUIRunloop(struct mGUIRunner*);
70
71#endif