Exemple #1
0
    def render(self, screen):
        slider_end = IMAGES['slider_end']
        pos_start = (self.pos[0] - slider_end.get_width() + 1, self.pos[1])
        pos_end = (self.pos[0] + self.size[0] - 1, self.pos[1])
        screen.blit(slider_end, pos_start)
        screen.blit(slider_end, pos_end)
        screen.blit(
            my.FONT(12).render(str(self.min), True, (0, 0, 0)),
            (pos_start[0], pos_start[1] + 15))
        screen.blit(
            my.FONT(12).render(str(self.max), True, (0, 0, 0)),
            (pos_end[0], pos_end[1] + 15))

        screen.blit(self.image_slider, self.pos)
        screen.blit(
            self.image_pointer,
            (self.getValueToPixel() - self.image_pointer.get_width() / 2,
             self.pos[1] - self.image_pointer.get_height() / 2))
Exemple #2
0
    def __init__(self,
                 oninput,
                 pos,
                 size=[0, 0],
                 pretext='',
                 fontsize=12,
                 box_image=None,
                 centralization=CENTER):
        Widget.__init__(
            self, pos,
            size if not size[0] == 0 else my.FONT(fontsize).size(pretext),
            centralization)
        self.oninput = oninput
        self.pretext = pretext
        self.font = my.FONT(fontsize)
        self.box_image = pygame.transform.scale(box_image, self.size)
        self.text = ''

        self.timer = 0
        self.selected = False
Exemple #3
0
    def render(self, screen):
        if self.clicked:
            image = self.image_pressed
        elif self.hovered:
            image = self.image_hovered
        else:
            image = self.image

        screen.blit(image, self.pos)

        fontSurface = my.FONT(int(image.get_height() - (79 % image.get_height()))).render(self.text, True, [0, 0, 0])
        centralizedX = self.pos[0] + image.get_width() / 2 - fontSurface.get_width() / 2
        centralizedY = self.pos[1] + image.get_height() / 2 - fontSurface.get_height() / 2

        screen.blit(fontSurface, (centralizedX, centralizedY))
Exemple #4
0
    def render(self, screen):
        if self.clicked:
            color = self.color_pressed
        elif self.hovered:
            color = self.color_hovered
        else:
            color = self.color

        self.surface.fill(color)
        screen.blit(self.surface, self.pos)

        fontSurface = my.FONT(12).render(self.text, True, [0, 0, 0])
        centralizedX = self.pos[0] + self.surface.get_width() / 2 - fontSurface.get_width() / 2
        centralizedY = self.pos[1] + self.surface.get_height() / 2 - fontSurface.get_height() / 2

        screen.blit(fontSurface, (centralizedX, centralizedY))
Exemple #5
0
	def __init__(self):
		""" PRE-RUN """
		self.adaptScreen()
		pygame.display.set_icon(pygame.image.load('assets/tanks/tank_1.png'))
		pygame.display.set_caption("Tanks - Iniciando...")

		""" LOADING SCREEN """
		self.screen.fill(my.RED)
		text = my.FONT(24).render("Carregando...", True, (0, 0, 0))
		self.screen.blit(text, (my.SCREEN_HALF_WIDTH - text.get_size()[0] / 2, my.SCREEN_HALF_HEIGHT))
		pygame.display.update()

		self.game = None
		self.clock = None
		self.event_manager = None
		self.interface = None
		self.cursor = None
		self.running = True