Info_edupage/UI/Objects/Scene.py

37 lines
916 B
Python
Raw Normal View History

2021-09-01 11:26:29 +02:00
import pygame.transform
from Objects.Screen import Screen
from numpy import array as a
class Scene(Screen):
2021-09-01 22:22:18 +02:00
def __init__(self, width: float, height: float, scene_size: a, bg=(60, 60, 60)):
super().__init__(width, height, scene_size)
2021-09-01 11:26:29 +02:00
self.bg = bg
self.r_objects = [] # resizable Objects
2021-09-02 19:56:28 +02:00
self.nr_objects = [] # non-rescalable Objects
self.position = a([0, 0])
self.multiscene = None
2021-09-01 11:26:29 +02:00
def redraw(self):
self.s_.fill(self.bg)
for object_ in self.r_objects:
object_.blit()
rs = pygame.transform.scale(self.s_, self.screen_size)
self.s.blit(rs, [0, 0])
2021-09-01 17:32:53 +02:00
for object_ in self.nr_objects:
object_.blit()
2021-09-01 11:26:29 +02:00
pygame.display.update()
2021-09-02 19:56:28 +02:00
def blit(self):
self.redraw()
self.multiscene.s.blit(self.s, self.multiscene.matrix @ self.position)
def progress(self):
pass