def processEvents(self): while True: HARDWARE.checkButtons() event = pygame.event.poll() if event != pygame.NOEVENT: break if event.type == pygame.QUIT: exit(0) elif event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: exit(0) elif event.type == pygame.MOUSEBUTTONDOWN or event.type == HARDWARE.BUTTONUP or event.type == HARDWARE.BUTTONDOWN or event.type == HARDWARE.BUTTONHOLD: nextScreen = self.tables.processEvent(event) if nextScreen: return nextScreen nextScreen = self.buttons.processEvent(event) # this will call my callbacks if nextScreen: return nextScreen return None
def __init__(self, kernel): self._kernel = kernel self._chart = {} self._ticks = 0 HARDWARE.add_suscriber(self)
## ## MAIN ## import log from log import * from hardware import HARDWARE from so import * if __name__ == '__main__': log.setupLogger() log.logger.info('Starting emulator') ## setup our hardware and set memory size to 25 "cells" HARDWARE.setup(25) ## new create the Operative System Kernel # "booteamos" el sistema operativo kernel = Kernel() prg1 = Program( "prg1.exe", [ASM.CPU(2), ASM.IO(), ASM.CPU(3), ASM.IO(), ASM.CPU(2)]) prg2 = Program("prg2.exe", [ASM.CPU(4), ASM.IO(), ASM.CPU(1)]) prg3 = Program("prg3.exe", [ASM.CPU(3)]) # executamos los programas "concurrentemente" kernel.run(prg1) kernel.run(prg2) kernel.run(prg3)
MatchSetupScreen("MatchSetupScreen") NumberChangeScreen("autoTimeChangeScreen","autoTime",0,"Autonomous:",YELLOW) NumberChangeScreen("teleopTimeChangeScreen","teleopTime",0,"Teleop:",GREEN) NumberChangeScreen("endGameTimeChangeScreen","endGameTime",0,"End Game:",RED) NumberChangeScreen("matchNumberChangeScreen","matchNumber",1,"Match:",BLUE) MatchOptionsScreen("MatchOptions") SystemOptionsScreen("SystemOptions") RunMatchScreen("RunMatch",bigScreen) AboutScreen("AboutScreen")#.process() SystemTestsScreen("SystemTests") BluetoothTestsScreen("BluetoothTests") RobotAssignmentScreen("RobotAssignmentScreen",MatchObject)#.process() PrepareMatchScreen("PrepareMatch",MatchObject)#.process() BootScreens(smallScreen,bigScreen)#.process() ButtonTestScreen("ButtonTestScreen")#.process() OptionScreen("OptionScreen")#.process() StartMatchScreen("StartMatch",MatchObject,bigScreen)#.process() while(True): MainScreen("MainScreen").process() # # END ROUTINES - these should always be called upon end # bigScreen.end() #hdmiProcess.join() # wait for the child to exit pygame.quit() HARDWARE.cleanup() exit()