all repos — mgba @ 54e4d914575be4ad901fa451a91305777c23fdf6

mGBA Game Boy Advance Emulator

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