batframework 1.0.8a13__py3-none-any.whl → 1.0.9a1__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 (42) hide show
  1. batFramework/__init__.py +11 -15
  2. batFramework/animatedSprite.py +1 -1
  3. batFramework/camera.py +1 -1
  4. batFramework/character.py +1 -1
  5. batFramework/constants.py +10 -0
  6. batFramework/cutscene.py +10 -10
  7. batFramework/drawable.py +75 -0
  8. batFramework/dynamicEntity.py +2 -4
  9. batFramework/entity.py +93 -56
  10. batFramework/enums.py +1 -0
  11. batFramework/fontManager.py +3 -3
  12. batFramework/gui/__init__.py +2 -2
  13. batFramework/gui/{dialogueBox.py → animatedLabel.py} +18 -36
  14. batFramework/gui/button.py +30 -0
  15. batFramework/gui/clickableWidget.py +6 -1
  16. batFramework/gui/constraints/constraints.py +90 -1
  17. batFramework/gui/container.py +84 -93
  18. batFramework/gui/debugger.py +1 -1
  19. batFramework/gui/indicator.py +3 -2
  20. batFramework/gui/interactiveWidget.py +43 -24
  21. batFramework/gui/label.py +43 -49
  22. batFramework/gui/layout.py +378 -42
  23. batFramework/gui/root.py +2 -9
  24. batFramework/gui/shape.py +2 -0
  25. batFramework/gui/textInput.py +115 -78
  26. batFramework/gui/toggle.py +1 -4
  27. batFramework/gui/widget.py +50 -38
  28. batFramework/manager.py +65 -53
  29. batFramework/particle.py +1 -1
  30. batFramework/scene.py +1 -34
  31. batFramework/sceneManager.py +6 -34
  32. batFramework/scrollingSprite.py +1 -1
  33. batFramework/sprite.py +2 -2
  34. batFramework/{time.py → timeManager.py} +0 -2
  35. batFramework/utils.py +118 -19
  36. {batframework-1.0.8a13.dist-info → batframework-1.0.9a1.dist-info}/METADATA +1 -1
  37. batframework-1.0.9a1.dist-info/RECORD +63 -0
  38. {batframework-1.0.8a13.dist-info → batframework-1.0.9a1.dist-info}/WHEEL +1 -1
  39. batFramework/object.py +0 -123
  40. batframework-1.0.8a13.dist-info/RECORD +0 -63
  41. {batframework-1.0.8a13.dist-info → batframework-1.0.9a1.dist-info}/LICENCE +0 -0
  42. {batframework-1.0.8a13.dist-info → batframework-1.0.9a1.dist-info}/top_level.txt +0 -0
batFramework/particle.py CHANGED
@@ -78,7 +78,7 @@ class DirectionalParticle(BasicParticle):
78
78
  super().update_surface()
79
79
 
80
80
 
81
- class ParticleGenerator(bf.Entity):
81
+ class ParticleGenerator(bf.Drawable):
82
82
  def __init__(self) -> None:
83
83
  super().__init__((0, 0))
84
84
  self.particles: list[Particle] = []
batFramework/scene.py CHANGED
@@ -70,35 +70,6 @@ class Scene:
70
70
  """Get the scene index."""
71
71
  return self.scene_index
72
72
 
73
- def set_sharedVar(self, name: str, value: Any) -> bool:
74
- """
75
- Set a shared variable in the manager.
76
-
77
- Args:
78
- name: Name of the shared variable.
79
- value: Value to set.
80
-
81
- Returns:
82
- bool: True if setting was successful, False otherwise.
83
- """
84
- if not self.manager:
85
- return False
86
- return self.manager.set_sharedVar(name, value)
87
-
88
- def get_sharedVar(self, name: str, error_value=None) -> Any:
89
- """
90
- Get a shared variable from the manager.
91
-
92
- Args:
93
- name: Name of the shared variable.
94
-
95
- Returns:
96
- Any: Value of the shared variable.
97
- """
98
- if not self.manager:
99
- return error_value
100
- return self.manager.get_sharedVar(name, error_value)
101
-
102
73
  def do_when_added(self):
103
74
  pass
104
75
 
@@ -277,7 +248,6 @@ class Scene:
277
248
  self.actions.reset()
278
249
  self.early_actions.reset()
279
250
 
280
-
281
251
  if self.entities_to_add:
282
252
  for e in self.entities_to_add:
