예제 #1
0
파일: gamestate.py 프로젝트: maker91/card
	def __init__(self):
		self._manager.add_state("pause", PauseState, False)
		self._curtime = 0.0
		self._playerdata = load_player_data("maker91")
		self._deck = self._playerdata["decks"].values()[0]
		self._cards_map = get_cards_map(compressed=False)
		self._traits_map = get_traits_map()
		self._cards = [Card(self._cards_map[card_id]) for card_id in self._deck]

		self._gui = BaseElement()
예제 #2
0
파일: gamestate.py 프로젝트: maker91/card
class GameState(State):
	def __init__(self):
		self._manager.add_state("pause", PauseState, False)
		self._curtime = 0.0
		self._playerdata = load_player_data("maker91")
		self._deck = self._playerdata["decks"].values()[0]
		self._cards_map = get_cards_map(compressed=False)
		self._traits_map = get_traits_map()
		self._cards = [Card(self._cards_map[card_id]) for card_id in self._deck]

		self._gui = BaseElement()
		# self._gui.add_child(
		# 	panel.Panel(sf.Vector2(400, 400), sf.Vector2(800, 600)).add_child(
		# 		panel.Panel(sf.Vector2(40, 40))
		# 	)
		# )


	def on_enter(self):
		print "Entered game state!"


	def on_exit(self):
		print "Exiting game state!"


	def tick(self, dt):
		self._curtime += dt
		self._gui.tick(dt)


	def draw(self, window):
		for i, card in enumerate(self._cards):
			card.draw(window, position=(i*160.0, 0.0), scale=(0.4, 0.4))
		self._gui.draw(window)
	

	def handle_event(self, event):
		if type(event) == sf.KeyEvent and event.released and event.code == sf.Keyboard.ESCAPE:
			self._manager.push("pause")
예제 #3
0
파일: panel.py 프로젝트: maker91/card
	def __init__(self, position=sf.Vector2(0, 0), size=sf.Vector2(100, 100), parent=None):
		self.size = size
		BaseElement.__init__(self, position, parent)