示例#1
0
    def __init__(self):
        self.calculator = Calculations()
        self.mice = MouseInput(self.calculator)
        '''
        Constructor
        '''

        #miceSensors.update()        thread.start_new_thread( miceSensor.update(), ("Thread-1", 2, ) )

        #        self.initMouseThread()
        pass
示例#2
0
	def __init__(self, surface, gameUpdate = lambda : None):
		# Input
		self.keyboardInput = KeyboardInput(surface)
		self.mouseInput = MouseInput(surface)

		# The game components
		self.surface = surface
		self.gameUpdate = gameUpdate
		self.physics = PhysicsEngine(self.surface)
		
		self.gameTimer = GameTimer(surface,[self.keyboardInput.update, 
			self.mouseInput.update, self.gameUpdate, self.physics.detection.updateStep, self.physics.resolution.update])
示例#3
0
class Pid(object):
    '''
    classdocs
    '''
    def __init__(self):
        self.calculator = Calculations()
        self.mice = MouseInput(self.calculator)
        '''
        Constructor
        '''

        #miceSensors.update()        thread.start_new_thread( miceSensor.update(), ("Thread-1", 2, ) )

        #        self.initMouseThread()
        pass

    def computeAngle(self):
        pass

    def initMiceThread(self):
        self.mice.start()
示例#4
0
class GameLoop(object):
	def __init__(self, surface, gameUpdate = lambda : None):
		# Input
		self.keyboardInput = KeyboardInput(surface)
		self.mouseInput = MouseInput(surface)

		# The game components
		self.surface = surface
		self.gameUpdate = gameUpdate
		self.physics = PhysicsEngine(self.surface)
		
		self.gameTimer = GameTimer(surface,[self.keyboardInput.update, 
			self.mouseInput.update, self.gameUpdate, self.physics.detection.updateStep, self.physics.resolution.update])

	def addKeyPressListener(self, handler):
		self.keyboardInput.addKeyPressListener(handler)

	def addKeyReleaseListener(self, handler):
		self.keyboardInput.addKeyReleaseListener(handler)

	def addKeyTypedListener(self, handler):
		self.keyboardInput.addKeyTypedListener(handler)

	def addMouseDownListener(self, handler):
		self.mouseInput.addMouseDownListener(handler)

	def addMouseUpListener(self, handler):
		self.mouseInput.addMouseUpListener(handler)
	
	def addMouseMovementListener(self, handler):
		self.mouseInput.addMouseMovementListener(handler)
	
	def addMouseClickedListener(self, handler):
		self.mouseInput.addMouseClickedListener(handler)

	def add(self, obj):
		self.surface.add(obj)
		self.physics.addBody(obj)

	def run(self):
		self.gameTimer.run()