Rework internal module registration to happen in constructors.

This commit is contained in:
Sasha Szpakowski
2024-02-24 15:21:38 -04:00
parent c7e4dafd88
commit 1e97e09b28
73 changed files with 154 additions and 248 deletions
+5
View File
@@ -27,6 +27,11 @@ namespace love
namespace keyboard
{
Keyboard::Keyboard(const char *name)
: Module(M_KEYBOARD, name)
{
}
bool Keyboard::getConstant(const char *in, Key &out)
{
return keys.find(in, out);
+4 -3
View File
@@ -533,9 +533,6 @@ public:
virtual ~Keyboard() {}
// Implements Module.
virtual ModuleType getModuleType() const { return M_KEYBOARD; }
/**
* Sets whether repeat keypress events should be sent if a key is held down.
* Does not affect text input events.
@@ -614,6 +611,10 @@ public:
static bool getConstant(const char *in, ModifierKey &out);
static bool getConstant(ModifierKey in, const char *&out);
protected:
Keyboard(const char *name);
private:
static StringMap<Key, KEY_MAX_ENUM>::Entry keyEntries[];
+2 -6
View File
@@ -36,15 +36,11 @@ namespace sdl
{
Keyboard::Keyboard()
: key_repeat(false)
: love::keyboard::Keyboard("love.keyboard.sdl")
, key_repeat(false)
{
}
const char *Keyboard::getName() const
{
return "love.keyboard.sdl";
}
void Keyboard::setKeyRepeat(bool enable)
{
key_repeat = enable;
-3
View File
@@ -41,9 +41,6 @@ public:
Keyboard();
// Implements Module.
const char *getName() const;
void setKeyRepeat(bool enable);
bool hasKeyRepeat() const;
bool isDown(const std::vector<Key> &keylist) const;