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 mGUI_INPUT_SCREENSHOT,
22 mGUI_INPUT_FAST_FORWARD,
23};
24
25struct mGUIBackground {
26 struct GUIBackground d;
27 struct mGUIRunner* p;
28
29 color_t* screenshot;
30 int screenshotId;
31};
32
33struct mCore;
34struct mGUIRunnerLux {
35 struct GBALuminanceSource d;
36 int luxLevel;
37};
38
39struct mGUIRunner {
40 struct mCore* core;
41 struct GUIParams params;
42
43 struct mGUIBackground background;
44 struct mGUIRunnerLux luminanceSource;
45
46 struct mInputMap guiKeys;
47 struct mCoreConfig config;
48 struct GUIMenuItem* configExtra;
49 size_t nConfigExtra;
50
51 struct GUIInputKeys* keySources;
52
53 const char* port;
54 float fps;
55 int64_t lastFpsCheck;
56 int32_t totalDelta;
57 struct CircleBuffer fpsBuffer;
58
59 void (*setup)(struct mGUIRunner*);
60 void (*teardown)(struct mGUIRunner*);
61 void (*gameLoaded)(struct mGUIRunner*);
62 void (*gameUnloaded)(struct mGUIRunner*);
63 void (*prepareForFrame)(struct mGUIRunner*);
64 void (*drawFrame)(struct mGUIRunner*, bool faded);
65 void (*drawScreenshot)(struct mGUIRunner*, const color_t* pixels, unsigned width, unsigned height, bool faded);
66 void (*paused)(struct mGUIRunner*);
67 void (*unpaused)(struct mGUIRunner*);
68 void (*incrementScreenMode)(struct mGUIRunner*);
69 void (*setFrameLimiter)(struct mGUIRunner*, bool limit);
70 uint16_t (*pollGameInput)(struct mGUIRunner*);
71};
72
73void mGUIInit(struct mGUIRunner*, const char* port);
74void mGUIDeinit(struct mGUIRunner*);
75void mGUIRun(struct mGUIRunner*, const char* path);
76void mGUIRunloop(struct mGUIRunner*);
77
78#endif