Dateien hochladen nach „“

master
Justus Jan Nico Wolff 2022-08-19 15:27:53 +02:00
parent bf0b1813c6
commit 5e8453579d
1 changed files with 16 additions and 8 deletions

View File

@ -5,7 +5,7 @@ class game():
import subprocess
import pkg_resources
print("initializing hashengine and installing dependencies if missing")
required = {'keyboard', 'sounddevice', 'soundfile'}
required = {'pynput', 'sounddevice', 'soundfile'}
installed = {pkg.key for pkg in pkg_resources.working_set}
missing = required - installed
@ -30,7 +30,7 @@ class game():
input("enter to continue...")
exit()
self.osmodule = __import__("os")
self.keyboard = __import__("keyboard")
self.keyboard = __import__("pynput").keyboard
try:
self.sounddevice = __import__("sounddevice")
except OSError:
@ -39,7 +39,7 @@ class game():
self.sounddevice = False
try:
self.soundfile = __import__("soundfile")
except OSError:
print("ERROR: Could not find sndfile library. so that means that no audio can be played.")
input("enter to continue")
@ -62,11 +62,19 @@ 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
#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
self.futuremap = self.map.copy()
for i in self.objects: