-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathObjects.py
More file actions
84 lines (62 loc) · 2.12 KB
/
Copy pathObjects.py
File metadata and controls
84 lines (62 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import pygame
import settings
class Scene:
def __init__(self, *args):
self.objects = list(args)
def add(self, *objects):
self.objects += list(objects)
def remove(self, index):
if index < len(self.objects):
del self.objects[index]
else:
raise IndexError
def __iter__(self):
return iter(self.objects)
def __str__(self):
return str(self.objects)
class Sphere:
def __init__(self, center, radius, color, specular, reflective):
self.center = center
self.radius = radius
self.color = color
self.specular = specular
self.reflective = reflective
def __str__(self):
return f"{self.center}, {self.radius}, {self.color}"
class Light:
def __init__(self, typeof, intensity, pos=None, dirV=None):
self.type = typeof
self.intensity = intensity
self.pos = pos
self.dir = dirV
def __str__(self):
return f"{self.type}, {self.intensity}, {self.pos}, {self.dir}"
class Camera:
def __init__(self, center=(0, 0, 0), rotation=(0, 0, 0)):
Camera.center = center
Camera.rotation = rotation
Camera.matrix = None
def __str__(self):
return f"{Camera.center}, {Camera.rotation}, {Camera.matrix}"
class LoadingSprite(pygame.sprite.Sprite):
def __init__(self, group):
super().__init__(group)
self.index = 0
self.image = settings.LOADING[self.index]
self.rect = self.image.get_rect()
def update(self):
self.index = (self.index + 1) % 6
self.image = settings.LOADING[self.index]
class Text(pygame.sprite.Sprite):
def __init__(self, group, text, pos, size, color):
super().__init__(group)
self.index = 0
font = pygame.font.Font(None, size)
text = font.render(text, False, color)
self.image = text
self.rect = self.image.get_rect().move(*pos)
class Logo(pygame.sprite.Sprite):
def __init__(self, group, pos):
super().__init__(group)
self.image = settings.LOADING[6]
self.rect = self.image.get_rect().move(*pos)