test texte für TextLabel

main
Jonas Wächter 2023-03-25 18:13:59 +01:00
parent c5ce98b255
commit 3489ae90ad
1 changed files with 10 additions and 5 deletions

View File

@ -12,7 +12,7 @@ from sprite.Sprite import Sprite
from sprite.StaticSprite import StaticSprite from sprite.StaticSprite import StaticSprite
from ui_elements.TextLabel import TextLabel from ui_elements.TextLabel import TextLabel
what_to_run = 'physics' what_to_run = 'textlabel'
def apply_frame_rate(number: float): def apply_frame_rate(number: float):
@ -84,11 +84,13 @@ elif what_to_run == 'textlabel':
screen_transform = PositionScale((0, 0), (4, 4)) screen_transform = PositionScale((0, 0), (4, 4))
pygame.init() pygame.init()
screen = pygame.display.set_mode((300, 300)) screen = pygame.display.set_mode((800, 800))
pygame.display.set_caption("PM GAME") pygame.display.set_caption("PM GAME")
clock = pygame.time.Clock() clock = pygame.time.Clock()
test = TextLabel("Das ist ein Text", 100, 100, 50, Font('data/font/MilkyNice.otf', 50)) test1 = TextLabel("Das ist ein Test", 400, 0, 50, alignment="left")
test2 = TextLabel("Das ist ein Test", 400, 10, 50, alignment="center")
test3 = TextLabel("Das ist ein Test", 400, 20, 50, alignment="right")
while True: while True:
clock.tick(5) clock.tick(5)
@ -97,9 +99,12 @@ elif what_to_run == 'textlabel':
if event.type == pygame.QUIT: if event.type == pygame.QUIT:
pygame.quit() pygame.quit()
screen.fill((0, 0, 0)) screen.fill((0, 0, 110))
test1.draw(screen, screen_transform)
test2.draw(screen, screen_transform)
test3.draw(screen, screen_transform)
test.draw(screen, screen_transform)
pygame.display.update() pygame.display.update()