283
253
  self.world_entities[e] = None
@@ -337,7 +307,7 @@ class Scene:
337
307
 
338
308
  def _draw_camera(self, camera: bf.Camera, entity_list):
339
309
  _ = [entity.draw(camera) for entity in entity_list]
340
- debugMode = self.manager.debug_mode
310
+ debugMode = bf.ResourceManager().get_sharedVar("debug_mode")
341
311
  # Draw outlines for world entities if required
342
312
  if debugMode == bf.debugMode.OUTLINES:
343
313
  [self.debug_entity(e, camera) for e in entity_list]
@@ -355,15 +325,12 @@ class Scene:
355
325
  self.set_active(True)
356
326
  self.set_visible(True)
357
327
  self.root.clear_hovered()
358
- # self.root.clear_focused()
359
328
  self.root.build()
360
329
  bf.TimeManager().activate_register(self.name)
361
330
  self.do_on_enter()
362
- # self.root.visit(lambda e : e.resolve_constraints())
363
331
 
364
332
  def on_exit(self):
365
333
  self.root.clear_hovered()
366
- # self.root.clear_focused()
367
334
  self.set_active(False)
368
335
  self.set_visible(False)
369
336
  self.actions.hard_reset()
@@ -2,7 +2,6 @@ import batFramework as bf
2
2
  import pygame
3
3
  from typing import Self
4
4
 
5
-
6
5
  def swap(lst, index1, index2):
7
6
  lst[index1], lst[index2] = lst[index2], lst[index1]
8
7
 
@@ -11,11 +10,6 @@ class SceneManager:
11
10
  def __init__(self) -> None:
12
11
  self.scenes: list[bf.Scene] = []
13
12
  self.shared_events = {pygame.WINDOWRESIZED}
14
-
15
- self.set_sharedVar("in_cutscene", False)
16
- self.set_sharedVar("player_has_control", True)
17
- self.old_player_control = True
18
- self.debug_mode: bf.enums.debugMode = bf.debugMode.HIDDEN
19
13
  self.current_transitions: dict[str, bf.transition.Transition] = {}
20
14
 
21
15
  def init_scenes(self, *initial_scenes:bf.Scene):
@@ -23,7 +17,6 @@ class SceneManager:
23
17
  s.set_scene_index(index)
24
18
  for s in reversed(initial_scenes):
25
19
  self.add_scene(s)
26
- # self.scenes = list(initial_scenes)
27
20
  self.set_scene(initial_scenes[0].get_name())
28
21
  self.update_scene_states()
29
22
 
@@ -38,7 +31,7 @@ class SceneManager:
38
31
  Print detailed information about the current state of the scenes and shared variables.
