Ajout de position et origine a Text

This commit is contained in:
Tipragot 2023-11-02 18:19:25 +01:00
parent 349d5e01ca
commit 66c912bce0

View file

@ -3,6 +3,7 @@ Un plugin permettant d'afficher du texte à l'écran.
""" """
from turtle import position
import pygame import pygame
from engine import GlobalPlugin from engine import GlobalPlugin
@ -22,11 +23,13 @@ class Text:
text: str, text: str,
size: int = 50, size: int = 50,
color: pygame.Color = pygame.Color(255, 255, 255), color: pygame.Color = pygame.Color(255, 255, 255),
position: Vec2 = Vec2(0),
origin: Vec2 = Vec2(0), origin: Vec2 = Vec2(0),
): ):
self.text = text self.text = text
self.size = size self.size = size
self.color = color self.color = color
self.position = position
self.origin = origin self.origin = origin
@ -44,6 +47,8 @@ def __render_texts(world: World):
entity[Sprite].texture = texture entity[Sprite].texture = texture
else: else:
entity[Sprite] = Sprite(texture) entity[Sprite] = Sprite(texture)
entity[Sprite].position = text.position
entity[Sprite].origin = text.origin
PLUGIN = GlobalPlugin( PLUGIN = GlobalPlugin(