Ejemplo n.º 1
0
    def __init__(self, screen, lastUI):
        ui.UI.__init__(self, screen)
        self.lastUI = lastUI

        copy = screen.copy()
        self.background = pygame.Surface((my.SCREEN_WIDTH, my.SCREEN_HEIGHT),
                                         flags=pygame.SRCALPHA)
        self.background.blit(copy, (0, 0))
        self.background.fill(
            (my.LIGHT_GREY[0], my.LIGHT_GREY[1], my.LIGHT_GREY[2], 10))

        self.addWidget(
            label.Image([0, 0],
                        self.background,
                        centralization=ui.RIGHT | ui.BOTTOM))
        self.addWidget(
            button.ImageButton(
                lambda: self.quit(),
                [my.SCREEN_HALF_WIDTH, my.SCREEN_HALF_HEIGHT - 60],
                text="Sair",
                image_surface=ui.IMAGES['button'],
                image_pressed=ui.IMAGES['button_pressed']))
        self.addWidget(
            button.ImageButton(lambda: self.backGame(),
                               [my.SCREEN_HALF_WIDTH, my.SCREEN_HALF_HEIGHT],
                               text="Voltar ao jogo",
                               image_surface=ui.IMAGES['button'],
                               image_pressed=ui.IMAGES['button_pressed']))

        self.next = self
