batframework 1.0.9a6__py3-none-any.whl → 1.0.9a8__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 +20 -11
- batFramework/action.py +1 -1
- batFramework/animatedSprite.py +47 -116
- batFramework/animation.py +30 -5
- batFramework/audioManager.py +16 -13
- batFramework/baseScene.py +240 -0
- batFramework/camera.py +4 -0
- batFramework/constants.py +6 -1
- batFramework/cutscene.py +221 -21
- batFramework/cutsceneManager.py +5 -2
- batFramework/drawable.py +7 -5
- batFramework/easingController.py +10 -11
- batFramework/entity.py +21 -2
- batFramework/enums.py +48 -33
- batFramework/gui/__init__.py +3 -1
- batFramework/gui/animatedLabel.py +10 -2
- batFramework/gui/button.py +4 -31
- batFramework/gui/clickableWidget.py +42 -30
- batFramework/gui/constraints/constraints.py +212 -136
- batFramework/gui/container.py +72 -48
- batFramework/gui/debugger.py +12 -17
- batFramework/gui/draggableWidget.py +8 -11
- batFramework/gui/image.py +3 -10
- batFramework/gui/indicator.py +73 -1
- batFramework/gui/interactiveWidget.py +117 -100
- batFramework/gui/label.py +73 -63
- batFramework/gui/layout.py +221 -452
- batFramework/gui/meter.py +21 -7
- batFramework/gui/radioButton.py +0 -1
- batFramework/gui/root.py +99 -29
- batFramework/gui/selector.py +257 -0
- batFramework/gui/shape.py +13 -5
- batFramework/gui/slider.py +260 -93
- batFramework/gui/textInput.py +45 -21
- batFramework/gui/toggle.py +70 -52
- batFramework/gui/tooltip.py +30 -0
- batFramework/gui/widget.py +203 -125
- batFramework/manager.py +7 -8
- batFramework/particle.py +4 -1
- batFramework/propertyEaser.py +79 -0
- batFramework/renderGroup.py +17 -50
- batFramework/resourceManager.py +43 -13
- batFramework/scene.py +15 -335
- batFramework/sceneLayer.py +138 -0
- batFramework/sceneManager.py +31 -36
- batFramework/scrollingSprite.py +8 -3
- batFramework/sprite.py +1 -1
- batFramework/templates/__init__.py +1 -2
- batFramework/templates/controller.py +97 -0
- batFramework/timeManager.py +76 -22
- batFramework/transition.py +37 -103
- batFramework/utils.py +121 -3
- {batframework-1.0.9a6.dist-info → batframework-1.0.9a8.dist-info}/METADATA +24 -3
- batframework-1.0.9a8.dist-info/RECORD +66 -0
- {batframework-1.0.9a6.dist-info → batframework-1.0.9a8.dist-info}/WHEEL +1 -1
- batFramework/character.py +0 -27
- batFramework/templates/character.py +0 -43
- batFramework/templates/states.py +0 -166
- batframework-1.0.9a6.dist-info/RECORD +0 -63
- /batframework-1.0.9a6.dist-info/LICENCE → /batframework-1.0.9a8.dist-info/LICENSE +0 -0
- {batframework-1.0.9a6.dist-info → batframework-1.0.9a8.dist-info}/top_level.txt +0 -0
@@ -1,10 +1,8 @@
|
|
1
|
-
from .label import Label
|
2
1
|
import batFramework as bf
|
3
2
|
from typing import Self, Callable, Any
|
4
3
|
from .interactiveWidget import InteractiveWidget
|
5
4
|
from .shape import Shape
|
6
5
|
import pygame
|
7
|
-
from math import ceil
|
8
6
|
|
9
7
|
|
10
8
|
class ClickableWidget(Shape, InteractiveWidget):
|
@@ -27,17 +25,11 @@ class ClickableWidget(Shape, InteractiveWidget):
|
|
27
25
|
self.set_debug_color("cyan")
|
28
26
|
self.set_relief(self.unpressed_relief)
|
29
27
|
|
28
|
+
|
30
29
|
def get_min_required_size(self) -> tuple[float, float]:
|
31
|
-
if not (self.autoresize_w or self.autoresize_h):
|
32
|
-
return self.rect.size
|
33
|
-
|
34
30
|
res = super().get_min_required_size()
|
35
31
|
res = res[0],res[1]+self.unpressed_relief
|
36
|
-
|
37
|
-
return res[0] if self.autoresize_w else self.rect.w, (
|
38
|
-
res[1] if self.autoresize_h else self.rect.h
|
39
|
-
)
|
40
|
-
|
32
|
+
return res
|
41
33
|
|
42
34
|
def set_unpressed_relief(self, relief: int) -> Self:
|
43
35
|
if relief == self.unpressed_relief:
|
@@ -143,28 +135,50 @@ class ClickableWidget(Shape, InteractiveWidget):
|
|
143
135
|
|
144
136
|
def click(self, force=False) -> None:
|
145
137
|
if not self.enabled and not force:
|
146
|
-
return
|
138
|
+
return False
|
147
139
|
if self.callback is not None:
|
148
140
|
self.callback()
|
141
|
+
return True
|
142
|
+
return False
|
143
|
+
|
144
|
+
def on_key_down(self, key):
|
145
|
+
if key == pygame.K_SPACE:
|
146
|
+
self.on_click_down(1)
|
147
|
+
return True
|
148
|
+
return self.do_on_key_down(key)
|
149
|
+
|
150
|
+
def on_key_up(self, key):
|
151
|
+
if key == pygame.K_SPACE:
|
152
|
+
self.on_click_up(1)
|
153
|
+
return True
|
154
|
+
return self.do_on_key_down(key)
|
155
|
+
|
149
156
|
|
150
|
-
def
|
157
|
+
def on_click_down(self, button) -> None:
|
158
|
+
if super().on_click_down(button):
|
159
|
+
return True
|
151
160
|
if self.enabled and button == 1:
|
152
161
|
if not self.get_focus():
|
153
|
-
return
|
162
|
+
return False
|
154
163
|
self.is_pressed = True
|
155
164
|
if self.click_down_sound:
|
156
165
|
bf.AudioManager().play_sound(self.click_down_sound)
|
157
166
|
pygame.mouse.set_cursor(self.click_cursor)
|
158
167
|
self.set_relief(self.pressed_relief)
|
168
|
+
return True
|
169
|
+
return False
|
159
170
|
|
160
|
-
def
|
171
|
+
def on_click_up(self, button) -> None:
|
172
|
+
if super().on_click_up(button):
|
173
|
+
return True
|
161
174
|
if self.enabled and button == 1 and self.is_pressed:
|
162
175
|
self.is_pressed = False
|
163
176
|
if self.click_up_sound:
|
164
177
|
bf.AudioManager().play_sound(self.click_up_sound)
|
165
178
|
self.set_relief(self.unpressed_relief)
|
166
|
-
self.click()
|
167
|
-
|
179
|
+
return self.click()
|
180
|
+
return False
|
181
|
+
|
168
182
|
def on_enter(self) -> None:
|
169
183
|
if not self.enabled:
|
170
184
|
return
|
@@ -185,15 +199,6 @@ class ClickableWidget(Shape, InteractiveWidget):
|
|
185
199
|
super().on_lose_focus()
|
186
200
|
self.on_exit()
|
187
201
|
|
188
|
-
def on_key_down(self, key):
|
189
|
-
if key == pygame.K_SPACE:
|
190
|
-
self.on_click_down(1)
|
191
|
-
super().on_key_down(key)
|
192
|
-
|
193
|
-
def on_key_up(self, key):
|
194
|
-
if key == pygame.K_SPACE:
|
195
|
-
self.on_click_up(1)
|
196
|
-
super().on_key_up(key)
|
197
202
|
|
198
203
|
def _paint_disabled(self) -> None:
|
199
204
|
self.surface.blit(
|
@@ -205,16 +210,23 @@ class ClickableWidget(Shape, InteractiveWidget):
|
|
205
210
|
self.get_surface_filter(), (0, 0), special_flags=pygame.BLEND_RGB_ADD
|
206
211
|
)
|
207
212
|
|
208
|
-
def
|
213
|
+
def get_inner_rect(self) -> pygame.FRect:
|
209
214
|
return pygame.FRect(
|
210
215
|
self.rect.x + self.padding[0],
|
211
|
-
self.rect.y
|
212
|
-
|
213
|
-
|
216
|
+
self.rect.y + self.padding[1] + (self.unpressed_relief - self.pressed_relief if self.is_pressed else 0),
|
217
|
+
self.rect.w - self.padding[2] - self.padding[0],
|
218
|
+
self.rect.h - self.unpressed_relief - self.padding[1] - self.padding[3],
|
219
|
+
)
|
220
|
+
|
221
|
+
def get_local_padded_rect(self) -> pygame.FRect:
|
222
|
+
return pygame.FRect(
|
223
|
+
self.padding[0],
|
224
|
+
self.padding[1] + (self.unpressed_relief - self.pressed_relief if self.is_pressed else 0),
|
214
225
|
self.rect.w - self.padding[2] - self.padding[0],
|
215
|
-
self.rect.h - self.unpressed_relief - self.padding[1] - self.padding[3],
|
226
|
+
self.rect.h - self.unpressed_relief - self.padding[1] - self.padding[3],
|
216
227
|
)
|
217
228
|
|
229
|
+
|
218
230
|
def _get_elevated_rect(self) -> pygame.FRect:
|
219
231
|
return pygame.FRect(
|
220
232
|
0,
|