forked from teascade/programming-bongocat
Fix keys not being in lowercase
This commit is contained in:
parent
5c7d294a19
commit
49fa1ad589
@ -13,24 +13,32 @@ class InputManager:
|
|||||||
else:
|
else:
|
||||||
import keylist_win_fi as keys
|
import keylist_win_fi as keys
|
||||||
|
|
||||||
self.right_paw_keys = keys.right_paw_keys
|
|
||||||
self.left_paw_keys = keys.left_paw_keys
|
|
||||||
self.shifted_keys = keys.shifted_keys
|
self.shifted_keys = keys.shifted_keys
|
||||||
|
|
||||||
|
for key in keys.right_paw_keys:
|
||||||
|
self.right_paw_keys.append(key.lower())
|
||||||
|
|
||||||
|
for key in keys.left_paw_keys:
|
||||||
|
self.left_paw_keys.append(key.lower())
|
||||||
|
|
||||||
def on_update(self, down):
|
def on_update(self, down):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def press_key(self, key):
|
def press_key(self, key):
|
||||||
|
key = key.lower()
|
||||||
if not key in self.currently_pressed_keys:
|
if not key in self.currently_pressed_keys:
|
||||||
self.currently_pressed_keys.append(key)
|
self.currently_pressed_keys.append(key)
|
||||||
self.on_update(True)
|
self.on_update(True)
|
||||||
|
|
||||||
def release_key(self, key):
|
def release_key(self, key):
|
||||||
|
key = key.lower()
|
||||||
if key in self.currently_pressed_keys:
|
if key in self.currently_pressed_keys:
|
||||||
self.currently_pressed_keys.remove(key)
|
self.currently_pressed_keys.remove(key)
|
||||||
self.on_update(False)
|
self.on_update(False)
|
||||||
|
|
||||||
shifted = self.shifted_keys.get(key)
|
shifted = self.shifted_keys.get(key)
|
||||||
|
if shifted != None:
|
||||||
|
shifted = shifted.lower()
|
||||||
if shifted in self.currently_pressed_keys:
|
if shifted in self.currently_pressed_keys:
|
||||||
self.currently_pressed_keys.remove(key)
|
self.currently_pressed_keys.remove(key)
|
||||||
self.on_update(False)
|
self.on_update(False)
|
||||||
|
@ -2,7 +2,7 @@ left_paw_keys = [
|
|||||||
"1", "2", "3", "4", "5",
|
"1", "2", "3", "4", "5",
|
||||||
"Q", "W", "E", "R", "T", "Y",
|
"Q", "W", "E", "R", "T", "Y",
|
||||||
"A", "S", "D", "F", "G", "H",
|
"A", "S", "D", "F", "G", "H",
|
||||||
"Z", "X", "C", "V", "B",
|
"Oem_102", "Z", "X", "C", "V", "B",
|
||||||
|
|
||||||
"Espace", "Oem_5", "Tab", "Capital", "Lshift",
|
"Espace", "Oem_5", "Tab", "Capital", "Lshift",
|
||||||
"Lcontrol", "Lwin", "Lmenu", "Space",
|
"Lcontrol", "Lwin", "Lmenu", "Space",
|
||||||
|
Loading…
Reference in New Issue
Block a user