39
32
  """
40
33
 
41
- def format_scene_info(scene):
34
+ def format_scene_info(scene:bf.Scene):
42
35
  status = 'Active' if scene.active else 'Inactive'
43
36
  visibility = 'Visible' if scene.visible else 'Invisible'
44
37
  return f"{scene.name:<30} | {status:<8} | {visibility:<10} | Index={scene.scene_index}"
@@ -78,13 +71,6 @@ class SceneManager:
78
71
 
79
72
  print("=" * 50 + "\n")
80
73
 
81
-
82
- def set_sharedVar(self, name, value) -> None:
83
- bf.ResourceManager().set_sharedVar(name,value)
84
-
85
- def get_sharedVar(self, name, error_value=None):
86
- return bf.ResourceManager().get_sharedVar(name, error_value)
87
-
88
74
  def get_current_scene_name(self) -> str:
89
75
  """get the name of the current scene"""
90
76
  return self.scenes[0].get_name()
@@ -106,10 +92,10 @@ class SceneManager:
106
92
  def remove_scene(self, name: str):
107
93
  self.scenes = [s for s in self.scenes if s.name != name]
108
94
 
109
- def has_scene(self, name):
95
+ def has_scene(self, name:str):
110
96
  return any(name == scene.name for scene in self.scenes)
111
97
 
112
- def get_scene(self, name):
98
+ def get_scene(self, name:str):
113
99
  if not self.has_scene(name):
114
100
  return None
115
101
  for scene in self.scenes:
@@ -150,8 +136,6 @@ class SceneManager:
150
136
  def _start_transition(self, target_scene: bf.Scene):
151
137
  target_scene.set_active(True)
152
138
  target_scene.set_visible(True)
153
- self.old_player_control = bool(self.get_sharedVar("player_has_control"))
154
- self.set_sharedVar("player_has_control", False)
155
139
 
156
140
  def _end_transition(self, scene_name, index):
157
141
  self.set_scene(scene_name, index, True)
@@ -177,28 +161,16 @@ class SceneManager:
177
161
  self.scenes[index].do_on_enter_early()
178
162
  target_scene.on_enter()
179
163
 
180
- self.set_sharedVar("player_has_control", self.old_player_control)
181
164
 
182
165
 
183
166
  def cycle_debug_mode(self):
184
- current_index = self.debug_mode.value
167
+ current_index = bf.ResourceManager().get_sharedVar("debug_mode").value
185
168
  next_index = (current_index + 1) % len(bf.debugMode)
169
+ bf.ResourceManager().set_sharedVar("debug_mode", bf.debugMode(next_index))
186
170
  return bf.debugMode(next_index)
187
171
 
188
172
  def process_event(self, event: pygame.Event):
189
- keys = pygame.key.get_pressed()
190
- if (
191
- keys[pygame.K_LCTRL]
192
- and keys[pygame.K_LSHIFT]
193
- and event.type == pygame.KEYDOWN
194
- ):
195
- if event.key == pygame.K_d:
196
- self.debug_mode = self.cycle_debug_mode()
197
- self.set_sharedVar("debug_mode", self.debug_mode)
198
- return
199
- if event.key == pygame.K_p:
200
- self.print_status()
201
- return
173
+
202
174
  if event.type in self.shared_events:
203
175
  [s.process_event(event) for s in self.scenes]
204
176
  else:
@@ -16,7 +16,7 @@ class ScrollingSprite(bf.Sprite):
16
16
 
17
17
  # Use integer values for the starting points, converted from floating point scroll values
18
18
 
19
- super().__init__(data, size, convert_alpha)
19
+ super().__init__(size, data, convert_alpha)
20
20
  self.original_width, self.original_height = self.original_surface.get_size()
21
21
 
22
22
  def get_debug_outlines(self):
batFramework/sprite.py CHANGED
@@ -3,11 +3,11 @@ import pygame
3
3
  from typing import Self
4
4
 
5
5
 
6
- class Sprite(bf.Entity):
6
+ class Sprite(bf.Drawable):
7
7
  def __init__(
8
8
  self,
9
- path=None,
10
9
  size: None | tuple[int, int] = None,
10
+ path=None,
11
11
  convert_alpha: bool = True,
12
12
  ):
13
13
  self.original_surface: pygame.Surface = None
@@ -1,7 +1,5 @@
1
1
  import batFramework as bf
2
2
  from typing import Self
3
-
4
-
5
3
  from typing import Callable, Union, Self
6
4
 
7
5
 
batFramework/utils.py CHANGED
@@ -1,17 +1,16 @@
1
1
  import pygame
2
- from enum import Enum
3
- import os
4
2
  import batFramework as bf
5
- import json
3
+ import random
6
4
  from .enums import *
7
5
  import re
8
- from typing import Callable, TYPE_CHECKING, Any
6
+ from typing import Callable, TYPE_CHECKING
9
7
  from functools import cache
10
8
  if TYPE_CHECKING:
11
- from .object import Object
9
+ from .drawable import Drawable
12
10
  from .entity import Entity
13
11
 
14
12
 
13
+
15
14
  class Singleton(type):
16
15
  _instances = {}
17
16
 
@@ -28,9 +27,15 @@ class Utils:
28
27
  surface: pygame.Surface, split_size: tuple[int, int], func=None
29
28
  ) -> dict[tuple[int, int], pygame.Surface]:
30
29
  """
