feat(text_input): switch color definitions to settings file
This commit is contained in:
@@ -12,3 +12,12 @@ COLOR_DOOR_BEIGE = (245, 245, 220)
|
||||
COLOR_DOOR_BORDER = (100, 90, 80)
|
||||
COLOR_HP_BAR_GREEN = (0, 255, 0)
|
||||
COLOR_HP_BAR_BG = (50, 50, 50)
|
||||
|
||||
# --- BUTTONS ---
|
||||
COLOR_BUTTON = (0, 255, 0)
|
||||
COLOR_BUTTON_HOVER = (200, 255, 0)
|
||||
|
||||
# --- STARTSCREEN ---
|
||||
COLOR_STARTSCREEN_BACKGROUND = ((0, 0, 0))
|
||||
COLOR_STARTSCREEN_FONT_TITLE = (0, 255, 0)
|
||||
COLOR_STARTSCREEN_FONT_LABEL = (0, 255, 255)
|
||||
+11
-6
@@ -1,5 +1,10 @@
|
||||
import pygame
|
||||
from button import Button
|
||||
from settings import (COLOR_BUTTON,
|
||||
COLOR_BUTTON_HOVER,
|
||||
COLOR_STARTSCREEN_BACKGROUND,
|
||||
COLOR_STARTSCREEN_FONT_TITLE,
|
||||
COLOR_STARTSCREEN_FONT_LABEL)
|
||||
from text_input import TextInput
|
||||
|
||||
class Startscreen:
|
||||
@@ -8,8 +13,8 @@ class Startscreen:
|
||||
self.font_title = pygame.font.SysFont("Arial", 36)
|
||||
self.font_label = pygame.font.SysFont("Arial", 20)
|
||||
|
||||
self.button_color = (0, 255, 0)
|
||||
self.button_hover_color = (200, 255, 0)
|
||||
self.button_color = COLOR_BUTTON
|
||||
self.button_hover_color = COLOR_BUTTON_HOVER
|
||||
|
||||
self.player_name = ""
|
||||
|
||||
@@ -30,7 +35,7 @@ class Startscreen:
|
||||
self.button_hover_color)
|
||||
|
||||
self.text_input_name = TextInput(400,
|
||||
70,
|
||||
40,
|
||||
20,
|
||||
240)
|
||||
|
||||
@@ -58,12 +63,12 @@ class Startscreen:
|
||||
return "game"
|
||||
|
||||
# set background color
|
||||
self.screen.fill((0, 0, 0))
|
||||
self.screen.fill(COLOR_STARTSCREEN_BACKGROUND)
|
||||
|
||||
# set title and intro/welcome message
|
||||
title = self.font_title.render("SILENT FH", True, (0, 255, 0))
|
||||
title = self.font_title.render("SILENT FH", True, COLOR_STARTSCREEN_FONT_TITLE)
|
||||
self.screen.blit(title, (10, 10))
|
||||
message = self.font_label.render("Welcome to FH - Study with purpose", True, (0, 255, 255))
|
||||
message = self.font_label.render("Welcome to FH - Study with purpose", True, COLOR_STARTSCREEN_FONT_LABEL)
|
||||
|
||||
# draw buttons and get click state
|
||||
button_start_pressed = self.button_start.draw(self.screen)
|
||||
|
||||
Reference in New Issue
Block a user