コード例 #1
0
ファイル: View.py プロジェクト: HalfVoxel/game-of-life
	def draw(self):

		updateInterval = 1.0/(2**self.speed)
		if time.time() - self.lastUpdate > updateInterval and self.running:
			self.lastUpdate = time.time()

			start = time.time()

			for i in range(0,self.skip+1):
				self.sim.update()

			#print("Updating ",time.time()-start)

		start = time.time()

		self.draw_simulation()

		#print("Rendering ",time.time()-start)

		# Draw an outline around the world
		top_right = self.local_to_screen((self.sim.size,self.sim.size))
		bottom_left = self.local_to_screen((0,0))
		GUI.draw_rect_outline (bottom_left[0],bottom_left[1],top_right[0]-bottom_left[0],top_right[1]-bottom_left[1],80)

		self.gui.draw()