batframework 1.0.9a11__py3-none-any.whl → 1.0.9a13__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 +3 -11
  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.9a13.dist-info}/LICENSE +20 -20
  69. {batframework-1.0.9a11.dist-info → batframework-1.0.9a13.dist-info}/METADATA +24 -17
  70. batframework-1.0.9a13.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.9a13.dist-info}/WHEEL +0 -0
  73. {batframework-1.0.9a11.dist-info → batframework-1.0.9a13.dist-info}/top_level.txt +0 -0
@@ -1,113 +1,116 @@
1
- from .shape import Shape
2
- from typing import Any, Self, Callable
3
- import pygame
4
- from .widget import Widget
5
- from .interactiveWidget import InteractiveWidget
6
- from .draggableWidget import DraggableWidget
7
- import batFramework as bf
8
-
9
-
10
- class Indicator(Shape):
11
- """
12
- Shape intended to be used as icons/indicators
13
- due to its nature, it overrides the top_at function (it can not be 'seen' by the mouse)
14
-
15
- """
16
-
17
- def __init__(self, size: tuple[int | float] = (10, 10)) -> None:
18
- super().__init__(size)
19
- self.debug_color = "magenta"
20
- self.set_outline_width(1)
21
- self.set_outline_color("black")
22
-
23
- def to_string_id(self) -> str:
24
- return "Indicator"
25
-
26
- def set_value(self, value: Any) -> None:
27
- pass
28
-
29
- def get_value(self) -> Any:
30
- pass
31
-
32
- def top_at(self, x, y):
33
- return None
34
-
35
-
36
- class ToggleIndicator(Indicator):
37
- def __init__(self, default_value: bool) -> None:
38
- super().__init__((20, 20))
39
- self.value: bool = default_value
40
- self.callback = lambda val: self.set_color("green" if val else "red")
41
- self.set_value(default_value)
42
- self.callback(default_value)
43
- # TODO aspect ratio would be good right about here
44
- self.add_constraints(bf.gui.AspectRatio(1,reference_axis=bf.axis.VERTICAL))
45
-
46
- def set_callback(self, callback : Callable[[bool],Any]) -> Self:
47
- self.callback = callback
48
- return self
49
-
50
- def set_value(self, value: bool) -> None:
51
- self.value = value
52
- if self.callback:
53
- self.callback(value)
54
- self.dirty_surface = True
55
-
56
- def get_value(self) -> bool:
57
- return self.value
58
-
59
- def top_at(self, x: float, y: float) -> "None|Widget":
60
- r = super().top_at(x, y)
61
- if r is self:
62
- return None
63
- return r
64
-
65
- class ArrowIndicator(Indicator):
66
- def __init__(self,direction:bf.direction):
67
- super().__init__()
68
- self.direction : bf.direction = direction
69
- self.arrow_color = bf.color.WHITE
70
- self.line_width : int = 1
71
-
72
- def set_arrow_color(self,color)-> Self:
73
- self.arrow_color = color
74
- self.dirty_surface = True
75
- return self
76
-
77
- def set_arrow_direction(self,direction:bf.direction)->Self:
78
- self.direction = direction
79
- self.dirty_surface = True
80
- return self
81
-
82
- def set_arrow_line_width(self,value:int)->Self:
83
- self.line_width = value
84
- self.dirty_surface = True
85
- return self
86
-
87
- def paint(self):
88
- super().paint()
89
- r = self.get_local_inner_rect()
90
- size = min(r.width, r.height)
91
- if size %2 == 0:
92
- size -= 1
93
- r.width = size
94
- r.height = size
95
-
96
- #pixel alignment
97
- if (self.padding[1]+self.padding[3] )%2 ==0:
98
- r.height-=1
99
- if (self.padding[0]+self.padding[2] )%2 ==0:
100
- r.width-=1
101
- r.center = self.get_local_inner_rect().center
102
-
103
- bf.utils.draw_triangle(
104
- surface = self.surface,
105
- color = self.arrow_color,
106
- rect =r,
107
- direction = self.direction,
108
- width = self.line_width
109
-
110
- )
111
-
112
-
113
-
1
+ from .shape import Shape
2
+ from typing import Any, Self, Callable
3
+ import pygame
4
+ from .widget import Widget
5
+ from .interactiveWidget import InteractiveWidget
6
+ from .draggableWidget import DraggableWidget
7
+ import batFramework as bf
8
+
9
+
10
+ class Indicator(Shape):
11
+ """
12
+ Shape intended to be used as icons/indicators
13
+ due to its nature, it overrides the top_at function (it can not be 'seen' by the mouse)
14
+
15
+ """
16
+
17
+ def __init__(self, size: tuple[int | float] = (10, 10)) -> None:
18
+ super().__init__(size)
19
+ self.debug_color = "magenta"
20
+ self.set_outline_width(1)
21
+ self.set_outline_color("black")
22
+
23
+ def to_string_id(self) -> str:
24
+ return "Indicator"
25
+
26
+ def set_value(self, value: Any) -> None:
27
+ pass
28
+
29
+ def get_value(self) -> Any:
30
+ pass
31
+
32
+ def top_at(self, x, y):
33
+ return None
34
+
35
+
36
+ class ToggleIndicator(Indicator):
37
+ def __init__(self, default_value: bool) -> None:
38
+ super().__init__((20, 20))
39
+ self.value: bool = default_value
40
+ self.callback = lambda val: self.set_color("green" if val else "red")
41
+ self.set_value(default_value)
42
+ self.callback(default_value)
43
+ # TODO aspect ratio would be good right about here
44
+ self.add_constraints(bf.gui.AspectRatio(1,reference_axis=bf.axis.VERTICAL))
45
+
46
+ def __str__(self):
47
+ return "ToggleIndicator"
48
+
49
+ def set_callback(self, callback : Callable[[bool],Any]) -> Self:
50
+ self.callback = callback
51
+ return self
52
+
53
+ def set_value(self, value: bool) -> None:
54
+ self.value = value
55
+ if self.callback:
56
+ self.callback(value)
57
+ self.dirty_surface = True
58
+
59
+ def get_value(self) -> bool:
60
+ return self.value
61
+
62
+ def top_at(self, x: float, y: float) -> "None|Widget":
63
+ r = super().top_at(x, y)
64
+ if r is self:
65
+ return None
66
+ return r
67
+
68
+ class ArrowIndicator(Indicator):
69
+ def __init__(self,direction:bf.direction):
70
+ super().__init__()
71
+ self.direction : bf.direction = direction
72
+ self.arrow_color = bf.color.WHITE
73
+ self.line_width : int = 1
74
+
75
+ def set_arrow_color(self,color)-> Self:
76
+ self.arrow_color = color
77
+ self.dirty_surface = True
78
+ return self
79
+
80
+ def set_arrow_direction(self,direction:bf.direction)->Self:
81
+ self.direction = direction
82
+ self.dirty_surface = True
83
+ return self
84
+
85
+ def set_arrow_line_width(self,value:int)->Self:
86
+ self.line_width = value
87
+ self.dirty_surface = True
88
+ return self
89
+
90
+ def paint(self):
91
+ super().paint()
92
+ r = self.get_local_inner_rect()
93
+ size = min(r.width, r.height)
94
+ if size %2 == 0:
95
+ size -= 1
96
+ r.width = size
97
+ r.height = size
98
+
99
+ #pixel alignment
100
+ if (self.padding[1]+self.padding[3] )%2 ==0:
101
+ r.height-=1
102
+ if (self.padding[0]+self.padding[2] )%2 ==0:
103
+ r.width-=1
104
+ r.center = self.get_local_inner_rect().center
105
+
106
+ bf.utils.draw_triangle(
107
+ surface = self.surface,
108
+ color = self.arrow_color,
109
+ rect =r,
110
+ direction = self.direction,
111
+ width = self.line_width
112
+
113
+ )
114
+
115
+
116
+