Ejemplo n.º 2
0
	def __init__(self, screen):
		ui.UI.__init__(self, screen)

		self.fpsValue = label.Text([my.SCREEN_HALF_WIDTH + 25, my.SCREEN_HEIGHT // 6], str(my.FPS), fontsize=20)
		self.addWidget(self.fpsValue)
		self.addWidget(label.Text([my.SCREEN_HALF_WIDTH - 25, my.SCREEN_HEIGHT // 6], "FPS", fontsize=20))
		self.addWidget(slider.SliderBar(partial(self.sliderFps), [my.SCREEN_HALF_WIDTH, my.SCREEN_HEIGHT // 4], (300, 5), min=20,
							 max=200, step=1,
							 initial=my.FPS,
							 image_slider=ui.IMAGES['slider'],
							 image_pointer=ui.IMAGES['slider_pointer']))

		contents = []
		modes = pygame.display.list_modes()
		for mode in range(0, len(modes) - 5):  # -5 = Tirando os 5 menores valores pois é pequeno até demais pro jogo
			contents.append(str(modes[mode][0]) + ' x ' + str(modes[mode][1]) + (' (FULL)' if mode == 0 else ''))
		self.addWidget(button.Drop(self, contents,
								   partial(self.selectResolution),
								   [my.SCREEN_HALF_WIDTH, my.SCREEN_HALF_HEIGHT - 50],
								   text="Resolução",
								   image_surface=ui.IMAGES['button'],
								   image_pressed=ui.IMAGES['button_pressed'],
								   down=True))

		self.addWidget(label.Text([my.SCREEN_HALF_WIDTH + 30, my.SCREEN_HALF_HEIGHT], "Acelerar CPU (tela cheia)", fontsize=20))
		self.addWidget(checker.Checker(partial(self.checkedHardware),
									   [my.SCREEN_HALF_WIDTH - 150, my.SCREEN_HALF_HEIGHT],
									   checked=my.HARDWARE_ACCELERATED,
									   image=ui.IMAGES['box'],
									   image_checked=ui.IMAGES['box_checked']))

		self.addWidget(label.Text([my.SCREEN_HALF_WIDTH + 20, my.SCREEN_HALF_HEIGHT + 40], "Áudio, sons e vozes", fontsize=20))
		self.addWidget(checker.Checker(partial(self.checkedAudio),
									   [my.SCREEN_HALF_WIDTH - 150, my.SCREEN_HALF_HEIGHT + 40],
									   checked=not my.MUTED,
									   image=ui.IMAGES['box'],
									   image_checked=ui.IMAGES['box_checked']))

		self.addWidget(button.ImageButton(lambda: self.back(),
										  [my.SCREEN_HALF_WIDTH - 20, my.SCREEN_HEIGHT - (my.SCREEN_HEIGHT // 6)],
										  text="Voltar",
										  image_surface=ui.IMAGES['button'],
										  image_pressed=ui.IMAGES['button_pressed'],
										  centralization=ui.LEFT))
		self.addWidget(button.ImageButton(lambda: self.save(),
										  [my.SCREEN_HALF_WIDTH + 20, my.SCREEN_HEIGHT - (my.SCREEN_HEIGHT // 6)],
										  text="Salvar",
										  image_surface=ui.IMAGES['button_green'],
										  image_pressed=ui.IMAGES['button_green_pressed'],
										  centralization=ui.RIGHT))
		self.next = self
Ejemplo n.º 3
0
	def __init__(self, screen):
		ui.UI.__init__(self, screen)

		self.addWidget(label.Text([50, 50], "Configure o jogo:", fontsize=18, centralization=ui.RIGHT))

		self.addWidget(input.TextBox(partial(self.inputName), [my.SCREEN_HALF_WIDTH, my.SCREEN_HEIGHT // 6], [300, 40],
									 'Digite seu nicknme',
									 box_image=ui.IMAGES['button']))
		self.nickname = 'Jogador'

		self.enemiesValue = label.Text([my.SCREEN_HALF_WIDTH + 50, my.SCREEN_HALF_HEIGHT // 2 + 40], "5", fontsize=18)
		self.addWidget(self.enemiesValue)
		self.addWidget(label.Text([my.SCREEN_HALF_WIDTH - 10, my.SCREEN_HALF_HEIGHT // 2 + 40], "Inimigos", fontsize=18))
		self.addWidget(slider.SliderBar(partial(self.sliderEnemies), [my.SCREEN_HALF_WIDTH, my.SCREEN_HEIGHT // 3 + 32], (200, 5),
							 min=1, max=10, step=1,
							 initial=5,
							 image_slider=ui.IMAGES['slider'],
							 image_pointer=ui.IMAGES['slider_pointer']))

		self.mapSize = [my.SCREEN_WIDTH, my.SCREEN_HEIGHT + 200]
		contents = []
		for i in range(0, 500, 100):
			contents.append(str(my.SCREEN_WIDTH + i) + ' x ' + str(my.SCREEN_HEIGHT + 200))
		self.addWidget(button.Drop(self, contents,
								   partial(self.selectMapSize),
								   [my.SCREEN_HALF_WIDTH, my.SCREEN_HALF_HEIGHT],
								   text="Tamanho do Mapa",
								   image_surface=pygame.transform.scale(ui.IMAGES['button'], (270, 50)),
								   image_pressed=pygame.transform.scale(ui.IMAGES['button_pressed'], (270, 50)),
								   down=True))

		self.addWidget(button.ImageButton(lambda: self.back(),
										  [my.SCREEN_HALF_WIDTH - 20, my.SCREEN_HEIGHT - (my.SCREEN_HEIGHT // 6)],
										  text="Voltar",
										  image_surface=ui.IMAGES['button'],
										  image_pressed=ui.IMAGES['button_pressed'],
										  centralization=ui.LEFT))
		self.addWidget(button.ImageButton(lambda: self.startGame(),
										  [my.SCREEN_HALF_WIDTH + 20, my.SCREEN_HEIGHT - (my.SCREEN_HEIGHT // 6)],
										  text="Iniciar Jogo",
										  image_surface=ui.IMAGES['button_green'],
										  image_pressed=ui.IMAGES['button_green_pressed'],
										  centralization=ui.RIGHT))

		self.next = self
Ejemplo n.º 4
0
	def __init__(self, screen):
		ui.UI.__init__(self, screen)

		self.addWidget(label.Text(my.SCREEN_HALF_SIZE, "Em desenvolvimento...", fontsize=24))
		self.addWidget(button.ImageButton(lambda: self.back(),
										  [my.SCREEN_HALF_WIDTH, my.SCREEN_HEIGHT - (my.SCREEN_HEIGHT // 6)],
										  text="Voltar",
										  image_surface=ui.IMAGES['button'],
										  image_pressed=ui.IMAGES['button_pressed']))

		self.next = self
Ejemplo n.º 5
0
	def __init__(self, screen):
		ui.UI.__init__(self, screen)
		global BACKGROUND
		BACKGROUND = pygame.transform.scale(ui.IMAGES['background'], my.SCREEN_SIZE)

		self.logo = label.Image([my.SCREEN_HALF_WIDTH, -my.SCREEN_HEIGHT], pygame.image.load("assets/logo.png"),
								centralization=ui.BOTTOM)
		self.addWidget(self.logo)

		self.playOfflineButton = button.ImageButton(lambda: self.playOffline(),
													[my.SCREEN_HALF_WIDTH, my.SCREEN_HEIGHT],
													text="Jogar Offline",
													image_surface=ui.IMAGES['button'],
													image_pressed=ui.IMAGES['button_pressed'])
		self.playOnlineButton = button.ImageButton(lambda: self.playOnline(),
												   [my.SCREEN_HALF_WIDTH, my.SCREEN_HEIGHT],
												   text="Jogar Online",
												   image_surface=ui.IMAGES['button'],
												   image_pressed=ui.IMAGES['button_pressed'])
		self.optionsButton = button.ImageButton(lambda: self.options(),
												[my.SCREEN_HALF_WIDTH, my.SCREEN_HEIGHT],
												text="Opções",
												image_surface=ui.IMAGES['button'],
												image_pressed=ui.IMAGES['button_pressed'])
		self.creditsButton = button.ImageButton(lambda: self.credits(),
												[my.SCREEN_HALF_WIDTH, my.SCREEN_HEIGHT],
												text="Créditos",
												image_surface=ui.IMAGES['button'],
												image_pressed=ui.IMAGES['button_pressed'])
		self.addWidget(self.playOfflineButton)
		self.addWidget(self.playOnlineButton)
		self.addWidget(self.optionsButton)
		self.addWidget(self.creditsButton)
		self.addWidget(label.Text([my.SCREEN_WIDTH - 5, my.SCREEN_HEIGHT], "Tanks v" + my.VERSION, 20, centralization=ui.LEFT | ui.UPPER))

		self.animation = True
		self.readyToNext = False
		self.next = self
Ejemplo n.º 6
0
	def __init__(self, screen):
		ui.UI.__init__(self, screen)

		self.addWidget(label.Text([my.SCREEN_HALF_WIDTH, 100], "Desenvolvido por:", fontsize=24))
		self.addWidget(label.Text([my.SCREEN_HALF_WIDTH, 140], "Willian Gois ~the coder guy", fontsize=20))
		self.addWidget(label.Text([my.SCREEN_HALF_WIDTH, 160], "Lucas Verona ~the h4ck3r m4n", fontsize=20))

		self.addWidget(label.Text([my.SCREEN_HALF_WIDTH, 220], "Texturas por:", fontsize=24))
		self.addWidget(label.Text([my.SCREEN_HALF_WIDTH, 260], "(UI): Kenney Vleugels (www.kenney.nl)", fontsize=20))

		self.addWidget(button.ImageButton(lambda: self.back(),
										  [my.SCREEN_HALF_WIDTH, my.SCREEN_HEIGHT - (my.SCREEN_HEIGHT // 6)],
										  text="Voltar",
										  image_surface=ui.IMAGES['button'],
										  image_pressed=ui.IMAGES['button_pressed']))

		self.next = self