C -> CPP
This commit is contained in:
50
src/input/inputaction.hpp
Normal file
50
src/input/inputaction.hpp
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "time/time.hpp"
|
||||
|
||||
typedef uint8_t inputaction_t;
|
||||
|
||||
#define INPUT_ACTION_NULL 0x00
|
||||
#define INPUT_ACTION_UP 0x01
|
||||
#define INPUT_ACTION_DOWN 0x02
|
||||
#define INPUT_ACTION_LEFT 0x03
|
||||
#define INPUT_ACTION_RIGHT 0x04
|
||||
#define INPUT_ACTION_ACCEPT 0x05
|
||||
#define INPUT_ACTION_CANCEL 0x06
|
||||
#define INPUT_ACTION_RAGEQUIT 0x07
|
||||
#define INPUT_ACTION_COUNT INPUT_ACTION_RAGEQUIT + 1
|
||||
|
||||
typedef struct {
|
||||
inputaction_t action;
|
||||
float_t lastValue;
|
||||
float_t currentValue;
|
||||
|
||||
#if TIME_FIXED == 0
|
||||
float_t lastDynamicValue;
|
||||
float_t currentDynamicValue;
|
||||
#endif
|
||||
} inputactiondata_t;
|
||||
|
||||
// static const char_t* INPUT_ACTION_NAMES[INPUT_ACTION_COUNT] = {
|
||||
// [INPUT_ACTION_UP] = "UP",
|
||||
// [INPUT_ACTION_DOWN] = "DOWN",
|
||||
// [INPUT_ACTION_LEFT] = "LEFT",
|
||||
// [INPUT_ACTION_RIGHT] = "RIGHT",
|
||||
// [INPUT_ACTION_ACCEPT] = "ACCEPT",
|
||||
// [INPUT_ACTION_CANCEL] = "CANCEL",
|
||||
// [INPUT_ACTION_RAGEQUIT] = "RAGEQUIT",
|
||||
// };
|
||||
|
||||
/**
|
||||
* Gets an input action by its name.
|
||||
*
|
||||
* @param name The name of the input action.
|
||||
* @return The input action, or INPUT_ACTION_COUNT if not found.
|
||||
*/
|
||||
// inputaction_t inputActionGetByName(const char_t *name);
|
||||
Reference in New Issue
Block a user