This commit is contained in:
chrys 2018-03-09 14:54:19 +01:00
parent 2ce5adba82
commit f354d1cd38
2 changed files with 24 additions and 29 deletions

View File

@ -56,32 +56,34 @@ class fenrirManager():
if event['Data']: if event['Data']:
event['Data']['EventName'] = self.environment['runtime']['inputManager'].convertEventName(event['Data']['EventName']) event['Data']['EventName'] = self.environment['runtime']['inputManager'].convertEventName(event['Data']['EventName'])
self.environment['runtime']['inputManager'].handleInputEvent(event['Data']) self.environment['runtime']['inputManager'].handleInputEvent(event['Data'])
else:
return
if self.environment['runtime']['inputManager'].noKeyPressed(): if self.environment['runtime']['inputManager'].noKeyPressed():
self.environment['runtime']['inputManager'].clearLastDeepInput() self.environment['runtime']['inputManager'].clearLastDeepInput()
if True:
if self.environment['runtime']['screenManager'].isSuspendingScreen():
self.environment['runtime']['inputManager'].writeEventBuffer()
else:
if self.environment['runtime']['helpManager'].isTutorialMode():
self.environment['runtime']['inputManager'].clearEventBuffer()
self.detectCommand() if self.environment['runtime']['screenManager'].isSuspendingScreen():
self.environment['runtime']['inputManager'].writeEventBuffer()
else:
if self.environment['runtime']['helpManager'].isTutorialMode():
self.environment['runtime']['inputManager'].clearEventBuffer()
if self.modifierInput: self.detectCommand()
self.environment['runtime']['inputManager'].clearEventBuffer()
if self.singleKeyCommand: if self.modifierInput:
if self.environment['runtime']['inputManager'].noKeyPressed(): self.environment['runtime']['inputManager'].clearEventBuffer()
self.environment['runtime']['inputManager'].clearEventBuffer() if self.singleKeyCommand:
else: if self.environment['runtime']['inputManager'].noKeyPressed():
self.environment['runtime']['inputManager'].writeEventBuffer() self.environment['runtime']['inputManager'].clearEventBuffer()
if self.environment['runtime']['inputManager'].noKeyPressed(): else:
self.modifierInput = False self.environment['runtime']['inputManager'].writeEventBuffer()
self.singleKeyCommand = False if self.environment['runtime']['inputManager'].noKeyPressed():
if self.environment['input']['keyForeward'] > 0: self.modifierInput = False
self.environment['input']['keyForeward'] -=1 self.singleKeyCommand = False
self.environment['runtime']['screenManager'].update('onInput') if self.environment['input']['keyForeward'] > 0:
self.environment['runtime']['commandManager'].executeDefaultTrigger('onInput') self.environment['input']['keyForeward'] -=1
#print('handleInput:',time.time() - startTime) self.environment['runtime']['screenManager'].update('onInput')
self.environment['runtime']['commandManager'].executeDefaultTrigger('onInput')
#print('handleInput:',time.time() - startTime)
def handleExecuteCommand(self, event): def handleExecuteCommand(self, event):
if event['Data'] == '': if event['Data'] == '':
return return

View File

@ -90,28 +90,21 @@ class driver(inputDriver):
except: except:
self.removeDevice(fd) self.removeDevice(fd)
while(event): while(event):
self.env['runtime']['debug'].writeDebugOut('DEBUG INPUT1:' + str(event),debug.debugLevel.INFO)
self.env['input']['eventBuffer'].append( [self.iDevices[fd], self.uDevices[fd], event]) self.env['input']['eventBuffer'].append( [self.iDevices[fd], self.uDevices[fd], event])
if event.type == evdev.events.EV_KEY: if event.type == evdev.events.EV_KEY:
self.env['runtime']['debug'].writeDebugOut('DEBUG INPUT2:' + str(event),debug.debugLevel.INFO)
if event.code != 0: if event.code != 0:
self.env['runtime']['debug'].writeDebugOut('DEBUG INPUT3:' + str(event),debug.debugLevel.INFO)
currMapEvent = self.mapEvent(event) currMapEvent = self.mapEvent(event)
if not currMapEvent: if not currMapEvent:
foreward = True foreward = True
self.env['runtime']['debug'].writeDebugOut('DEBUG INPUT4:' + str(currMapEvent),debug.debugLevel.INFO)
if not isinstance(currMapEvent['EventName'], str): if not isinstance(currMapEvent['EventName'], str):
foreward = True foreward = True
self.env['runtime']['debug'].writeDebugOut('DEBUG INPUT5:' + str(currMapEvent),debug.debugLevel.INFO)
if not foreward or eventFired: if not foreward or eventFired:
if currMapEvent['EventState'] in [0,1,2]: if currMapEvent['EventState'] in [0,1,2]:
eventQueue.put({"Type":fenrirEventType.KeyboardInput,"Data":currMapEvent.copy()}) eventQueue.put({"Type":fenrirEventType.KeyboardInput,"Data":currMapEvent.copy()})
eventFired = True eventFired = True
self.env['runtime']['debug'].writeDebugOut('DEBUG INPUT6:' + str(currMapEvent),debug.debugLevel.INFO)
else: else:
if not event.type in [0,4]: if not event.type in [0,4]:
foreward = True foreward = True
self.env['runtime']['debug'].writeDebugOut('DEBUG INPUT7:' + str(currMapEvent),debug.debugLevel.INFO)
event = self.iDevices[fd].read_one() event = self.iDevices[fd].read_one()
if foreward and not eventFired: if foreward and not eventFired: