removed server added client code
This commit is contained in:
54
Classes/System/Components/Window.py
Normal file
54
Classes/System/Components/Window.py
Normal file
@ -0,0 +1,54 @@
|
||||
import pygame
|
||||
from pygame.locals import *
|
||||
|
||||
from Classes.Game.BoardField import BoardField
|
||||
from Classes.Game.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
|
||||
|
||||
pygame.init()
|
||||
|
||||
self.__screen = pygame.display.set_mode((self.__width, self.__height))
|
||||
self.__screen.fill((236, 240, 241)) # Hier liegt der Fehler, es muss eine Tuple übergeben werden
|
||||
pygame.display.set_caption(self.__title)
|
||||
|
||||
self.__clock = pygame.time.Clock()
|
||||
self.__framerate = 60 # Framerate auf 60 FPS festlegen
|
||||
|
||||
# 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