mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
Added love.keyboard.setKeyRepeat and love.keyboard.hasKeyRepeat (resolves issue #717)
This commit is contained in:
@@ -29,11 +29,26 @@ namespace keyboard
|
||||
namespace sdl
|
||||
{
|
||||
|
||||
Keyboard::Keyboard()
|
||||
: key_repeat(false)
|
||||
{
|
||||
}
|
||||
|
||||
const char *Keyboard::getName() const
|
||||
{
|
||||
return "love.keyboard.sdl";
|
||||
}
|
||||
|
||||
void Keyboard::setKeyRepeat(bool enable)
|
||||
{
|
||||
key_repeat = enable;
|
||||
}
|
||||
|
||||
bool Keyboard::hasKeyRepeat() const
|
||||
{
|
||||
return key_repeat;
|
||||
}
|
||||
|
||||
bool Keyboard::isDown(Key *keylist) const
|
||||
{
|
||||
const Uint8 *keystate = SDL_GetKeyboardState(0);
|
||||
|
||||
@@ -42,12 +42,19 @@ class Keyboard : public love::keyboard::Keyboard
|
||||
{
|
||||
public:
|
||||
|
||||
Keyboard();
|
||||
|
||||
// Implements Module.
|
||||
const char *getName() const;
|
||||
|
||||
void setKeyRepeat(bool enable);
|
||||
bool hasKeyRepeat() const;
|
||||
bool isDown(Key *keylist) const;
|
||||
|
||||
private:
|
||||
|
||||
bool key_repeat;
|
||||
|
||||
static std::map<Key, SDL_Keycode> createKeyMap();
|
||||
static std::map<Key, SDL_Keycode> keys;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user