+ -- private property: _alreadyHandled
+ -- was the key already processed by the user code since it was pressed?
+ -- Useful for handling repeated keys, check <pressed> and then you can see
+ -- if the key was repeated.
-- private property: _lastFrame
-- what keys were pressed last frame
+ -- Method: alreadyHandled
+ -- Returns whether this key was already handled since it was pressed.
+ -- Also sets the flag that something was handled, when calling.
+ alreadyHandled = function (self, key)
+ if not self._alreadyHandled[key] then
+ -- mark preemptively as handled
+ self._alreadyHandled[key] = true
+ -- return false, because we need to handle it
-- Converts a character code to a Unicode string
-- see http://stackoverflow.com/questions/7780179/what-is-the-way-to-represent-a-unichar-in-lua/7799843
keyPressed = function (self, key, isrepeat)
self._thisFrame[key] = true
+ self._alreadyHandled[key] = false
--if unicode and unicode >= 0x20 and unicode ~= 127 and unicode < 0x3000 then
-- self.typed = self.typed .. self:unicodeChar(unicode)