mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Rework internal module registration to happen in constructors.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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[];
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user