feat: add colors for pieces to config
This commit is contained in:
11
config.yaml
11
config.yaml
@@ -1,10 +1,15 @@
|
|||||||
# window properties
|
|
||||||
window:
|
window:
|
||||||
width: 800
|
width: 800
|
||||||
height: 600
|
height: 600
|
||||||
icon: "img/tetris_icon.png"
|
icon: "img/tetris_icon.png"
|
||||||
title: "Tetris"
|
title: "Tetris"
|
||||||
background-color: "#6495ED" # cornflower blue
|
|
||||||
|
|
||||||
engine:
|
engine:
|
||||||
fps: 60
|
fps: 60
|
||||||
|
|
||||||
|
# https://coolors.co/6495ed-ee6352-59cd90-fac05e-f79d84
|
||||||
|
color:
|
||||||
|
cornflower-blue: "#6495ED"
|
||||||
|
fire-opal: "#EE6352"
|
||||||
|
emerald: "#59CD90"
|
||||||
|
maximum-yellow-red: "#59CD90"
|
||||||
|
|||||||
7
main.py
7
main.py
@@ -5,11 +5,11 @@ from util.ConfigurationManager import ConfigurationManager
|
|||||||
|
|
||||||
# potential color palette https://coolors.co/6495ed-ee6352-59cd90-fac05e-f79d84
|
# potential color palette https://coolors.co/6495ed-ee6352-59cd90-fac05e-f79d84
|
||||||
FIRE_OPAL = (238, 99, 82) # TODO define colors in config
|
FIRE_OPAL = (238, 99, 82) # TODO define colors in config
|
||||||
TILE_SIZE = 20 # TODO define tile size in config
|
TILE_SIZE = 10 # TODO define tile size in config
|
||||||
|
|
||||||
def draw(screen):
|
def draw(screen):
|
||||||
# draw window bg
|
# draw window bg
|
||||||
bg_color = pygame.Color(ConfigurationManager.configuration["window"]["background-color"])
|
bg_color = pygame.Color(ConfigurationManager.configuration["color"]["cornflower-blue"])
|
||||||
screen.fill(bg_color)
|
screen.fill(bg_color)
|
||||||
|
|
||||||
# TODO move piece logic into class
|
# TODO move piece logic into class
|
||||||
@@ -26,7 +26,8 @@ def draw(screen):
|
|||||||
for point in j_scaled_points:
|
for point in j_scaled_points:
|
||||||
j_transalation_points.append((point[0] + TILE_SIZE, point[1] + TILE_SIZE))
|
j_transalation_points.append((point[0] + TILE_SIZE, point[1] + TILE_SIZE))
|
||||||
|
|
||||||
pygame.draw.polygon(screen, FIRE_OPAL, j_transalation_points, 0)
|
fire_opal = pygame.Color(ConfigurationManager.configuration["color"]["fire-opal"])
|
||||||
|
pygame.draw.polygon(screen, fire_opal, j_transalation_points, 0)
|
||||||
|
|
||||||
# update display
|
# update display
|
||||||
pygame.display.update()
|
pygame.display.update()
|
||||||
|
|||||||
Reference in New Issue
Block a user