all repos — mgba @ 5e759afadaf5df003b66aa01b1fcb1eef4085b86

mGBA Game Boy Advance Emulator

src/util/gui.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_H
 7#define GUI_H
 8
 9#include "util/common.h"
10
11#include "util/vector.h"
12
13struct GUIFont;
14
15enum GUIInput {
16	GUI_INPUT_NONE = -1,
17	GUI_INPUT_SELECT = 0,
18	GUI_INPUT_BACK,
19	GUI_INPUT_CANCEL,
20
21	GUI_INPUT_UP,
22	GUI_INPUT_DOWN,
23	GUI_INPUT_LEFT,
24	GUI_INPUT_RIGHT,
25
26	GUI_INPUT_MAX
27};
28
29struct GUIBackground {
30	void (*draw)(struct GUIBackground*);
31};
32
33struct GUIParams {
34	unsigned width;
35	unsigned height;
36	const struct GUIFont* font;
37	const char* basePath;
38
39	void (*drawStart)(void);
40	void (*drawEnd)(void);
41	int (*pollInput)(void);
42	void (*guiPrepare)(void);
43	void (*guiFinish)(void);
44
45	// State
46	int inputHistory[GUI_INPUT_MAX];
47
48	// Directories
49	char currentPath[PATH_MAX];
50	size_t fileIndex;
51};
52
53#define GUI_PARAMS_TRAIL {}, "", 0
54
55void GUIInit(struct GUIParams* params);
56void GUIPollInput(struct GUIParams* params, int* newInput, int* heldInput);
57void GUIInvalidateKeys(struct GUIParams* params);
58
59#endif