31
- Splits a surface into subsurfaces and returns a dictionnary of them
32
- with their tuple coordinates as keys.
33
- Exemple : '(0,0) : Surface'
30
+ Splits a surface into subsurfaces based on a given size and returns a dictionary of them with their coordinates as keys.
31
+
32
+ Args:
33
+ surface (pygame.Surface): The surface to be split.
34
+ split_size (tuple[int, int]): The size of each subsurface (width, height).
35
+ func (callable, optional): A function to apply to each subsurface. Defaults to None.
36
+
37
+ Returns:
38
+ dict[tuple[int, int], pygame.Surface]: A dictionary with (x, y) coordinates as keys and the corresponding subsurfaces as values.
34
39
  """
35
40
  width, height = surface.get_size()
36
41
  res = {}
@@ -47,6 +52,19 @@ class Utils:
47
52
 
48
53
  @staticmethod
49
54
  def filter_text(text_mode: textMode):
55
+ """
56
+ Filters a string based on the specified text mode.
57
+
58
+ Args:
59
+ text_mode (textMode): Mode specifying the type of filtering (ALPHABETICAL, NUMERICAL, ALPHANUMERICAL).
60
+
61
+ Returns:
62
+ callable: A function that takes a string and removes all characters not allowed by the text mode.
63
+
64
+ Raises:
65
+ ValueError: If an unsupported text mode is provided.
66
+ """
67
+
50
68
  if text_mode == textMode.ALPHABETICAL:
51
69
  pattern = re.compile(r"[^a-zA-Z]")
52
70
  elif text_mode == textMode.NUMERICAL:
@@ -66,15 +84,20 @@ class Utils:
66
84
  @cache
67
85
  def create_spotlight(inside_color, outside_color, radius, radius_stop=None, dest_surf=None,size=None):
68
86
  """
