Update fenrir.py
This commit is contained in:
parent
b8a6ef4fdc
commit
cd58d24a74
@ -35,18 +35,21 @@ class fenrir():
|
||||
|
||||
def handleProcess(self):
|
||||
timeout = self.environment['runtime']['inputManager'].proceedInputEvent(self.environment)
|
||||
if not timeout:
|
||||
self.prepareCommand()
|
||||
if not (self.environment['runtime']['inputManager'].isConsumeInput(self.environment) or \
|
||||
self.environment['runtime']['inputManager'].isFenrirKeyPressed(self.environment) and
|
||||
not self.environment['runtime']['commandManager'].isCommandQueued(self.environment):
|
||||
self.environment['runtime']['inputManager'].writeEventBuffer(self.environment)
|
||||
elif self.environment['runtime']['inputManager'].noKeyPressed(self.environment):
|
||||
self.environment['runtime']['inputManager'].clearEventBuffer(self.environment)
|
||||
|
||||
try:
|
||||
self.environment['runtime']['screenManager'].update(self.environment)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
self.environment['runtime']['debug'].writeDebugOut(self.environment, str(e),debug.debugLevel.ERROR)
|
||||
if not timeout:
|
||||
self.prepareCommand()
|
||||
if not (self.environment['runtime']['inputManager'].isConsumeInput(self.environment) or \
|
||||
self.environment['runtime']['inputManager'].isFenrirKeyPressed(self.environment)):
|
||||
self.environment['runtime']['inputManager'].writeEventBuffer(self.environment)
|
||||
elif not self.environment['runtime']['commandManager'].isCommandQueued(self.environment) or self.environment['runtime']['inputManager'].noKeyPressed(self.environment):
|
||||
self.environment['runtime']['inputManager'].clearEventBuffer(self.environment)
|
||||
|
||||
self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onInput')
|
||||
self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onScreenChanged')
|
||||
|
||||
@ -55,14 +58,15 @@ class fenrir():
|
||||
def prepareCommand(self):
|
||||
if self.environment['input']['keyForeward']:
|
||||
return
|
||||
if time.time() - self.environment['commandInfo']['lastCommandExecutionTime'] < 0.2:
|
||||
return
|
||||
shortcut = self.environment['runtime']['inputManager'].getCurrShortcut(self.environment)
|
||||
command = self.environment['runtime']['inputManager'].getCommandForShortcut(self.environment, shortcut)
|
||||
self.environment['runtime']['commandManager'].queueCommand(self.environment, command)
|
||||
|
||||
def handleCommands(self):
|
||||
if self.environment['runtime']['commandManager'].isCommandQueued(self.environment):
|
||||
if time.time() - self.environment['commandInfo']['lastCommandExecutionTime'] < 0.2:
|
||||
return
|
||||
if not self.environment['runtime']['commandManager'].isCommandQueued(self.environment):
|
||||
return
|
||||
self.environment['runtime']['commandManager'].executeCommand(self.environment, self.environment['commandInfo']['currCommand'], 'commands')
|
||||
|
||||
def shutdownRequest(self):
|
||||
|
Loading…
Reference in New Issue
Block a user