batframework 1.0.9a10__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 -245
- 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 -201
- 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 -426
- 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.9a10.dist-info → batframework-1.0.9a12.dist-info}/LICENSE +20 -20
- {batframework-1.0.9a10.dist-info → batframework-1.0.9a12.dist-info}/METADATA +24 -17
- batframework-1.0.9a12.dist-info/RECORD +72 -0
- batframework-1.0.9a10.dist-info/RECORD +0 -67
- {batframework-1.0.9a10.dist-info → batframework-1.0.9a12.dist-info}/WHEEL +0 -0
- {batframework-1.0.9a10.dist-info → batframework-1.0.9a12.dist-info}/top_level.txt +0 -0
batFramework/gui/style.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
from .widget import Widget
|
2
|
-
|
3
|
-
|
4
|
-
class Style:
|
5
|
-
|
6
|
-
def __init__(self):
|
7
|
-
pass
|
8
|
-
|
9
|
-
def apply(self, widget: Widget):
|
10
|
-
pass
|
1
|
+
from .widget import Widget
|
2
|
+
|
3
|
+
|
4
|
+
class Style:
|
5
|
+
|
6
|
+
def __init__(self):
|
7
|
+
pass
|
8
|
+
|
9
|
+
def apply(self, widget: Widget):
|
10
|
+
pass
|
batFramework/gui/styleManager.py
CHANGED
@@ -1,54 +1,49 @@
|
|
1
|
-
from ..utils import Singleton
|
2
|
-
from .widget import Widget
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
self.
|
16
|
-
self.
|
17
|
-
self.
|
18
|
-
|
19
|
-
def
|
20
|
-
if widget in self.widgets:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
def
|
43
|
-
|
44
|
-
for
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
if self.lookup[widget]:
|
51
|
-
continue
|
52
|
-
for style in self.styles:
|
53
|
-
style.apply(widget)
|
54
|
-
self.lookup[widget] = True
|
1
|
+
from ..utils import Singleton
|
2
|
+
from .widget import Widget
|
3
|
+
from .style import Style
|
4
|
+
import batFramework as bf
|
5
|
+
|
6
|
+
class StyleManager(metaclass=Singleton):
|
7
|
+
def __init__(self):
|
8
|
+
self.styles: list[Style] = []
|
9
|
+
self.widgets: set[Widget] = set()
|
10
|
+
self.lookup: dict[Widget, bool] = {}
|
11
|
+
|
12
|
+
def register_widget(self, widget: Widget):
|
13
|
+
if widget in self.widgets:
|
14
|
+
return
|
15
|
+
self.widgets.add(widget)
|
16
|
+
self.lookup[widget] = False
|
17
|
+
self.update()
|
18
|
+
|
19
|
+
def refresh_widget(self, widget: Widget):
|
20
|
+
if widget in self.widgets:
|
21
|
+
self.lookup[widget] = False
|
22
|
+
self.update()
|
23
|
+
|
24
|
+
def remove_widget(self, widget: Widget):
|
25
|
+
if widget not in self.widgets:
|
26
|
+
return
|
27
|
+
self.widgets.remove(widget)
|
28
|
+
self.lookup.pop(widget)
|
29
|
+
|
30
|
+
def add(self, style: Style):
|
31
|
+
self.styles.append(style)
|
32
|
+
self.lookup = {key: False for key in self.lookup}
|
33
|
+
self.update()
|
34
|
+
|
35
|
+
def update_forced(self):
|
36
|
+
for style in self.styles:
|
37
|
+
for widget in self.widgets:
|
38
|
+
style.apply(widget)
|
39
|
+
for key in self.lookup.keys():
|
40
|
+
self.lookup[key] = True
|
41
|
+
|
42
|
+
def update(self):
|
43
|
+
for style in self.styles:
|
44
|
+
for widget in self.widgets:
|
45
|
+
if self.lookup[widget]:
|
46
|
+
continue
|
47
|
+
style.apply(widget)
|
48
|
+
for key in self.lookup.keys():
|
49
|
+
self.lookup[key] = True
|
batFramework/gui/syncedVar.py
CHANGED
@@ -1,49 +1,43 @@
|
|
1
|
-
from
|
2
|
-
from
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
self.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
self
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
self.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
def _update_widgets(self):
|
45
|
-
"""
|
46
|
-
Calls the update callback for all bound widgets.
|
47
|
-
"""
|
48
|
-
for _, update_callback in self._bound_widgets:
|
49
|
-
update_callback(self._value)
|
1
|
+
from typing import TypeVar, Generic, Callable, Any, Self
|
2
|
+
from .widget import Widget
|
3
|
+
from ..entity import Entity
|
4
|
+
|
5
|
+
T = TypeVar('T')
|
6
|
+
|
7
|
+
class SyncedVar(Generic[T]):
|
8
|
+
def __init__(self, value: T = None):
|
9
|
+
self._value: T = value
|
10
|
+
self.modify_callback: Callable[[T], Any] | None = None
|
11
|
+
self._bound_entities: set[tuple[Entity, Callable[[T], Any]]] = set()
|
12
|
+
|
13
|
+
def set_modify_callback(self, callback: Callable[[T], Any]) -> "SyncedVar[T]":
|
14
|
+
self.modify_callback = callback
|
15
|
+
return self
|
16
|
+
|
17
|
+
def bind(self, entity, update_callback: Callable[[T], Any]) -> "SyncedVar[T]":
|
18
|
+
self._bound_entities.add((entity, update_callback))
|
19
|
+
return self
|
20
|
+
|
21
|
+
def unbind(self, entity: Entity) -> "SyncedVar[T]":
|
22
|
+
self._bound_entities = {(e, cb) for e, cb in self._bound_entities if e != entity}
|
23
|
+
return self
|
24
|
+
|
25
|
+
@property
|
26
|
+
def value(self) -> T:
|
27
|
+
return self._value
|
28
|
+
|
29
|
+
def set_value(self,value:T)->Self:
|
30
|
+
self.value = value
|
31
|
+
return self
|
32
|
+
|
33
|
+
@value.setter
|
34
|
+
def value(self, new_value: T):
|
35
|
+
if self._value != new_value:
|
36
|
+
self._value = new_value
|
37
|
+
self.update_bound_entities()
|
38
|
+
if self.modify_callback is not None:
|
39
|
+
self.modify_callback(new_value)
|
40
|
+
|
41
|
+
def update_bound_entities(self):
|
42
|
+
for _, update_callback in self._bound_entities:
|
43
|
+
update_callback(self._value)
|