src/gba/gba-input.h (view raw)
1/* Copyright (c) 2013-2014 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.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
25void GBAInputMapInit(struct GBAInputMap*);
26void GBAInputMapDeinit(struct GBAInputMap*);
27
28enum GBAKey GBAInputMapKey(const struct GBAInputMap*, uint32_t type, int key);
29void GBAInputBindKey(struct GBAInputMap*, uint32_t type, int key, enum GBAKey input);
30void GBAInputUnbindKey(struct GBAInputMap*, uint32_t type, int key);
31int GBAInputQueryBinding(const struct GBAInputMap*, uint32_t type, enum GBAKey input);
32
33enum GBAKey GBAInputMapAxis(const struct GBAInputMap*, uint32_t type, int axis, int value);
34int GBAInputClearAxis(const struct GBAInputMap*, uint32_t type, int axis, int keys);
35void GBAInputBindAxis(struct GBAInputMap*, uint32_t type, int axis, const struct GBAAxis* description);
36void GBAInputUnbindAxis(struct GBAInputMap*, uint32_t type, int axis);
37void GBAInputUnbindAllAxes(struct GBAInputMap*, uint32_t type);
38const struct GBAAxis* GBAInputQueryAxis(const struct GBAInputMap*, uint32_t type, int axis);
39
40void GBAInputMapLoad(struct GBAInputMap*, uint32_t type, const struct Configuration*);
41void GBAInputMapSave(const struct GBAInputMap*, uint32_t type, struct Configuration*);
42
43#endif