all repos — mgba @ 70231031630875a52521706deeb701c0605d4c37

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;
14DECLARE_VECTOR(FileList, char*);
15
16enum GUIInput {
17	GUI_INPUT_NONE = -1,
18	GUI_INPUT_SELECT = 0,
19	GUI_INPUT_BACK,
20	GUI_INPUT_CANCEL,
21
22	GUI_INPUT_UP,
23	GUI_INPUT_DOWN,
24	GUI_INPUT_LEFT,
25	GUI_INPUT_RIGHT,
26
27	GUI_INPUT_MAX
28};
29
30struct GUIParams {
31	unsigned width;
32	unsigned height;
33	const struct GUIFont* font;
34	const char* basePath;
35
36	void (*drawStart)(void);
37	void (*drawEnd)(void);
38	int (*pollInput)(void);
39
40	// State
41	int inputHistory[GUI_INPUT_MAX];
42
43	// Directories
44	char currentPath[PATH_MAX];
45	size_t fileIndex;
46};
47
48#define GUI_PARAMS_TRAIL {}, ""
49
50void GUIInit(struct GUIParams* params);
51void GUIPollInput(struct GUIParams* params, int* newInput, int* heldInput);
52void GUIInvalidateKeys(struct GUIParams* params);
53
54#endif