src/gba/input.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 GBA_INPUT_H
7#define GBA_INPUT_H
8
9#include "gba/gba.h"
10
11struct Configuration;
12
13struct GBAInputMap {
14 struct GBAInputMapImpl* maps;
15 size_t numMaps;
16};
17
18struct GBAAxis {
19 enum GBAKey highDirection;
20 enum GBAKey lowDirection;
21 int32_t deadHigh;
22 int32_t deadLow;
23};
24
25#define GBA_NO_MAPPING -1
26
27extern const char* GBAKeyNames[];
28
29void GBAInputMapInit(struct GBAInputMap*);
30void GBAInputMapDeinit(struct GBAInputMap*);
31
32enum GBAKey GBAInputMapKey(const struct GBAInputMap*, uint32_t type, int key);
33void GBAInputBindKey(struct GBAInputMap*, uint32_t type, int key, enum GBAKey input);
34void GBAInputUnbindKey(struct GBAInputMap*, uint32_t type, enum GBAKey input);
35int GBAInputQueryBinding(const struct GBAInputMap*, uint32_t type, enum GBAKey input);
36
37enum GBAKey GBAInputMapAxis(const struct GBAInputMap*, uint32_t type, int axis, int value);
38int GBAInputClearAxis(const struct GBAInputMap*, uint32_t type, int axis, int keys);
39void GBAInputBindAxis(struct GBAInputMap*, uint32_t type, int axis, const struct GBAAxis* description);
40void GBAInputUnbindAxis(struct GBAInputMap*, uint32_t type, int axis);
41void GBAInputUnbindAllAxes(struct GBAInputMap*, uint32_t type);
42const struct GBAAxis* GBAInputQueryAxis(const struct GBAInputMap*, uint32_t type, int axis);
43void GBAInputEnumerateAxes(const struct GBAInputMap*, uint32_t type, void (handler(int axis, const struct GBAAxis* description, void* user)), void* user);
44
45void GBAInputMapLoad(struct GBAInputMap*, uint32_t type, const struct Configuration*);
46void GBAInputMapSave(const struct GBAInputMap*, uint32_t type, struct Configuration*);
47
48void GBAInputProfileLoad(struct GBAInputMap*, uint32_t type, const struct Configuration*, const char* profile);
49void GBAInputProfileSave(const struct GBAInputMap*, uint32_t type, struct Configuration*, const char* profile);
50
51#endif