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 "feature/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 const char* port;
49 float fps;
50 int64_t lastFpsCheck;
51 int32_t totalDelta;
52 struct CircleBuffer fpsBuffer;
53
54 void (*setup)(struct mGUIRunner*);
55 void (*teardown)(struct mGUIRunner*);
56 void (*gameLoaded)(struct mGUIRunner*);
57 void (*gameUnloaded)(struct mGUIRunner*);
58 void (*prepareForFrame)(struct mGUIRunner*);
59 void (*drawFrame)(struct mGUIRunner*, bool faded);
60 void (*drawScreenshot)(struct mGUIRunner*, const uint32_t* pixels, bool faded);
61 void (*paused)(struct mGUIRunner*);
62 void (*unpaused)(struct mGUIRunner*);
63 void (*incrementScreenMode)(struct mGUIRunner*);
64 uint16_t (*pollGameInput)(struct mGUIRunner*);
65};
66
67void mGUIInit(struct mGUIRunner*, const char* port);
68void mGUIDeinit(struct mGUIRunner*);
69void mGUIRun(struct mGUIRunner*, const char* path);
70void mGUIRunloop(struct mGUIRunner*);
71
72#endif