REFACTOR styling

This commit is contained in:
2025-04-23 18:36:33 +02:00
parent 022e789d9c
commit 78c9dc1341
7 changed files with 40 additions and 13 deletions

View File

@@ -3,20 +3,23 @@ from widgets.button import Button
from widgets.switch import Switch
class SettingsMenuRenderer:
def __init__(self, screen, options, font):
def __init__(self, screen, options, styling):
self.screen = screen
self.options = options
self.font = font
self.styling = styling
self.font = self.styling["font"]
self.text_start_x = 100
self.widget_start_x = 500
# Text
self.show_yaw_text = self.font.render("Show Yaw: ", True, (255, 255, 255))
self.show_health_text = self.font.render("Show Health: ", True, (255, 255, 255))
self.show_names_text = self.font.render("Show Names: ", True, (255, 255, 255))
self.show_yaw_text = self.font.render("Show Yaw: ", True, self.styling["text_colour"])
self.show_health_text = self.font.render("Show Health: ", True, (self.styling["text_colour"]))
self.show_names_text = self.font.render("Show Names: ", True, self.styling["text_colour"])
# Buttons
self.back_button = Button(10, 10, 50, 50, None)
self.back_button.set_colour(self.styling["button_colour"])
self.back_button.set_pressed_colour(self.styling["pressed_button_colour"])
self.back_button.set_image("assets/arrow.png")
# Switches
@@ -26,7 +29,7 @@ class SettingsMenuRenderer:
def render(self):
"""Renders the settings menu."""
self.screen.fill((30, 30, 30)) # Clear screen
self.screen.fill(self.styling["background_colour"]) # Clear screen
self.screen.blit(self.show_yaw_text, (self.text_start_x, self.show_yaw_button.y))
self.show_yaw_button.draw(self.screen)