Dateien hochladen nach „“
parent
00a180fa2f
commit
87a1de5607
|
@ -4,13 +4,8 @@ class game():
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
import os
|
|
||||||
print("initializing hashengine and installing dependencies if missing")
|
print("initializing hashengine and installing dependencies if missing")
|
||||||
self.linecount = 0
|
required = {'keyboard', 'sounddevice', 'soundfile'}
|
||||||
if os.name == 'nt':
|
|
||||||
required = {'sounddevice', 'soundfile', 'windows-curses'}
|
|
||||||
else:
|
|
||||||
required = {'sounddevice', 'soundfile'}
|
|
||||||
installed = {pkg.key for pkg in pkg_resources.working_set}
|
installed = {pkg.key for pkg in pkg_resources.working_set}
|
||||||
missing = required - installed
|
missing = required - installed
|
||||||
|
|
||||||
|
@ -21,13 +16,21 @@ class game():
|
||||||
print(i)
|
print(i)
|
||||||
subprocess.check_call([python, '-m', 'pip', 'install', i], stdout=sys.stdout)
|
subprocess.check_call([python, '-m', 'pip', 'install', i], stdout=sys.stdout)
|
||||||
print("done")
|
print("done")
|
||||||
|
import os
|
||||||
|
import ctypes
|
||||||
import string
|
import string
|
||||||
|
def isAdmin():
|
||||||
|
try:
|
||||||
|
is_admin = (os.getuid() == 0)
|
||||||
|
except AttributeError:
|
||||||
|
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
|
||||||
|
return is_admin
|
||||||
|
if not isAdmin():
|
||||||
|
print("error: hashengine needs to be run as an admin")
|
||||||
|
input("enter to continue...")
|
||||||
|
exit()
|
||||||
self.osmodule = __import__("os")
|
self.osmodule = __import__("os")
|
||||||
import curses
|
self.keyboard = __import__("keyboard")
|
||||||
self.screen = curses.initscr()
|
|
||||||
self.screen.nodelay(1)
|
|
||||||
curses.noecho()
|
|
||||||
curses.endwin()
|
|
||||||
try:
|
try:
|
||||||
self.sounddevice = __import__("sounddevice")
|
self.sounddevice = __import__("sounddevice")
|
||||||
except OSError:
|
except OSError:
|
||||||
|
@ -59,17 +62,11 @@ class game():
|
||||||
return Decimal(target).to_integral_value()
|
return Decimal(target).to_integral_value()
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
import curses
|
|
||||||
curses.noecho()
|
|
||||||
curses.endwin()
|
|
||||||
temp = self.screen.getch()
|
|
||||||
#temp = ""
|
|
||||||
for i in self.pressedkeys:
|
for i in self.pressedkeys:
|
||||||
if temp == ord(i):
|
if self.keyboard.is_pressed(i):
|
||||||
self.pressedkeys[i] = True
|
self.pressedkeys[i] = True
|
||||||
else:
|
else:
|
||||||
self.pressedkeys[i] = False
|
self.pressedkeys[i] = False
|
||||||
curses.flushinp()
|
|
||||||
|
|
||||||
self.futuremap = self.map.copy()
|
self.futuremap = self.map.copy()
|
||||||
for i in self.objects:
|
for i in self.objects:
|
||||||
|
|
Loading…
Reference in New Issue