69
- Draws a circle spotlight centered on a surface
70
- inner color on the center
71
- gradient towards outside color from radius to radius stop
72
- surface background is made transparent
73
- if des_surf is None:
74
- if size is None : size is radius_stop*radius_stop
75
- returns the newly created surface of size 'size' with the spotlight drawn
76
-
87
+ Creates a spotlight effect on a surface with a gradient from inside_color to outside_color.
88
+
89
+ Args:
90
+ inside_color (tuple[int, int, int]): RGB color at the center of the spotlight.
91
+ outside_color (tuple[int, int, int]): RGB color at the outer edge of the spotlight.
92
+ radius (int): Radius of the inner circle.
93
+ radius_stop (int, optional): Radius where the spotlight ends. Defaults to the value of radius.
94
+ dest_surf (pygame.Surface, optional): Surface to draw the spotlight on. Defaults to None.
95
+ size (tuple[int, int], optional): Size of the surface if dest_surf is None. Defaults to a square based on radius_stop.
96
+
97
+ Returns:
98
+ pygame.Surface: The surface with the spotlight effect drawn on it.
77
99
  """
100
+
78
101
  if radius_stop is None:
79
102
  radius_stop = radius
80
103
  diameter = radius_stop * 2
@@ -103,6 +126,18 @@ class Utils:
103
126
 
104
127
  @staticmethod
105
128
  def draw_spotlight(dest_surf:pygame.Surface,inside_color,outside_color,radius,radius_stop=None,center=None):
129
+ """
130
+ Draws a spotlight effect directly onto an existing surface.
131
+
132
+ Args:
133
+ dest_surf (pygame.Surface): The surface to draw the spotlight on.
134
+ inside_color (tuple[int, int, int]): RGB color at the center of the spotlight.
135
+ outside_color (tuple[int, int, int]): RGB color at the outer edge of the spotlight.
136
+ radius (int): Radius of the inner circle.
137
+ radius_stop (int, optional): Radius where the spotlight ends. Defaults to the value of radius.
138
+ center (tuple[int, int], optional): Center point of the spotlight. Defaults to the center of dest_surf.
139
+ """
140
+
106
141
  if radius_stop is None:
107
142
  radius_stop = radius
108
143
  center = dest_surf.get_rect().center if center is None else center
@@ -117,12 +152,34 @@ class Utils:
117
152
  pygame.draw.circle(dest_surf, inside_color, center, radius)
118
153
 
119
154
  @staticmethod
120
- def animate_move(entity:"Object", start_pos : tuple[float,float], end_pos:tuple[float,float])->Callable[[float],None]:
155
+ def animate_move(entity:"Entity", start_pos : tuple[float,float], end_pos:tuple[float,float])->Callable[[float],None]:
156
+ """
157
+ Creates a function to animate the movement of an entity from start_pos to end_pos.
158
+
159
+ Args:
160
+ entity (Entity): The entity to move.
161
+ start_pos (tuple[float, float]): The starting position of the entity.
162
+ end_pos (tuple[float, float]): The ending position of the entity.
163
+
164
+ Returns:
165
+ Callable[[float], None]: A function that updates the entity's position based on a progression value (0 to 1).
166
+ """
121
167
  def func(x):
122
168
  entity.set_center(start_pos[0]+(end_pos[0]-start_pos[0])*x,start_pos[1]+(end_pos[1]-start_pos[1])*x)
123
169
  return func
124
170
 
125
- def animate_move_to(entity: "Object", end_pos: tuple[float, float]) -> Callable[[float], None]:
171
+ def animate_move_to(entity: "Entity", end_pos: tuple[float, float]) -> Callable[[float], None]:
172
+ """
173
+ Creates a function to animate the movement of an entity to a specified end position, capturing the start position at the start of the animation.
174
+
175
+ Args:
176
+ entity (Entity): The entity to move.
177
+ end_pos (tuple[float, float]): The target position of the entity.
178
+
179
+ Returns:
180
+ Callable[[float], None]: A function that updates the entity's position based on a progression value (0 to 1).
181
+ """
182
+
126
183
  # Start position will be captured once when the animation starts
127
184
  start_pos = [None]
128
185
 
@@ -140,10 +197,52 @@ class Utils:
140
197
  return update_position
141
198
 
142
199
  @staticmethod
143
- def animate_alpha(entity:"Entity", start : int, end:int)->Callable[[float],None]:
200
+ def animate_alpha(entity:"Drawable", start : int, end:int)->Callable[[float],None]:
201
+ """
202
+ Creates a function to animate the alpha (transparency) of a drawable entity between a start and end value.
203
+
204
+ Args:
205
+ entity (Drawable): The entity to animate.
206
+ start (int): The starting alpha value (0 to 255).
207
+ end (int): The ending alpha value (0 to 255).
208
+
209
+ Returns:
210
+ Callable[[float], None]: A function that updates the entity's alpha based on a progression value (0 to 1).
211
+ """
144
212
  def func(x):
145
213
  entity.set_alpha(int(pygame.math.clamp(start+(end-start)*x,0,255)))
146
214
  return func
147
215
 
148
216
 
149
217
 
218
+ @staticmethod
219
+ def random_color(min_value: int = 0, max_value: int = 255) -> tuple[int, int, int]:
220
+ """
221
+ Generates a random color as an RGB tuple.
222
+
223
+ Args:
224
+ min_value (int): Minimum value for each RGB component (inclusive). Defaults to 0.
225
+ max_value (int): Maximum value for each RGB component (inclusive). Defaults to 255.
226
+
227
+ Returns:
228
+ tuple[int, int, int]: A tuple representing a random color in RGB format, with each component
229
+ between min_value and max_value.
230
+ """
231
+ return random.randint(min_value, max_value), random.randint(min_value, max_value), random.randint(min_value, max_value)
232
+
233
+ @staticmethod
234
+ def random_point_on_screen(margin: int = 0) -> tuple[int, int]:
235
+ """
236
+ Generates a random point on the screen, considering a margin from the edges.
237
+
238
+ Args:
239
+ margin (int): Margin from the screen edges, where the point won't be generated.
240
+ If margin is less than 0 or greater than the screen resolution, returns (0, 0).
241
+
242
+ Returns:
243
+ tuple[int, int]: A tuple representing a random point (x, y) on the screen within the screen
244
+ resolution minus the margin.
245
+ """
246
+ if margin < 0 or margin > bf.const.RESOLUTION[0] or margin > bf.const.RESOLUTION[1]:
247
+ return 0, 0
248
+ return random.randint(margin, bf.const.RESOLUTION[0] - margin), random.randint(margin, bf.const.RESOLUTION[1] - margin)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: batframework
3
- Version: 1.0.8a13
3
+ Version: 1.0.9a1
4
4
  Summary: Pygame framework for making games easier.
5
5
  Author-email: Turan Baturay <baturayturan@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/TuranBaturay/batFramework
@@ -0,0 +1,63 @@
1
+ batFramework/__init__.py,sha256=5gUzzhO3tXPaaaxVBl7Q-cwKouh12agOa9GXzBipUgU,2576
2
+ batFramework/action.py,sha256=919IVYKviLyVYDtQL7oZvlVuE_aodjJCuwz6fGi5sCk,8420
3
+ batFramework/actionContainer.py,sha256=qy6-YY3iX26KJ8NqFMSYo6JExohD8HFk0sC1qhb7qA8,2602
4
+ batFramework/animatedSprite.py,sha256=IWE8zUgpFaqQPUr7iOUo7TJ_E10aUaMNqlIqv8dW87E,4242
5
+ batFramework/animation.py,sha256=_XcH6r3TVQZUcLbhzUnTNlXrjy-J-nYiRmFpxvTYEoc,1934
6
+ batFramework/audioManager.py,sha256=8tKSf4huZe5tgH98qHlKoFNjXPGDQNJho6PKfSCe7JA,3869
7
+ batFramework/camera.py,sha256=tSy9n20QLeJD3Uz352q-uejzAHPtQczvahaNz7APJcY,9408
8
+ batFramework/character.py,sha256=AK5sQLvAOY3X4-7vzeHeIO5WDFsubn_TADLYxmYc0Qo,789
9
+ batFramework/constants.py,sha256=x8a0GqBJdiwMEjlVohyL3AWHaSxyrBy-4pucVKVNakg,1354
10
+ batFramework/cutscene.py,sha256=zra-hvAVY5buBPfFiog4psvLZW07qCt8LZzd7Vd-4qM,3858
11
+ batFramework/cutsceneBlocks.py,sha256=3jtmTpV48NKCu-Qgjg7KN5KnwXn0kycIQ7t7G3RH3VE,4862
12
+ batFramework/drawable.py,sha256=5We2ITq3M5ERG22-iQw7Mo_1LNo0nqma1P13tvphDjY,2197
13
+ batFramework/dynamicEntity.py,sha256=SjXShy5aT4cQzjlTem05zSQRiNeq52AUXEBVodEG6gI,736
14
+ batFramework/easingController.py,sha256=4N8GIp1fsaWBUlDxXx3SMwOq1Mrhn10MZZIO51_CRnk,1677
15
+ batFramework/entity.py,sha256=wMQKR6IxQ69vtPY4nGsz7WnY9ApPhO_VY08IYx6yUu8,2910
16
+ batFramework/enums.py,sha256=r7vAWBm5g3qrvN-WzBN-2ErNKFFqQ5mTrib2GjmDHmE,2083
17
+ batFramework/fontManager.py,sha256=M7h6AVq9Fwr51UTCFoGsg_PSurdjByA4w8qouXq4EKE,2254
18
+ batFramework/manager.py,sha256=vu7TfDnJu08_I-pPWSn450NDrMY-LysLe8y3t2fTy_o,4404
19
+ batFramework/particle.py,sha256=Aps9eJNdFag-TlduMSezKp4ocFQVvI6iZ98chhdhbgE,3081
20
+ batFramework/renderGroup.py,sha256=_VDvmP4iB-XarFJo_Uh5YKwWq1cazHmOBmTXZkqKk40,2020
21
+ batFramework/resourceManager.py,sha256=0cOIAFXT7UzzvgHn9QkWcXsTp8H2bIS70NvvgpBL2_4,3554
22
+ batFramework/scene.py,sha256=0E7omgNUEl5Uhbx8iO3exyCy4p1MC7bSvqfwncW4KMw,11281
23
+ batFramework/sceneManager.py,sha256=_VPPi0WepH8_NQuwq6d4gfTFdmku3VxrDkJ8cu3oxqU,7008
24
+ batFramework/scrollingSprite.py,sha256=_1-hp7y3pC5m8g2VhFVgGOuJsOkOi8adhQiI2Rb0uPY,4133
25
+ batFramework/sprite.py,sha256=Cz8qzl8jR8y33DUSCObJQOk5e8PcZeavtFhBdR2TogU,1627
26
+ batFramework/stateMachine.py,sha256=wC-5xbKvf-vGm_N16X9KhgMya5915GyVXL79uk5Bapw,1359
27
+ batFramework/tileset.py,sha256=3AJBWHx90PC43BdLYCBFm811XBrMvWoB-nsUgyo6s-I,1728
28
+ batFramework/timeManager.py,sha256=XcqPs_74pjXafi6oNJe8W85SVfXTfPmOZOQyLOuyt8I,4987
29
+ batFramework/transition.py,sha256=-1cyk-7Fbm0U2Z4Y2jjpLHwJ2khM1VxIMcfk2bBEo-M,6655
30
+ batFramework/triggerZone.py,sha256=wIxkvO0cVVupQsJIPOD_-ofqwLnu1TLNK-n6oNXB1E8,579
31
+ batFramework/utils.py,sha256=G9TBEFW6Okm4H7ohikG1GIf6d1pdql8ZBdhkpK5yyys,9969
32
+ batFramework/gui/__init__.py,sha256=OFAKZkafWX-BfDjF4MILmigVT1lywnsfH2pOIJwUybY,691
33
+ batFramework/gui/animatedLabel.py,sha256=KePSSd6bTeJ5UXoPUpvY7QRx5Uah5-qpBDGby6xRgqU,2752
34
+ batFramework/gui/button.py,sha256=IcljwLTIGsCcwCm1mFYBPxZDAU721TiLkOysldultHQ,1798
35
+ batFramework/gui/clickableWidget.py,sha256=4bsa5_OrxFTHNyD3LJOB75gFdjJv3wcV1VMjEf78BrU,7176
36
+ batFramework/gui/container.py,sha256=0did6s0tUqAIi7yX4y26YOMRrAiE3YiIPgfySLLbhBo,6297
37
+ batFramework/gui/debugger.py,sha256=0VTQvhSD5zLjbVhs97ldeBLXqnFLlua-zTCpWB9OBGQ,3928
38
+ batFramework/gui/draggableWidget.py,sha256=SKG7oMInZ_GTnrbv2T0aqlppuiuLX1tkVSCQJtRMlk8,1392
39
+ batFramework/gui/image.py,sha256=7IRvalA6QQz7SYI9h4y4-ryWa9EOxZM3sc10-OZyCPc,1770
40
+ batFramework/gui/indicator.py,sha256=R2SY4HHYnHdvAQZUWVtV-nvpZ_IyEx6CCmb-DDCL1J0,1586
41
+ batFramework/gui/interactiveWidget.py,sha256=ww9WsR2Y87og7NtnzCcyc1zIPE-Bjtn0YZ0SOfKMUbQ,6633
42
+ batFramework/gui/label.py,sha256=6hkD54lrp8ZPnKm75001NnfTli22rSKUdWlC-1bRIdE,11672
43
+ batFramework/gui/layout.py,sha256=-7UgOktSkiyWPfuhTK7I8umqQm7ST69VKgbODejBZtc,21661
44
+ batFramework/gui/meter.py,sha256=RFzAhSzR3O-Pw0wjdfApWGWFQSJoYa4WohkiREDAAJc,2395
45
+ batFramework/gui/radioButton.py,sha256=rROl9mtUa-m220R5qZ85NBPZS7nPVx-azhqijJ-XhCo,2411
46
+ batFramework/gui/root.py,sha256=xe0dGGEaFV80Y6oY2ma-HCYKCBcbO5CbVu4MtWPShxE,4755
47
+ batFramework/gui/shape.py,sha256=PSQRqa8jYA8VsBXRQcpcCuEvTYmWDW8zJkzA_eRFPIo,9349
48
+ batFramework/gui/slider.py,sha256=5d3rfTYjDCDiM5prKu6DTemlGgji2FQ_vGuLzxoa5gU,8335
49
+ batFramework/gui/style.py,sha256=OeLbft0RkIslQ2IcZpBeF6TaQDONIoBcAHj_Bkh9gFw,131
50
+ batFramework/gui/styleManager.py,sha256=rALKJ-AmRbDAiyu8hVAYRAlkQxw677DiPoNKJZ4xtJ4,1245
51
+ batFramework/gui/textInput.py,sha256=RMamEneCaixRVfDU4ctqeYBif4j9cIYgDcLYecikub4,10988
52
+ batFramework/gui/toggle.py,sha256=qr12J6Avi7Tj7lPkLlVhkOVenUE9UPhLmfrG8mvpr90,3888
53
+ batFramework/gui/widget.py,sha256=jisyWi2wMSyEE8VuU3do6aW66PXzORe4nOTtR5WiXsA,14422
54
+ batFramework/gui/constraints/__init__.py,sha256=qqXE8nnSrEvCSeHdqY8UYPZLetqdubFPI7IdZuh35QE,26
55
+ batFramework/gui/constraints/constraints.py,sha256=dUuwWNgOoAGm2PKAxjGy8ubldZ2ih0k4_ViBLd2AXE8,29726
56
+ batFramework/templates/__init__.py,sha256=8XN-7JwYFKTRx_lnUL_If3spwgn5_2b7bwmrRRBPON0,46
57
+ batFramework/templates/character.py,sha256=4UEcegUIeIgj48sVgzyRcT6yjpFOZ8Q_gHTtiB5j6kw,1348
58
+ batFramework/templates/states.py,sha256=WeomVrQ10vHxVCj9Wnk1PcinKyb871uV910mQe287kI,5370
59
+ batframework-1.0.9a1.dist-info/LICENCE,sha256=A65iXbMDbOxQLDNOODJLqA7o5RxszYlEqIgNSzBQRf4,1073
60
+ batframework-1.0.9a1.dist-info/METADATA,sha256=m1d5kjSmUaJxytpyQ6-i0tq-D-2X7QheyOO7nPKdR9Y,1694
61
+ batframework-1.0.9a1.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
62
+ batframework-1.0.9a1.dist-info/top_level.txt,sha256=vxAKBIk1oparFTxeXGBrgfIO7iq_YR5Fv1JvPVAIwmA,13
63
+ batframework-1.0.9a1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (75.5.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
batFramework/object.py DELETED
@@ -1,123 +0,0 @@
1
- from typing import Any, Self
2
- import pygame
3
- import batFramework as bf
4
- from typing import TYPE_CHECKING
5
-
6
- if TYPE_CHECKING:
7
- from .camera import Camera
8
-
9
-
10
- class Object:
11
- __count = 0
12
- __available_uid = set()
13
- __used_uid = set()
14
-
15
- def __init__(self) -> None:
16
- self.rect = pygame.FRect(0, 0, 0, 0)
17
- self.tags: list[str] = []
18
- self.parent_scene: bf.Scene | None = None
19
- self.debug_color: tuple | str = "red"
20
- self.render_order: int = 0
21
- self.uid: int = Object.__count
22
- Object.__used_uid.add(self.uid)
23
-
24
- if Object.__available_uid:
25
- self.name = Object.__available_uid.pop()
26
- else:
27
- self.name = Object.__count
28
- Object.__count += 1
29
-
30
- def __del__(self):
31
- Object.__available_uid.add(self.uid)
32
-
33
- def set_position(self, x, y) -> Self:
34
- self.rect.topleft = x, y
35
- return self
36
-
37
- def set_center(self, x, y) -> Self:
38
- self.rect.center = x, y
39
- return self
40
-
41
- def get_debug_outlines(self):
42
- yield (self.rect, self.debug_color)
43
-
44
- def set_debug_color(self, color) -> Self:
45
- self.debug_color = color
46
- return self
47
-
48
- def set_parent_scene(self, scene) -> Self:
49
- if scene == self.parent_scene:
50
- return self
51
- if self.parent_scene is not None:
52
- self.do_when_removed()
53
- self.parent_scene = scene
54
- if scene is not None:
55
- self.do_when_added()
56
- return self
57
-
58
- def do_when_added(self):
59
- pass
60
-
61
- def do_when_removed(self):
62
- pass
63
-
64
- def set_uid(self, uid: int) -> Self:
65
- if uid in Object.__used_uid:
66
- print(f"set_uid error : UID '{uid}' is already in use")
67
- return self
68
- self.uid = uid
69
- Object.__used_uid.add(uid)
70
- return self
71
-
72
- def add_tags(self, *tags) -> Self:
73
- for tag in tags:
74
- if tag not in self.tags:
75
- self.tags.append(tag)
76
- self.tags.sort()
77
- return self
78
-
79
- def remove_tags(self, *tags):
80
- self.tags = [tag for tag in self.tags if tag not in tags]
81
-
82
- def has_tags(self, *tags) -> bool:
83
- return all(tag in self.tags for tag in tags)
84
-
85
- def get_tags(self) -> list[str]:
86
- return self.tags
87
-
88
- def process_event(self, event: pygame.Event) -> bool:
89
- """
90
- Returns bool : True if the method is blocking (no propagation to next object of the scene)
91
- """
92
- if event.consumed:
93
- return
94
- self.do_process_actions(event)
95
- self.do_handle_event(event)
96
-
97
- def do_process_actions(self, event: pygame.Event) -> None:
98
- """
99
- Process entity actions you may have set
100
- """
101
-
102
- def do_reset_actions(self) -> None:
103
- """
104
- Reset entity actions you may have set
105
- """
106
-
107
- def do_handle_event(self, event: pygame.Event):
108
- """
109
- Handle specific events with no action support
110
- """
111
- return False
112
-
113
- def update(self, dt: float) -> None:
114
- """
115
- Update method to be overriden by subclasses of object (must call do_update and do_reset_actions)
116
- """
117
- self.do_update(dt)
118
- self.do_reset_actions()
119
-
120
- def do_update(self, dt: float) -> None:
121
- """
122
- Update method to be overriden for specific behavior by the end user
123
- """