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 void (*setup)(struct GBAGUIRunner*);
39 void (*teardown)(struct GBAGUIRunner*);
40 void (*gameLoaded)(struct GBAGUIRunner*);
41 void (*gameUnloaded)(struct GBAGUIRunner*);
42 void (*prepareForFrame)(struct GBAGUIRunner*);
43 void (*drawFrame)(struct GBAGUIRunner*, bool faded);
44 void (*drawScreenshot)(struct GBAGUIRunner*, const uint32_t* pixels, bool faded);
45 void (*paused)(struct GBAGUIRunner*);
46 void (*unpaused)(struct GBAGUIRunner*);
47 void (*incrementScreenMode)(struct GBAGUIRunner*);
48 uint16_t (*pollGameInput)(struct GBAGUIRunner*);
49};
50
51void GBAGUIInit(struct GBAGUIRunner*, const char* port);
52void GBAGUIDeinit(struct GBAGUIRunner*);
53void GBAGUIRunloop(struct GBAGUIRunner*);
54
55#endif