Added the textures to the main menu.

This commit is contained in:
The Wobbler 2024-02-27 20:35:45 +01:00
parent ec6bbf817b
commit 891e1a3301
4 changed files with 16 additions and 0 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 614 B

After

Width:  |  Height:  |  Size: 614 B

Binary file not shown.

View file

@ -40,6 +40,11 @@ class GDPygame:
self.mouse = pygame.mouse
self.pusab = pygame.font.Font("PUSAB.otf")
self.floor_texture = pygame.image.load("assets/textures/floors/floor_01.png") # textures
self.floor_texture = pygame.transform.scale(self.floor_texture, (self.floor_texture.get_width() * 4, self.floor_texture.get_height() * 4))
self.background_texture = pygame.image.load("assets/textures/backgrounds/background_01.png")
self.background_texture = pygame.transform.scale(self.background_texture, (self.background_texture.get_width() * ((self.screen.get_height() - self.floor_texture.get_height()) // self.background_texture.get_height()), self.screen.get_height() - self.floor_texture.get_height()))
# loading finished
self.window.size = self.settings.window_size

11
ui.py
View file

@ -31,3 +31,14 @@ class Page:
class MainMenu(Page):
def draw(self):
self.app.screen.fill(self.app.blue)
w, h = self.app.screen.get_size()
x = 0
while x < w:
self.app.screen.blit(self.app.background_texture, (x, 0))
x += self.app.background_texture.get_width()
x = 0
while x < w:
self.app.screen.blit(self.app.floor_texture, (x, h - self.app.floor_texture.get_height()))
x += self.app.floor_texture.get_width()