Dateien hochladen nach „“

master
Justus Jan Nico Wolff 2022-08-20 10:31:53 +02:00
parent 98835b911a
commit 73db25e0b3
1 changed files with 7 additions and 16 deletions

View File

@ -5,7 +5,7 @@ class game():
import subprocess
import pkg_resources
print("initializing hashengine and installing dependencies if missing")
required = {'pynput', 'sounddevice', 'soundfile'}
required = {'keyboard', 'sounddevice', 'soundfile'}
installed = {pkg.key for pkg in pkg_resources.working_set}
missing = required - installed
@ -30,8 +30,7 @@ class game():
input("enter to continue...")
exit()
self.osmodule = __import__("os")
self.keyboard = __import__("pynput")
self.keyboard = self.keyboard.keyboard
self.keyboard = __import__("keyboard")
try:
self.sounddevice = __import__("sounddevice")
except OSError:
@ -63,19 +62,11 @@ class game():
return Decimal(target).to_integral_value()
def update(self):
#for i in self.pressedkeys:
#if self.keyboard.is_pressed(i):
#self.pressedkeys[i] = True
#else:
#self.pressedkeys[i] = False
with self.keyboard.Events() as events:
event = events.get(0.1)
for i in self.pressedkeys:
if event == i:
self.pressedkeys[i] = True
else:
self.pressedkeys[i] = False
for i in self.pressedkeys:
if self.keyboard.is_pressed(i):
self.pressedkeys[i] = True
else:
self.pressedkeys[i] = False
self.futuremap = self.map.copy()
for i in self.objects: