batframework 1.0.9a11__py3-none-any.whl → 1.0.9a12__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- batFramework/__init__.py +2 -0
- batFramework/action.py +280 -279
- batFramework/actionContainer.py +105 -82
- batFramework/animatedSprite.py +80 -58
- batFramework/animation.py +91 -77
- batFramework/audioManager.py +156 -131
- batFramework/baseScene.py +249 -240
- batFramework/camera.py +245 -317
- batFramework/constants.py +57 -51
- batFramework/cutscene.py +239 -253
- batFramework/cutsceneManager.py +34 -34
- batFramework/drawable.py +107 -77
- batFramework/dynamicEntity.py +30 -30
- batFramework/easingController.py +58 -58
- batFramework/entity.py +130 -130
- batFramework/enums.py +171 -135
- batFramework/fontManager.py +65 -65
- batFramework/gui/__init__.py +28 -25
- batFramework/gui/animatedLabel.py +90 -89
- batFramework/gui/button.py +17 -17
- batFramework/gui/clickableWidget.py +244 -244
- batFramework/gui/collapseContainer.py +98 -0
- batFramework/gui/constraints/__init__.py +1 -1
- batFramework/gui/constraints/constraints.py +1066 -980
- batFramework/gui/container.py +220 -206
- batFramework/gui/debugger.py +140 -130
- batFramework/gui/draggableWidget.py +63 -44
- batFramework/gui/image.py +61 -58
- batFramework/gui/indicator.py +116 -113
- batFramework/gui/interactiveWidget.py +243 -239
- batFramework/gui/label.py +147 -344
- batFramework/gui/layout.py +442 -429
- batFramework/gui/meter.py +155 -96
- batFramework/gui/radioButton.py +43 -35
- batFramework/gui/root.py +228 -228
- batFramework/gui/scrollingContainer.py +282 -0
- batFramework/gui/selector.py +232 -250
- batFramework/gui/shape.py +286 -276
- batFramework/gui/slider.py +353 -397
- batFramework/gui/style.py +10 -10
- batFramework/gui/styleManager.py +49 -54
- batFramework/gui/syncedVar.py +43 -49
- batFramework/gui/textInput.py +331 -306
- batFramework/gui/textWidget.py +308 -0
- batFramework/gui/toggle.py +140 -128
- batFramework/gui/tooltip.py +35 -30
- batFramework/gui/widget.py +546 -521
- batFramework/manager.py +131 -134
- batFramework/particle.py +118 -118
- batFramework/propertyEaser.py +79 -79
- batFramework/renderGroup.py +34 -34
- batFramework/resourceManager.py +130 -130
- batFramework/scene.py +31 -31
- batFramework/sceneLayer.py +134 -138
- batFramework/sceneManager.py +200 -197
- batFramework/scrollingSprite.py +115 -115
- batFramework/sprite.py +46 -51
- batFramework/stateMachine.py +49 -54
- batFramework/templates/__init__.py +2 -1
- batFramework/templates/character.py +15 -0
- batFramework/templates/controller.py +158 -97
- batFramework/templates/stateMachine.py +39 -0
- batFramework/tileset.py +46 -46
- batFramework/timeManager.py +213 -213
- batFramework/transition.py +162 -162
- batFramework/triggerZone.py +22 -22
- batFramework/utils.py +306 -306
- {batframework-1.0.9a11.dist-info → batframework-1.0.9a12.dist-info}/LICENSE +20 -20
- {batframework-1.0.9a11.dist-info → batframework-1.0.9a12.dist-info}/METADATA +24 -17
- batframework-1.0.9a12.dist-info/RECORD +72 -0
- batframework-1.0.9a11.dist-info/RECORD +0 -67
- {batframework-1.0.9a11.dist-info → batframework-1.0.9a12.dist-info}/WHEEL +0 -0
- {batframework-1.0.9a11.dist-info → batframework-1.0.9a12.dist-info}/top_level.txt +0 -0
batFramework/gui/shape.py
CHANGED
@@ -1,276 +1,286 @@
|
|
1
|
-
import batFramework as bf
|
2
|
-
from .widget import Widget
|
3
|
-
import pygame
|
4
|
-
from typing import Self, Iterable
|
5
|
-
from math import ceil
|
6
|
-
|
7
|
-
|
8
|
-
class Shape(Widget):
|
9
|
-
def __init__(self, size: tuple[float, float] = None, *args, **kwargs):
|
10
|
-
super().__init__(size=size, convert_alpha=True)
|
11
|
-
self.color = (0, 0, 0, 0)
|
12
|
-
self.border_radius: list[int] = [0]
|
13
|
-
self.outline_width: int = 0
|
14
|
-
self.outline_color:
|
15
|
-
self.texture_surface = None
|
16
|
-
self.texture_subsize = (0, 0)
|
17
|
-
self.relief = 0
|
18
|
-
self.shadow_color:
|
19
|
-
self.draw_mode = bf.drawMode.SOLID
|
20
|
-
|
21
|
-
def get_inner_bottom(self) -> float:
|
22
|
-
return self.rect.bottom - self.padding[3] - self.relief
|
23
|
-
|
24
|
-
def get_inner_height(self) -> float:
|
25
|
-
return self.rect.h - self.padding[1] - self.padding[3] - self.relief
|
26
|
-
|
27
|
-
def get_inner_top(self) -> float:
|
28
|
-
return self.rect.y + self.padding[1]
|
29
|
-
|
30
|
-
def get_local_inner_rect(self)->pygame.FRect:
|
31
|
-
return pygame.FRect(
|
32
|
-
self.padding[0],
|
33
|
-
self.padding[1],
|
34
|
-
self.rect.w - self.padding[2] - self.padding[0],
|
35
|
-
self.rect.h - self.padding[1] - self.padding[3] - self.relief,
|
36
|
-
)
|
37
|
-
|
38
|
-
def get_inner_rect(self) -> pygame.FRect:
|
39
|
-
return pygame.FRect(
|
40
|
-
self.rect.x + self.padding[0],
|
41
|
-
self.rect.y + self.padding[1],
|
42
|
-
self.rect.w - self.padding[2] - self.padding[0],
|
43
|
-
self.rect.h - self.padding[1] - self.padding[3] - self.relief,
|
44
|
-
)
|
45
|
-
|
46
|
-
def set_shadow_color(self, color:
|
47
|
-
self.shadow_color = color
|
48
|
-
self.dirty_surface = True
|
49
|
-
return self
|
50
|
-
|
51
|
-
def set_relief(self, relief: int) -> Self:
|
52
|
-
if relief < 0:
|
53
|
-
return self
|
54
|
-
self.dirty_shape = self.relief != relief
|
55
|
-
self.relief = relief
|
56
|
-
return self
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
def set_texture(
|
61
|
-
self, surface: pygame.SurfaceType, subsize: tuple[int, int] | None = None
|
62
|
-
) -> Self:
|
63
|
-
self.texture_surface = surface
|
64
|
-
if subsize is None:
|
65
|
-
subsize = (ceil(surface.get_width() / 3), ceil(surface.get_height() / 3))
|
66
|
-
self.texture_subsize = subsize
|
67
|
-
self.dirty_surface = True
|
68
|
-
return self
|
69
|
-
|
70
|
-
def set_draw_mode(self, mode: bf.drawMode) -> Self:
|
71
|
-
self.draw_mode = mode
|
72
|
-
self.dirty_surface = True
|
73
|
-
return self
|
74
|
-
|
75
|
-
def get_draw_mode(self) -> bf.drawMode:
|
76
|
-
return self.draw_mode
|
77
|
-
|
78
|
-
def has_alpha_color(self) -> bool:
|
79
|
-
return (pygame.Color(self.color).a != 255) or (
|
80
|
-
pygame.Color(self.outline_color).a != 255
|
81
|
-
)
|
82
|
-
|
83
|
-
def __str__(self) -> str:
|
84
|
-
return "Shape"
|
85
|
-
|
86
|
-
def set_color(self, color:
|
87
|
-
self.color = color
|
88
|
-
self.dirty_surface = True
|
89
|
-
return self
|
90
|
-
|
91
|
-
def set_outline_color(self, color:
|
92
|
-
self.outline_color = color
|
93
|
-
self.dirty_surface = True
|
94
|
-
return self
|
95
|
-
|
96
|
-
def set_border_radius(self, value: int | list[int]) -> Self:
|
97
|
-
if isinstance(value, int):
|
98
|
-
self.border_radius = [value]
|
99
|
-
else:
|
100
|
-
self.border_radius = value
|
101
|
-
self.dirty_surface = True
|
102
|
-
return self
|
103
|
-
|
104
|
-
def set_outline_width(self, value: int) -> Self:
|
105
|
-
self.outline_width = value
|
106
|
-
self.dirty_surface = True
|
107
|
-
return self
|
108
|
-
|
109
|
-
def paint(self) -> None:
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
0,
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
+ [
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
(
|
208
|
-
|
209
|
-
(
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
(0,
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
(
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
self.
|
235
|
-
|
236
|
-
self.
|
237
|
-
|
238
|
-
|
239
|
-
self.
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
)
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
1
|
+
import batFramework as bf
|
2
|
+
from .widget import Widget
|
3
|
+
import pygame
|
4
|
+
from typing import Self, Iterable
|
5
|
+
from math import ceil
|
6
|
+
|
7
|
+
|
8
|
+
class Shape(Widget):
|
9
|
+
def __init__(self, size: tuple[float, float]|None = None, *args, **kwargs):
|
10
|
+
super().__init__(size=size, convert_alpha=True)
|
11
|
+
self.color = (0, 0, 0, 0)
|
12
|
+
self.border_radius: list[int] = [0]
|
13
|
+
self.outline_width: int = 0
|
14
|
+
self.outline_color: pygame.typing.ColorLike = (0, 0, 0, 255)
|
15
|
+
self.texture_surface = None
|
16
|
+
self.texture_subsize = (0, 0)
|
17
|
+
self.relief = 0
|
18
|
+
self.shadow_color: pygame.typing.ColorLike = (0, 0, 0, 255)
|
19
|
+
self.draw_mode = bf.drawMode.SOLID
|
20
|
+
|
21
|
+
def get_inner_bottom(self) -> float:
|
22
|
+
return self.rect.bottom - self.padding[3] - self.relief
|
23
|
+
|
24
|
+
def get_inner_height(self) -> float:
|
25
|
+
return self.rect.h - self.padding[1] - self.padding[3] - self.relief
|
26
|
+
|
27
|
+
def get_inner_top(self) -> float:
|
28
|
+
return self.rect.y + self.padding[1]
|
29
|
+
|
30
|
+
def get_local_inner_rect(self)->pygame.FRect:
|
31
|
+
return pygame.FRect(
|
32
|
+
self.padding[0],
|
33
|
+
self.padding[1],
|
34
|
+
self.rect.w - self.padding[2] - self.padding[0],
|
35
|
+
self.rect.h - self.padding[1] - self.padding[3] - self.relief,
|
36
|
+
)
|
37
|
+
|
38
|
+
def get_inner_rect(self) -> pygame.FRect:
|
39
|
+
return pygame.FRect(
|
40
|
+
self.rect.x + self.padding[0],
|
41
|
+
self.rect.y + self.padding[1],
|
42
|
+
self.rect.w - self.padding[2] - self.padding[0],
|
43
|
+
self.rect.h - self.padding[1] - self.padding[3] - self.relief,
|
44
|
+
)
|
45
|
+
|
46
|
+
def set_shadow_color(self, color: pygame.typing.ColorLike) -> Self:
|
47
|
+
self.shadow_color = color
|
48
|
+
self.dirty_surface = True
|
49
|
+
return self
|
50
|
+
|
51
|
+
def set_relief(self, relief: int) -> Self:
|
52
|
+
if relief < 0:
|
53
|
+
return self
|
54
|
+
self.dirty_shape = self.relief != relief
|
55
|
+
self.relief = relief
|
56
|
+
return self
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
def set_texture(
|
61
|
+
self, surface: pygame.SurfaceType, subsize: tuple[int, int] | None = None
|
62
|
+
) -> Self:
|
63
|
+
self.texture_surface = surface
|
64
|
+
if subsize is None:
|
65
|
+
subsize = (ceil(surface.get_width() / 3), ceil(surface.get_height() / 3))
|
66
|
+
self.texture_subsize = subsize
|
67
|
+
self.dirty_surface = True
|
68
|
+
return self
|
69
|
+
|
70
|
+
def set_draw_mode(self, mode: bf.drawMode) -> Self:
|
71
|
+
self.draw_mode = mode
|
72
|
+
self.dirty_surface = True
|
73
|
+
return self
|
74
|
+
|
75
|
+
def get_draw_mode(self) -> bf.drawMode:
|
76
|
+
return self.draw_mode
|
77
|
+
|
78
|
+
def has_alpha_color(self) -> bool:
|
79
|
+
return (pygame.Color(self.color).a != 255) or (
|
80
|
+
pygame.Color(self.outline_color).a != 255
|
81
|
+
)
|
82
|
+
|
83
|
+
def __str__(self) -> str:
|
84
|
+
return "Shape"
|
85
|
+
|
86
|
+
def set_color(self, color: pygame.typing.ColorLike) -> Self:
|
87
|
+
self.color = color
|
88
|
+
self.dirty_surface = True
|
89
|
+
return self
|
90
|
+
|
91
|
+
def set_outline_color(self, color: pygame.typing.ColorLike) -> Self:
|
92
|
+
self.outline_color = color
|
93
|
+
self.dirty_surface = True
|
94
|
+
return self
|
95
|
+
|
96
|
+
def set_border_radius(self, value: int | list[int]) -> Self:
|
97
|
+
if isinstance(value, int):
|
98
|
+
self.border_radius = [value]
|
99
|
+
else:
|
100
|
+
self.border_radius = value
|
101
|
+
self.dirty_surface = True
|
102
|
+
return self
|
103
|
+
|
104
|
+
def set_outline_width(self, value: int) -> Self:
|
105
|
+
self.outline_width = value
|
106
|
+
self.dirty_surface = True
|
107
|
+
return self
|
108
|
+
|
109
|
+
def paint(self) -> None:
|
110
|
+
self._resize_surface()
|
111
|
+
if self.draw_mode == bf.drawMode.TEXTURED:
|
112
|
+
self._paint_textured()
|
113
|
+
return
|
114
|
+
if self.border_radius == [0]:
|
115
|
+
self._paint_shape()
|
116
|
+
if self.outline_width:
|
117
|
+
self._paint_outline()
|
118
|
+
else:
|
119
|
+
self._paint_rounded_shape()
|
120
|
+
if self.outline_width:
|
121
|
+
self._paint_rounded_outline()
|
122
|
+
|
123
|
+
def _paint_textured(self) -> None:
|
124
|
+
self.surface.fill((0, 0, 0, 0))
|
125
|
+
if self.texture_surface is None:
|
126
|
+
return
|
127
|
+
w, h = self.surface.get_size()
|
128
|
+
sw, sh = self.texture_surface.get_size()
|
129
|
+
sub = self.texture_subsize
|
130
|
+
|
131
|
+
# center
|
132
|
+
center_surface = self.texture_surface.subsurface((sub[0], sub[1], *sub))
|
133
|
+
top_surface = self.texture_surface.subsurface((sub[0], 0, *sub))
|
134
|
+
bottom_surface = self.texture_surface.subsurface((sub[0], sh - sub[1], *sub))
|
135
|
+
left_surface = self.texture_surface.subsurface((0, sub[1], *sub))
|
136
|
+
right_surface = self.texture_surface.subsurface((sw - sub[0], sub[1], *sub))
|
137
|
+
|
138
|
+
lst = []
|
139
|
+
for y in range(sub[1], h + 1 - sub[1] * 2, sub[1]):
|
140
|
+
for x in range(sub[0], w + 1 - sub[0] * 2, sub[0]):
|
141
|
+
lst.append((center_surface, (x, y)))
|
142
|
+
|
143
|
+
w_remainder = w % sub[0]
|
144
|
+
h_remainder = h % sub[1]
|
145
|
+
fix_x = ((w // sub[0]) - 1) * sub[0]
|
146
|
+
fix_y = ((h // sub[1]) - 1) * sub[1]
|
147
|
+
|
148
|
+
if (w > sub[0]) and (w_remainder > 0):
|
149
|
+
# Center : Fix gaps on the x axis
|
150
|
+
h_portion = center_surface.subsurface(0, 0, w_remainder, sub[1])
|
151
|
+
for y in range(sub[1], h - sub[1] * 2, sub[1]):
|
152
|
+
lst.append((h_portion, (fix_x, y)))
|
153
|
+
|
154
|
+
# Fix partial gaps on the top
|
155
|
+
|
156
|
+
t_portion = top_surface.subsurface(0, 0, w_remainder, sub[1])
|
157
|
+
lst.append((t_portion, (fix_x, 0)))
|
158
|
+
|
159
|
+
# Fix partial gaps on the bottom
|
160
|
+
b_portion = bottom_surface.subsurface(0, 0, w_remainder, sub[1])
|
161
|
+
lst.append((b_portion, (fix_x, h - sub[1] - 1)))
|
162
|
+
|
163
|
+
if (h > sub[1]) and (h_remainder > 0):
|
164
|
+
# Center : Fix gaps on the y axis
|
165
|
+
v_portion = center_surface.subsurface(0, 0, sub[0], h_remainder)
|
166
|
+
for x in range(sub[0], w - sub[0] * 2, sub[0]):
|
167
|
+
lst.append((v_portion, (x, fix_y)))
|
168
|
+
|
169
|
+
# Fix partial gaps on the left
|
170
|
+
l_portion = left_surface.subsurface(0, 0, sub[0], h_remainder)
|
171
|
+
lst.append((l_portion, (0, fix_y)))
|
172
|
+
|
173
|
+
# Fix partial gaps on the right
|
174
|
+
r_portion = right_surface.subsurface(0, 0, sub[0], h_remainder)
|
175
|
+
lst.append((r_portion, (w - sub[0] - 1, fix_y)))
|
176
|
+
|
177
|
+
# fix corner gap
|
178
|
+
if h > sub[1] or w > sub[0]:
|
179
|
+
corner_portion = center_surface.subsurface(
|
180
|
+
0,
|
181
|
+
0,
|
182
|
+
w_remainder if w_remainder else sub[0],
|
183
|
+
h_remainder if h_remainder else sub[1],
|
184
|
+
)
|
185
|
+
if w_remainder == 0:
|
186
|
+
fix_x -= sub[0]
|
187
|
+
if h_remainder == 0:
|
188
|
+
fix_y -= sub[1]
|
189
|
+
lst.append((corner_portion, (fix_x - 1, fix_y - 1)))
|
190
|
+
|
191
|
+
# borders
|
192
|
+
lst.extend(
|
193
|
+
[(top_surface, (x, 0)) for x in range(sub[0], w + 1 - sub[0] * 2, sub[0])]
|
194
|
+
+ [
|
195
|
+
(bottom_surface, (x, h - sub[1] - 1))
|
196
|
+
for x in range(sub[0], w + 1 - sub[0] * 2, sub[0])
|
197
|
+
]
|
198
|
+
+ [
|
199
|
+
(left_surface, (0, y))
|
200
|
+
for y in range(sub[1], h + 1 - sub[1] * 2, sub[1])
|
201
|
+
]
|
202
|
+
+ [
|
203
|
+
(right_surface, (w - sub[0] - 1, y))
|
204
|
+
for y in range(sub[1], h + 1 - sub[1] * 2, sub[1])
|
205
|
+
]
|
206
|
+
+ [
|
207
|
+
(self.texture_surface.subsurface((0, 0, *sub)), (0, 0)),
|
208
|
+
(
|
209
|
+
self.texture_surface.subsurface((sw - sub[0], 0, *sub)),
|
210
|
+
(w - sub[0] - 1, 0),
|
211
|
+
),
|
212
|
+
(
|
213
|
+
self.texture_surface.subsurface((0, sh - sub[1], *sub)),
|
214
|
+
(0, h - sub[1] - 1),
|
215
|
+
),
|
216
|
+
(
|
217
|
+
self.texture_surface.subsurface((sw - sub[0], sh - sub[1], *sub)),
|
218
|
+
(w - sub[0] - 1, h - sub[1] - 1),
|
219
|
+
),
|
220
|
+
]
|
221
|
+
)
|
222
|
+
|
223
|
+
self.surface.fblits(lst)
|
224
|
+
|
225
|
+
def _get_elevated_rect(self) -> pygame.FRect:
|
226
|
+
return pygame.FRect(0, 0, self.rect.w, self.rect.h - self.relief)
|
227
|
+
|
228
|
+
def _get_base_rect(self) -> pygame.FRect:
|
229
|
+
return pygame.FRect(0, self.rect.h - self.relief, self.rect.w, self.relief)
|
230
|
+
|
231
|
+
def _paint_shape(self) -> None:
|
232
|
+
self.surface.fill((0, 0, 0, 0))
|
233
|
+
if self.relief!=0:
|
234
|
+
if self.shadow_color is not None:
|
235
|
+
self.surface.fill(self.shadow_color, self._get_base_rect())
|
236
|
+
if self.color is not None:
|
237
|
+
self.surface.fill(self.color, self._get_elevated_rect())
|
238
|
+
|
239
|
+
elif self.color is not None:
|
240
|
+
self.surface.fill(self.color, self._get_elevated_rect())
|
241
|
+
|
242
|
+
def _paint_rounded_shape(self) -> None:
|
243
|
+
self.surface.fill((0, 0, 0, 0))
|
244
|
+
e = self._get_elevated_rect()
|
245
|
+
if self.relief != 0:
|
246
|
+
b = e.copy()
|
247
|
+
b.bottom = self.rect.h
|
248
|
+
if self.shadow_color is not None:
|
249
|
+
pygame.draw.rect(self.surface, self.shadow_color, b, 0, *self.border_radius)
|
250
|
+
if self.color is not None:
|
251
|
+
pygame.draw.rect(self.surface, self.color, e, 0, *self.border_radius)
|
252
|
+
elif self.color is not None:
|
253
|
+
pygame.draw.rect(self.surface, self.color, e, 0, *self.border_radius)
|
254
|
+
|
255
|
+
def _paint_outline(self) -> None:
|
256
|
+
if self.outline_color is None:
|
257
|
+
return
|
258
|
+
pygame.draw.rect(
|
259
|
+
self.surface,
|
260
|
+
self.outline_color,
|
261
|
+
self._get_elevated_rect(),
|
262
|
+
self.outline_width,
|
263
|
+
)
|
264
|
+
|
265
|
+
def _paint_rounded_outline(self) -> None:
|
266
|
+
if self.outline_color is None:
|
267
|
+
return
|
268
|
+
e = self._get_elevated_rect()
|
269
|
+
b = e.copy()
|
270
|
+
b.h += e.bottom - b.bottom
|
271
|
+
|
272
|
+
pygame.draw.rect(
|
273
|
+
self.surface,
|
274
|
+
self.outline_color,
|
275
|
+
e,
|
276
|
+
self.outline_width,
|
277
|
+
*self.border_radius,
|
278
|
+
)
|
279
|
+
if self.relief:
|
280
|
+
pygame.draw.rect(
|
281
|
+
self.surface,
|
282
|
+
self.outline_color,
|
283
|
+
b,
|
284
|
+
self.outline_width,
|
285
|
+
*self.border_radius,
|
286
|
+
)
|