mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Inline static variables (part 1)
This commit is contained in:
parent
67c96c89cc
commit
5af4bef46f
52 changed files with 85 additions and 247 deletions
|
|
@ -73,8 +73,6 @@ static const char *_joy_axes[(size_t)JoyAxis::SDL_MAX] = {
|
|||
"righttrigger",
|
||||
};
|
||||
|
||||
Input *Input::singleton = nullptr;
|
||||
|
||||
void (*Input::set_mouse_mode_func)(Input::MouseMode) = nullptr;
|
||||
Input::MouseMode (*Input::get_mouse_mode_func)() = nullptr;
|
||||
void (*Input::set_mouse_mode_override_func)(Input::MouseMode) = nullptr;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class Input : public Object {
|
|||
GDCLASS(Input, Object);
|
||||
_THREAD_SAFE_CLASS_
|
||||
|
||||
static Input *singleton;
|
||||
static inline Input *singleton = nullptr;
|
||||
|
||||
static constexpr uint64_t MAX_EVENT = 32;
|
||||
|
||||
|
|
|
|||
|
|
@ -35,9 +35,6 @@
|
|||
#include "core/os/keyboard.h"
|
||||
#include "core/os/os.h"
|
||||
|
||||
const int InputEvent::DEVICE_ID_EMULATION = -1;
|
||||
const int InputEvent::DEVICE_ID_INTERNAL = -2;
|
||||
|
||||
void InputEvent::set_device(int p_device) {
|
||||
device = p_device;
|
||||
emit_changed();
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ protected:
|
|||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
static const int DEVICE_ID_EMULATION;
|
||||
static const int DEVICE_ID_INTERNAL;
|
||||
static constexpr int DEVICE_ID_EMULATION = -1;
|
||||
static constexpr int DEVICE_ID_INTERNAL = -2;
|
||||
|
||||
void set_device(int p_device);
|
||||
int get_device() const;
|
||||
|
|
|
|||
|
|
@ -37,10 +37,6 @@
|
|||
#include "core/os/os.h"
|
||||
#include "core/variant/typed_array.h"
|
||||
|
||||
InputMap *InputMap::singleton = nullptr;
|
||||
|
||||
int InputMap::ALL_DEVICES = -1;
|
||||
|
||||
void InputMap::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("has_action", "action"), &InputMap::has_action);
|
||||
ClassDB::bind_method(D_METHOD("get_actions"), &InputMap::_get_actions);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public:
|
|||
/**
|
||||
* A special value used to signify that a given Action can be triggered by any device
|
||||
*/
|
||||
static int ALL_DEVICES;
|
||||
static constexpr int ALL_DEVICES = -1;
|
||||
|
||||
struct Action {
|
||||
int id;
|
||||
|
|
@ -58,7 +58,7 @@ public:
|
|||
static constexpr float DEFAULT_TOGGLE_DEADZONE = 0.5f;
|
||||
|
||||
private:
|
||||
static InputMap *singleton;
|
||||
static inline InputMap *singleton = nullptr;
|
||||
|
||||
mutable HashMap<StringName, Action> input_map;
|
||||
HashMap<String, List<Ref<InputEvent>>> default_builtin_cache;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue