added labels to ui
This commit is contained in:
50
Game_Client/Classes/System/Components/Window.py
Normal file
50
Game_Client/Classes/System/Components/Window.py
Normal file
@ -0,0 +1,50 @@
|
||||
import pygame
|
||||
from pygame.locals import *
|
||||
|
||||
from Classes.Objects.BoardField import BoardField
|
||||
from Classes.Objects.World import World
|
||||
|
||||
class Window:
|
||||
__width:int = 800
|
||||
__height:int = 600 # takes 80% of width which tranlates to 640
|
||||
__title:str = "python game engine"
|
||||
__screen:pygame.Surface
|
||||
__clock:pygame.time.Clock
|
||||
|
||||
def __init__(self, width:int=800, height:int=600, title:str="python game engine"):
|
||||
self.__width = width
|
||||
self.__height = height
|
||||
self.__title = title
|
||||
|
||||
self.__screen = pygame.display.set_mode((self.__width, self.__height), pygame.FULLSCREEN)
|
||||
pygame.display.init()
|
||||
|
||||
pygame.display.set_caption = self.__title
|
||||
|
||||
# set framerate (where the fuck is it?)
|
||||
def Render(self):
|
||||
# dear future me figure out what past me did!
|
||||
pass
|
||||
|
||||
def setWidth(self, width:int):
|
||||
self.__width = width
|
||||
|
||||
def setHeight(self, height:int):
|
||||
self.__height = height
|
||||
|
||||
def setTitle(self, title:str):
|
||||
self.__title = title
|
||||
|
||||
def getScreen(self) -> pygame.surface:
|
||||
return self.__screen
|
||||
|
||||
# draws a passed sprite group to the screen
|
||||
def drawSpriteGroup(self, group:pygame.sprite.Group):
|
||||
group.draw(self.__screen)
|
||||
|
||||
# draws a given group of rectangles onto the screen
|
||||
def drawWorld(self, world:World):
|
||||
for field in world.getBoardFields():
|
||||
pygame.draw.rect(self.__screen, field.getColor(), field.getRect())
|
||||
for label in world.getLabels():
|
||||
label.draw()
|
Reference in New Issue
Block a user