WMICraft/ui/stats.py
2022-03-11 19:42:17 +01:00

45 lines
1.7 KiB
Python

import pygame
from common.colors import FONT_DARK, ORANGE, WHITE, RED
from common.constants import COLUMNS, GRID_CELL_PADDING, GRID_CELL_WIDTH, BORDER_WIDTH, BORDER_RADIUS
from common.helpers import draw_text
class Stats:
def __init__(self):
self.grid = []
def draw(self, screen):
x = (GRID_CELL_PADDING + GRID_CELL_WIDTH) * COLUMNS + BORDER_WIDTH + 15
y = 5
# background
pygame.draw.rect(screen, WHITE, pygame.Rect(x, y, 340, 450), 0, BORDER_RADIUS)
# title
draw_text('STATS', FONT_DARK, screen, x + 120, y + 10, 36)
pygame.draw.rect(screen, ORANGE, pygame.Rect(x, y + 65, 340, 3))
# shields
shield_blue = pygame.image.load('./resources/textures/shield_blue.png')
shield_red = pygame.image.load('./resources/textures/shield_red.png')
screen.blit(shield_blue, (x + 20, y + 80))
screen.blit(shield_red, (x + 200, y + 80))
draw_text('VS', FONT_DARK, screen, x + 150, y + 120, 36)
# HP bars
pygame.draw.rect(screen, RED, pygame.Rect(x + 30, y + 210, 100, 15), 0, 4)
pygame.draw.rect(screen, RED, pygame.Rect(x + 210, y + 210, 100, 15), 0, 4)
# texts
draw_text('Rycerze: 2', FONT_DARK, screen, x + 35, y + 240, 18)
draw_text('Fortece: 1', FONT_DARK, screen, x + 35, y + 270, 18)
draw_text('Rycerze: 4', FONT_DARK, screen, x + 215, y + 240, 18)
draw_text('Fortece: 0', FONT_DARK, screen, x + 215, y + 270, 18)
# points
pygame.draw.rect(screen, ORANGE, pygame.Rect(x, y + 390, 340, 3))
draw_text('PUNKTY: 10', FONT_DARK, screen, x + 35, y + 408, 18, True)
draw_text('PUNKTY: 10', FONT_DARK, screen, x + 215, y + 408, 18, True)