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.
Files changed (73) hide show
  1. batFramework/__init__.py +2 -0
  2. batFramework/action.py +280 -279
  3. batFramework/actionContainer.py +105 -82
  4. batFramework/animatedSprite.py +80 -58
  5. batFramework/animation.py +91 -77
  6. batFramework/audioManager.py +156 -131
  7. batFramework/baseScene.py +249 -240
  8. batFramework/camera.py +245 -317
  9. batFramework/constants.py +57 -51
  10. batFramework/cutscene.py +239 -253
  11. batFramework/cutsceneManager.py +34 -34
  12. batFramework/drawable.py +107 -77
  13. batFramework/dynamicEntity.py +30 -30
  14. batFramework/easingController.py +58 -58
  15. batFramework/entity.py +130 -130
  16. batFramework/enums.py +171 -135
  17. batFramework/fontManager.py +65 -65
  18. batFramework/gui/__init__.py +28 -25
  19. batFramework/gui/animatedLabel.py +90 -89
  20. batFramework/gui/button.py +17 -17
  21. batFramework/gui/clickableWidget.py +244 -244
  22. batFramework/gui/collapseContainer.py +98 -0
  23. batFramework/gui/constraints/__init__.py +1 -1
  24. batFramework/gui/constraints/constraints.py +1066 -980
  25. batFramework/gui/container.py +220 -206
  26. batFramework/gui/debugger.py +140 -130
  27. batFramework/gui/draggableWidget.py +63 -44
  28. batFramework/gui/image.py +61 -58
  29. batFramework/gui/indicator.py +116 -113
  30. batFramework/gui/interactiveWidget.py +243 -239
  31. batFramework/gui/label.py +147 -344
  32. batFramework/gui/layout.py +442 -429
  33. batFramework/gui/meter.py +155 -96
  34. batFramework/gui/radioButton.py +43 -35
  35. batFramework/gui/root.py +228 -228
  36. batFramework/gui/scrollingContainer.py +282 -0
  37. batFramework/gui/selector.py +232 -250
  38. batFramework/gui/shape.py +286 -276
  39. batFramework/gui/slider.py +353 -397
  40. batFramework/gui/style.py +10 -10
  41. batFramework/gui/styleManager.py +49 -54
  42. batFramework/gui/syncedVar.py +43 -49
  43. batFramework/gui/textInput.py +331 -306
  44. batFramework/gui/textWidget.py +308 -0
  45. batFramework/gui/toggle.py +140 -128
  46. batFramework/gui/tooltip.py +35 -30
  47. batFramework/gui/widget.py +546 -521
  48. batFramework/manager.py +131 -134
  49. batFramework/particle.py +118 -118
  50. batFramework/propertyEaser.py +79 -79
  51. batFramework/renderGroup.py +34 -34
  52. batFramework/resourceManager.py +130 -130
  53. batFramework/scene.py +31 -31
  54. batFramework/sceneLayer.py +134 -138
  55. batFramework/sceneManager.py +200 -197
  56. batFramework/scrollingSprite.py +115 -115
  57. batFramework/sprite.py +46 -51
  58. batFramework/stateMachine.py +49 -54
  59. batFramework/templates/__init__.py +2 -1
  60. batFramework/templates/character.py +15 -0
  61. batFramework/templates/controller.py +158 -97
  62. batFramework/templates/stateMachine.py +39 -0
  63. batFramework/tileset.py +46 -46
  64. batFramework/timeManager.py +213 -213
  65. batFramework/transition.py +162 -162
  66. batFramework/triggerZone.py +22 -22
  67. batFramework/utils.py +306 -306
  68. {batframework-1.0.9a11.dist-info → batframework-1.0.9a12.dist-info}/LICENSE +20 -20
  69. {batframework-1.0.9a11.dist-info → batframework-1.0.9a12.dist-info}/METADATA +24 -17
  70. batframework-1.0.9a12.dist-info/RECORD +72 -0
  71. batframework-1.0.9a11.dist-info/RECORD +0 -67
  72. {batframework-1.0.9a11.dist-info → batframework-1.0.9a12.dist-info}/WHEEL +0 -0
  73. {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: tuple[int, int, int] | str = (0, 0, 0, 255)
15
- self.texture_surface = None
16
- self.texture_subsize = (0, 0)
17
- self.relief = 0
18
- self.shadow_color: tuple[int, int, int] | str = (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: tuple[int, int, int] | str) -> 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: tuple[int, int, int] | str) -> Self:
87
- self.color = color
88
- self.dirty_surface = True
89
- return self
90
-
91
- def set_outline_color(self, color: tuple[int, int, int] | str) -> 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
- if self.draw_mode == bf.drawMode.TEXTURED:
111
- self._paint_textured()
112
- return
113
- if self.border_radius == [0]:
114
- self._paint_shape()
115
- if self.outline_width:
116
- self._paint_outline()
117
- else:
118
- self._paint_rounded_shape()
119
- if self.outline_width:
120
- self._paint_rounded_outline()
121
-
122
- def _paint_textured(self) -> None:
123
- self.surface.fill((0, 0, 0, 0))
124
- if self.texture_surface is None:
125
- return
126
- w, h = self.surface.get_size()
127
- sw, sh = self.texture_surface.get_size()
128
- sub = self.texture_subsize
129
-
130
- # center
131
- center_surface = self.texture_surface.subsurface((sub[0], sub[1], *sub))
132
- top_surface = self.texture_surface.subsurface((sub[0], 0, *sub))
133
- bottom_surface = self.texture_surface.subsurface((sub[0], sh - sub[1], *sub))
134
- left_surface = self.texture_surface.subsurface((0, sub[1], *sub))
135
- right_surface = self.texture_surface.subsurface((sw - sub[0], sub[1], *sub))
136
-
137
- lst = []
138
- for y in range(sub[1], h + 1 - sub[1] * 2, sub[1]):
139
- for x in range(sub[0], w + 1 - sub[0] * 2, sub[0]):
140
- lst.append((center_surface, (x, y)))
141
-
142
- w_remainder = w % sub[0]
143
- h_remainder = h % sub[1]
144
- fix_x = ((w // sub[0]) - 1) * sub[0]
145
- fix_y = ((h // sub[1]) - 1) * sub[1]
146
-
147
- if (w > sub[0]) and (w_remainder > 0):
148
- # Center : Fix gaps on the x axis
149
- h_portion = center_surface.subsurface(0, 0, w_remainder, sub[1])
150
- for y in range(sub[1], h - sub[1] * 2, sub[1]):
151
- lst.append((h_portion, (fix_x, y)))
152
-
153
- # Fix partial gaps on the top
154
-
155
- t_portion = top_surface.subsurface(0, 0, w_remainder, sub[1])
156
- lst.append((t_portion, (fix_x, 0)))
157
-
158
- # Fix partial gaps on the bottom
159
- b_portion = bottom_surface.subsurface(0, 0, w_remainder, sub[1])
160
- lst.append((b_portion, (fix_x, h - sub[1] - 1)))
161
-
162
- if (h > sub[1]) and (h_remainder > 0):
163
- # Center : Fix gaps on the y axis
164
- v_portion = center_surface.subsurface(0, 0, sub[0], h_remainder)
165
- for x in range(sub[0], w - sub[0] * 2, sub[0]):
166
- lst.append((v_portion, (x, fix_y)))
167
-
168
- # Fix partial gaps on the left
169
- l_portion = left_surface.subsurface(0, 0, sub[0], h_remainder)
170
- lst.append((l_portion, (0, fix_y)))
171
-
172
- # Fix partial gaps on the right
173
- r_portion = right_surface.subsurface(0, 0, sub[0], h_remainder)
174
- lst.append((r_portion, (w - sub[0] - 1, fix_y)))
175
-
176
- # fix corner gap
177
- if h > sub[1] or w > sub[0]:
178
- corner_portion = center_surface.subsurface(
179
- 0,
180
- 0,
181
- w_remainder if w_remainder else sub[0],
182
- h_remainder if h_remainder else sub[1],
183
- )
184
- if w_remainder == 0:
185
- fix_x -= sub[0]
186
- if h_remainder == 0:
187
- fix_y -= sub[1]
188
- lst.append((corner_portion, (fix_x - 1, fix_y - 1)))
189
-
190
- # borders
191
- lst.extend(
192
- [(top_surface, (x, 0)) for x in range(sub[0], w + 1 - sub[0] * 2, sub[0])]
193
- + [
194
- (bottom_surface, (x, h - sub[1] - 1))
195
- for x in range(sub[0], w + 1 - sub[0] * 2, sub[0])
196
- ]
197
- + [
198
- (left_surface, (0, y))
199
- for y in range(sub[1], h + 1 - sub[1] * 2, sub[1])
200
- ]
201
- + [
202
- (right_surface, (w - sub[0] - 1, y))
203
- for y in range(sub[1], h + 1 - sub[1] * 2, sub[1])
204
- ]
205
- + [
206
- (self.texture_surface.subsurface((0, 0, *sub)), (0, 0)),
207
- (
208
- self.texture_surface.subsurface((sw - sub[0], 0, *sub)),
209
- (w - sub[0] - 1, 0),
210
- ),
211
- (
212
- self.texture_surface.subsurface((0, sh - sub[1], *sub)),
213
- (0, h - sub[1] - 1),
214
- ),
215
- (
216
- self.texture_surface.subsurface((sw - sub[0], sh - sub[1], *sub)),
217
- (w - sub[0] - 1, h - sub[1] - 1),
218
- ),
219
- ]
220
- )
221
-
222
- self.surface.fblits(lst)
223
-
224
- def _get_elevated_rect(self) -> pygame.FRect:
225
- return pygame.FRect(0, 0, self.rect.w, self.rect.h - self.relief)
226
-
227
- def _get_base_rect(self) -> pygame.FRect:
228
- return pygame.FRect(0, self.rect.h - self.relief, self.rect.w, self.relief)
229
-
230
- def _paint_shape(self) -> None:
231
- self.surface.fill((0, 0, 0, 0))
232
- if self.relief!=0:
233
- self.surface.fill(self.shadow_color, self._get_base_rect())
234
- self.surface.fill(self.color, self._get_elevated_rect())
235
- else:
236
- self.surface.fill(self.color, self._get_elevated_rect())
237
-
238
- def _paint_rounded_shape(self) -> None:
239
- self.surface.fill((0, 0, 0, 0))
240
- e = self._get_elevated_rect()
241
- if self.relief != 0:
242
- b = e.copy()
243
- b.bottom = self.rect.h
244
- pygame.draw.rect(self.surface, self.shadow_color, b, 0, *self.border_radius)
245
- pygame.draw.rect(self.surface, self.color, e, 0, *self.border_radius)
246
- else:
247
- pygame.draw.rect(self.surface, self.color, e, 0, *self.border_radius)
248
-
249
- def _paint_outline(self) -> None:
250
- pygame.draw.rect(
251
- self.surface,
252
- self.outline_color,
253
- self._get_elevated_rect(),
254
- self.outline_width,
255
- )
256
-
257
- def _paint_rounded_outline(self) -> None:
258
- e = self._get_elevated_rect()
259
- b = e.copy()
260
- b.h += e.bottom - b.bottom
261
-
262
- pygame.draw.rect(
263
- self.surface,
264
- self.outline_color,
265
- e,
266
- self.outline_width,
267
- *self.border_radius,
268
- )
269
- if self.relief:
270
- pygame.draw.rect(
271
- self.surface,
272
- self.outline_color,
273
- b,
274
- self.outline_width,
275
- *self.border_radius,
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
+ )