From 7a12cc0889cce39d2888f6a2f8a13bc026a0f607 Mon Sep 17 00:00:00 2001 From: chrys Date: Sun, 25 Sep 2016 22:28:14 +0200 Subject: [PATCH] improve performance --- src/fenrir-package/fenrir.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fenrir-package/fenrir.py b/src/fenrir-package/fenrir.py index f885172f..be267bd3 100755 --- a/src/fenrir-package/fenrir.py +++ b/src/fenrir-package/fenrir.py @@ -41,6 +41,7 @@ class fenrir(): self.prepareCommand() if not (self.wasCommand or self.environment['runtime']['inputManager'].isFenrirKeyPressed() or self.environment['generalInformation']['tutorialMode']): self.environment['runtime']['inputManager'].writeEventBuffer() + if self.environment['runtime']['inputManager'].noKeyPressed(): if self.wasCommand: self.wasCommand = False @@ -51,7 +52,6 @@ class fenrir(): self.environment['input']['keyForeward'] -=1 self.environment['input']['prevDeepestInput'] = [] else: - self.environment['runtime']['screenManager'].update() self.environment['runtime']['commandManager'].executeDefaultTrigger('onInput') @@ -73,6 +73,8 @@ class fenrir(): #print(time.time()-startTime) def prepareCommand(self): + if time.time() - self.environment['commandInfo']['lastCommandExecutionTime'] < 0.2: + return if self.environment['runtime']['inputManager'].noKeyPressed(): return if self.environment['input']['keyForeward'] > 0: @@ -84,9 +86,7 @@ class fenrir(): if len(self.environment['input']['prevDeepestInput']) < len(self.environment['input']['currInput']): self.wasCommand = command != '' - def handleCommands(self): - if time.time() - self.environment['commandInfo']['lastCommandExecutionTime'] < 0.2: - return + def handleCommands(self): if not self.environment['runtime']['commandManager'].isCommandQueued(): return self.environment['runtime']['commandManager'].executeCommand( self.environment['commandInfo']['currCommand'], 'commands')