Info_edupage/TuGUI/Objects/nr_objects/Ellipse.py

23 lines
550 B
Python
Raw Permalink Normal View History

2021-09-01 18:23:35 +02:00
import pygame
class Ellipse:
2021-09-06 18:32:02 +02:00
object_type = "nr"
2021-09-01 18:23:35 +02:00
def __init__(self, center, a, b, color, scene):
self.center = center
self.a = a
self.b = b
self.color = color
self.scene = scene
def blit(self):
a_ = self.a * self.scene.pd_
b_ = self.b * self.scene.pd_
center_ = self.scene.matrix @ self.center
center_ = [center_[0] - a_, center_[1] - b_]
pygame.draw.ellipse(self.scene.s, self.color,
pygame.Rect(center_, [a_ * 2, b_ * 2]))