batframework 1.0.9a7__py3-none-any.whl → 1.0.9a9__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 +8 -5
- batFramework/baseScene.py +240 -0
- batFramework/camera.py +4 -0
- batFramework/constants.py +6 -2
- 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 +6 -3
- batFramework/gui/animatedLabel.py +10 -2
- batFramework/gui/button.py +4 -31
- batFramework/gui/clickableWidget.py +63 -50
- batFramework/gui/constraints/constraints.py +212 -136
- batFramework/gui/container.py +77 -58
- batFramework/gui/debugger.py +12 -17
- batFramework/gui/draggableWidget.py +21 -17
- batFramework/gui/image.py +3 -10
- batFramework/gui/indicator.py +56 -1
- batFramework/gui/interactiveWidget.py +127 -108
- batFramework/gui/label.py +73 -64
- batFramework/gui/layout.py +286 -445
- batFramework/gui/meter.py +42 -20
- batFramework/gui/radioButton.py +20 -69
- batFramework/gui/root.py +99 -29
- batFramework/gui/selector.py +250 -0
- batFramework/gui/shape.py +13 -5
- batFramework/gui/slider.py +262 -107
- batFramework/gui/syncedVar.py +49 -0
- batFramework/gui/textInput.py +46 -22
- batFramework/gui/toggle.py +70 -52
- batFramework/gui/tooltip.py +30 -0
- batFramework/gui/widget.py +222 -135
- 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 +125 -66
- {batframework-1.0.9a7.dist-info → batframework-1.0.9a9.dist-info}/METADATA +24 -3
- batframework-1.0.9a9.dist-info/RECORD +67 -0
- {batframework-1.0.9a7.dist-info → batframework-1.0.9a9.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.9a7.dist-info/RECORD +0 -63
- /batframework-1.0.9a7.dist-info/LICENCE → /batframework-1.0.9a9.dist-info/LICENSE +0 -0
- {batframework-1.0.9a7.dist-info → batframework-1.0.9a9.dist-info}/top_level.txt +0 -0
batFramework/transition.py
CHANGED
@@ -10,39 +10,23 @@ Both surfaces to transition need to be the same size
|
|
10
10
|
|
11
11
|
class Transition:
|
12
12
|
def __init__(
|
13
|
-
self, duration: float,
|
13
|
+
self, duration: float=1, easing: bf.easing = bf.easing.LINEAR
|
14
14
|
) -> None:
|
15
15
|
"""
|
16
16
|
duration : time in seconds
|
17
17
|
easing function : controls the progression rate
|
18
18
|
"""
|
19
19
|
self.duration: float = duration
|
20
|
-
self.controller = bf.EasingController(
|
21
|
-
|
22
|
-
|
23
|
-
update_callback=self.update,
|
24
|
-
end_callback=self.end,
|
20
|
+
self.controller = bf.EasingController( # main controller for the transition progression
|
21
|
+
duration,easing,
|
22
|
+
update_callback=self.update,end_callback=self.end,
|
25
23
|
)
|
26
|
-
self.start_callback : Callable[[],Any] = None
|
27
|
-
self.update_callback : Callable[[float],Any]= None
|
28
|
-
self.end_callback : Callable[[],Any]= None
|
29
24
|
self.source: pygame.Surface = None
|
30
25
|
self.dest: pygame.Surface = None
|
26
|
+
self.is_over : bool = False # this flag tells the manager the transition is over
|
31
27
|
|
32
28
|
def __repr__(self) -> str:
|
33
|
-
return f"Transition {self.__class__},{self.duration}"
|
34
|
-
|
35
|
-
def set_start_callback(self, func : Callable[[],Any]) -> Self:
|
36
|
-
self.start_callback = func
|
37
|
-
return self
|
38
|
-
|
39
|
-
def set_update_callback(self, func : Callable[[float],Any]) -> Self:
|
40
|
-
self.update_callback = func
|
41
|
-
return self
|
42
|
-
|
43
|
-
def set_end_callback(self, func : Callable[[],Any]) -> Self:
|
44
|
-
self.end_callback = func
|
45
|
-
return self
|
29
|
+
return f"Transition ({self.__class__},{self.duration})"
|
46
30
|
|
47
31
|
def set_source(self, surface: pygame.Surface) -> None:
|
48
32
|
self.source = surface
|
@@ -51,127 +35,77 @@ class Transition:
|
|
51
35
|
self.dest = surface
|
52
36
|
|
53
37
|
def start(self):
|
54
|
-
if self.controller.has_started():
|
38
|
+
if self.controller.has_started(): # can't start again while it's in progress
|
55
39
|
return
|
56
|
-
if self.duration:
|
40
|
+
if self.duration: # start the transition
|
57
41
|
self.controller.start()
|
58
|
-
if self.start_callback:
|
59
|
-
self.start_callback()
|
60
42
|
return
|
61
43
|
|
44
|
+
# if no duration the transition is instantaneous
|
62
45
|
self.controller.start()
|
63
|
-
if self.start_callback:
|
64
|
-
self.start_callback()
|
65
46
|
self.controller.end()
|
66
|
-
self.update(1)
|
47
|
+
self.update(1)# to prevent weird behaviour, update once with progression at max value
|
67
48
|
self.end()
|
68
49
|
|
69
50
|
def update(self, progression: float) -> None:
|
70
|
-
|
71
|
-
self.update_callback(progression)
|
51
|
+
pass
|
72
52
|
|
73
53
|
def end(self):
|
74
54
|
self.controller.stop()
|
75
|
-
|
76
|
-
self.end_callback()
|
55
|
+
self.is_over = True
|
77
56
|
|
78
57
|
def draw(self, surface: pygame.Surface) -> None:
|
79
58
|
pass
|
80
59
|
|
81
|
-
def skip(self
|
82
|
-
self.
|
83
|
-
|
84
|
-
self.end_callback()
|
60
|
+
def skip(self):
|
61
|
+
self.end()
|
62
|
+
|
85
63
|
|
86
64
|
|
87
65
|
class FadeColor(Transition):
|
88
|
-
def __init__(
|
89
|
-
|
90
|
-
color: tuple,
|
91
|
-
middle_duration: float,
|
92
|
-
first_duration: float | None = None,
|
93
|
-
second_duration: float | None = None,
|
94
|
-
easing_function: bf.easing = bf.easing.LINEAR,
|
95
|
-
) -> None:
|
96
|
-
super().__init__(0, easing_function)
|
97
|
-
if first_duration is None:
|
98
|
-
first_duration = middle_duration
|
99
|
-
if second_duration is None:
|
100
|
-
second_duration = middle_duration
|
101
|
-
|
102
|
-
self.first = Fade(first_duration)
|
103
|
-
self.second = Fade(second_duration)
|
66
|
+
def __init__(self,duration:float,color=(0,0,0),color_start:float=0.3,color_end:float=0.7, easing = bf.easing.LINEAR):
|
67
|
+
super().__init__(duration, easing)
|
104
68
|
self.color = color
|
105
|
-
self.
|
106
|
-
self.
|
107
|
-
|
108
|
-
self.timer = bf.Timer(middle_duration, self.transition_to_second)
|
109
|
-
self.first.set_end_callback(self.transition_to_middle)
|
110
|
-
self.second.set_end_callback(self.transition_to_end)
|
111
|
-
|
112
|
-
def transition_to_middle(self):
|
113
|
-
self.next_step(self.timer.start)
|
114
|
-
|
115
|
-
def transition_to_second(self):
|
116
|
-
self.next_step(self.second.start)
|
117
|
-
|
118
|
-
def transition_to_end(self):
|
119
|
-
self.next_step(self.end)
|
120
|
-
|
121
|
-
def next_step(self, callback : Callable[[],Any]=None) -> None:
|
122
|
-
self.index += 1
|
123
|
-
if callback:
|
124
|
-
callback()
|
125
|
-
|
126
|
-
def set_source(self, surface) -> None:
|
127
|
-
super().set_source(surface)
|
128
|
-
self.first.set_source(surface)
|
129
|
-
|
130
|
-
def set_dest(self, surface) -> None:
|
131
|
-
super().set_dest(surface)
|
132
|
-
self.second.set_dest(surface)
|
69
|
+
self.color_start = color_start
|
70
|
+
self.color_end = color_end
|
133
71
|
|
134
72
|
def start(self):
|
135
|
-
|
136
|
-
self.start_callback()
|
137
|
-
|
73
|
+
super().start()
|
138
74
|
self.color_surf = pygame.Surface(self.source.get_size())
|
139
75
|
self.color_surf.fill(self.color)
|
140
76
|
|
141
|
-
self.first.set_dest(self.color_surf)
|
142
|
-
self.second.set_source(self.color_surf)
|
143
|
-
self.first.start()
|
144
|
-
|
145
77
|
def draw(self, surface):
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
self.
|
152
|
-
|
153
|
-
def skip(self, no_callback: bool = False):
|
154
|
-
if not no_callback and self.end_callback:
|
155
|
-
self.end_callback()
|
156
|
-
|
157
|
-
self.first.controller.stop()
|
158
|
-
self.timer.stop()
|
159
|
-
self.second.controller.stop()
|
78
|
+
v = self.controller.get_value()
|
79
|
+
if v < self.color_start:
|
80
|
+
v = v/(self.color_start)
|
81
|
+
self.color_surf.set_alpha(255*v)
|
82
|
+
surface.blit(self.source)
|
83
|
+
surface.blit(self.color_surf)
|
160
84
|
|
85
|
+
elif v < self.color_end:
|
86
|
+
self.color_surf.set_alpha(255)
|
87
|
+
surface.blit(self.color_surf)
|
161
88
|
|
89
|
+
else:
|
90
|
+
v = (v-self.color_end)/(1-self.color_end)
|
91
|
+
surface.blit(self.color_surf)
|
92
|
+
self.dest.set_alpha(255*v)
|
93
|
+
surface.blit(self.dest)
|
162
94
|
|
163
95
|
class Fade(Transition):
|
164
96
|
def end(self):
|
165
97
|
self.dest.set_alpha(255)
|
166
98
|
return super().end()
|
167
99
|
|
100
|
+
def start(self):
|
101
|
+
super().start()
|
102
|
+
|
168
103
|
def draw(self, surface):
|
169
104
|
dest_alpha = 255 * self.controller.get_value()
|
170
105
|
self.dest.set_alpha(dest_alpha)
|
171
106
|
surface.blit(self.source, (0, 0))
|
172
107
|
surface.blit(self.dest, (0, 0))
|
173
108
|
|
174
|
-
|
175
109
|
class GlideRight(Transition):
|
176
110
|
def draw(self, surface):
|
177
111
|
width = surface.get_width()
|
batFramework/utils.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import pygame
|
2
2
|
import batFramework as bf
|
3
|
+
import math
|
3
4
|
import random
|
4
5
|
from .enums import *
|
5
6
|
import re
|
@@ -8,7 +9,7 @@ from functools import cache
|
|
8
9
|
if TYPE_CHECKING:
|
9
10
|
from .drawable import Drawable
|
10
11
|
from .entity import Entity
|
11
|
-
|
12
|
+
from pygame.math import Vector2
|
12
13
|
|
13
14
|
|
14
15
|
class Singleton(type):
|
@@ -150,69 +151,6 @@ class Utils:
|
|
150
151
|
else:
|
151
152
|
pygame.draw.circle(dest_surf, inside_color, center, radius)
|
152
153
|
|
153
|
-
@staticmethod
|
154
|
-
def animate_move(entity:"Entity", start_pos : tuple[float,float], end_pos:tuple[float,float])->Callable[[float],None]:
|
155
|
-
"""
|
156
|
-
Creates a function to animate the movement of an entity from start_pos to end_pos.
|
157
|
-
|
158
|
-
Args:
|
159
|
-
entity (Entity): The entity to move.
|
160
|
-
start_pos (tuple[float, float]): The starting position of the entity.
|
161
|
-
end_pos (tuple[float, float]): The ending position of the entity.
|
162
|
-
|
163
|
-
Returns:
|
164
|
-
Callable[[float], None]: A function that updates the entity's position based on a progression value (0 to 1).
|
165
|
-
"""
|
166
|
-
def func(x):
|
167
|
-
entity.set_center(start_pos[0]+(end_pos[0]-start_pos[0])*x,start_pos[1]+(end_pos[1]-start_pos[1])*x)
|
168
|
-
return func
|
169
|
-
|
170
|
-
def animate_move_to(entity: "Entity", end_pos: tuple[float, float]) -> Callable[[float], None]:
|
171
|
-
"""
|
172
|
-
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.
|
173
|
-
|
174
|
-
Args:
|
175
|
-
entity (Entity): The entity to move.
|
176
|
-
end_pos (tuple[float, float]): The target position of the entity.
|
177
|
-
|
178
|
-
Returns:
|
179
|
-
Callable[[float], None]: A function that updates the entity's position based on a progression value (0 to 1).
|
180
|
-
"""
|
181
|
-
|
182
|
-
# Start position will be captured once when the animation starts
|
183
|
-
start_pos = [None]
|
184
|
-
|
185
|
-
def update_position(progression: float):
|
186
|
-
if start_pos[0] is None:
|
187
|
-
start_pos[0] = entity.rect.center # Capture the start position at the start of the animation
|
188
|
-
|
189
|
-
# Calculate new position based on progression
|
190
|
-
new_x = start_pos[0][0] + (end_pos[0] - start_pos[0][0]) * progression
|
191
|
-
new_y = start_pos[0][1] + (end_pos[1] - start_pos[0][1]) * progression
|
192
|
-
|
193
|
-
# Set the entity's new position
|
194
|
-
entity.set_center(new_x, new_y)
|
195
|
-
|
196
|
-
return update_position
|
197
|
-
|
198
|
-
@staticmethod
|
199
|
-
def animate_alpha(entity:"Drawable", start : int, end:int)->Callable[[float],None]:
|
200
|
-
"""
|
201
|
-
Creates a function to animate the alpha (transparency) of a drawable entity between a start and end value.
|
202
|
-
|
203
|
-
Args:
|
204
|
-
entity (Drawable): The entity to animate.
|
205
|
-
start (int): The starting alpha value (0 to 255).
|
206
|
-
end (int): The ending alpha value (0 to 255).
|
207
|
-
|
208
|
-
Returns:
|
209
|
-
Callable[[float], None]: A function that updates the entity's alpha based on a progression value (0 to 1).
|
210
|
-
"""
|
211
|
-
def func(x):
|
212
|
-
entity.set_alpha(int(pygame.math.clamp(start+(end-start)*x,0,255)))
|
213
|
-
return func
|
214
|
-
|
215
|
-
|
216
154
|
|
217
155
|
@staticmethod
|
218
156
|
def random_color(min_value: int = 0, max_value: int = 255) -> tuple[int, int, int]:
|
@@ -236,12 +174,133 @@ class Utils:
|
|
236
174
|
|
237
175
|
Args:
|
238
176
|
margin (int): Margin from the screen edges, where the point won't be generated.
|
239
|
-
If margin is less than 0 or greater than the screen resolution, returns (0, 0).
|
177
|
+
If margin is less than 0 or greater than half the screen resolution, returns (0, 0).
|
240
178
|
|
241
179
|
Returns:
|
242
180
|
tuple[int, int]: A tuple representing a random point (x, y) on the screen within the screen
|
243
181
|
resolution minus the margin.
|
244
182
|
"""
|
245
|
-
if margin < 0 or margin > bf.const.RESOLUTION[0] or margin > bf.const.RESOLUTION[1]:
|
183
|
+
if margin < 0 or margin > bf.const.RESOLUTION[0]//2 or margin > bf.const.RESOLUTION[1]//2:
|
246
184
|
return 0, 0
|
247
185
|
return random.randint(margin, bf.const.RESOLUTION[0] - margin), random.randint(margin, bf.const.RESOLUTION[1] - margin)
|
186
|
+
|
187
|
+
@staticmethod
|
188
|
+
def distance_point(a:tuple[float,float],b:tuple[float,float]):
|
189
|
+
return math.sqrt((a[0]-b[0]) ** 2 + (a[1]-b[1])**2)
|
190
|
+
|
191
|
+
@staticmethod
|
192
|
+
def rotate_point(point: Vector2, angle: float, center: Vector2) -> Vector2:
|
193
|
+
"""Rotate a point around a center by angle (in degrees)."""
|
194
|
+
rad = math.radians(angle)
|
195
|
+
translated = point - center
|
196
|
+
rotated = Vector2(
|
197
|
+
translated.x * math.cos(rad) - translated.y * math.sin(rad),
|
198
|
+
translated.x * math.sin(rad) + translated.y * math.cos(rad)
|
199
|
+
)
|
200
|
+
return rotated + center
|
201
|
+
|
202
|
+
|
203
|
+
def draw_triangle(surface:pygame.Surface, color, rect:pygame.FRect|pygame.Rect, direction:bf.enums.direction=bf.enums.direction.RIGHT,width:int=0):
|
204
|
+
"""
|
205
|
+
Draw a filled triangle inside a rectangle on a Pygame surface, pointing in the specified direction.
|
206
|
+
|
207
|
+
Args:
|
208
|
+
surface: The Pygame surface to draw on.
|
209
|
+
color: The color of the triangle (e.g., (255, 0, 0) for red).
|
210
|
+
rect: A pygame.Rect object defining the rectangle's position and size.
|
211
|
+
direction: A string ('up', 'down', 'left', 'right') indicating the triangle's orientation.
|
212
|
+
"""
|
213
|
+
# Define the three vertices of the triangle based on direction
|
214
|
+
rect = rect.copy()
|
215
|
+
rect.inflate_ip(-1,-1)
|
216
|
+
if direction == direction.UP:
|
217
|
+
points = [
|
218
|
+
(rect.left, rect.bottom), # Bottom-left corner
|
219
|
+
(rect.right, rect.bottom), # Bottom-right corner
|
220
|
+
(rect.centerx, rect.top) # Top center (apex)
|
221
|
+
]
|
222
|
+
elif direction == direction.DOWN:
|
223
|
+
points = [
|
224
|
+
(rect.left, rect.top), # Top-left corner
|
225
|
+
(rect.right, rect.top), # Top-right corner
|
226
|
+
(rect.centerx, rect.bottom) # Bottom center (apex)
|
227
|
+
]
|
228
|
+
elif direction == direction.LEFT:
|
229
|
+
points = [
|
230
|
+
(rect.right, rect.top), # Top-right corner
|
231
|
+
(rect.right, rect.bottom), # Bottom-right corner
|
232
|
+
(rect.left, rect.centery) # Left center (apex)
|
233
|
+
]
|
234
|
+
elif direction == direction.RIGHT:
|
235
|
+
points = [
|
236
|
+
(rect.left, rect.top), # Top-left corner
|
237
|
+
(rect.left, rect.bottom), # Bottom-left corner
|
238
|
+
(rect.right, rect.centery) # Right center (apex)
|
239
|
+
]
|
240
|
+
else:
|
241
|
+
raise ValueError("Invalid direction")
|
242
|
+
|
243
|
+
# Draw the filled triangle
|
244
|
+
pygame.draw.polygon(surface, color, points,width=width)
|
245
|
+
|
246
|
+
def draw_arc_by_points(surface, color, start_pos, end_pos, tightness=0.5, width=1, resolution=0.5,antialias:bool=False):
|
247
|
+
"""
|
248
|
+
Draw a smooth circular arc connecting start_pos and end_pos.
|
249
|
+
`tightness` controls curvature: 0 is straight line, 1 is semicircle, higher = more bulge.
|
250
|
+
Negative tightness flips the bulge direction.
|
251
|
+
|
252
|
+
Args:
|
253
|
+
surface - pygame Surface
|
254
|
+
color - RGB or RGBA
|
255
|
+
start_pos - (x, y)
|
256
|
+
end_pos - (x, y)
|
257
|
+
tightness - curvature control, 0 = straight, 1 = half circle
|
258
|
+
width - line width
|
259
|
+
resolution - approx pixels per segment
|
260
|
+
Returns:
|
261
|
+
pygame.Rect bounding the drawn arc
|
262
|
+
"""
|
263
|
+
p0 = pygame.Vector2(start_pos)
|
264
|
+
p1 = pygame.Vector2(end_pos)
|
265
|
+
chord = p1 - p0
|
266
|
+
if chord.length_squared() == 0:
|
267
|
+
if antialias:
|
268
|
+
return pygame.draw.aacircle(surface, color, p0, width // 2)
|
269
|
+
return pygame.draw.circle(surface, color, p0, width // 2)
|
270
|
+
|
271
|
+
# Midpoint and perpendicular
|
272
|
+
mid = (p0 + p1) * 0.5
|
273
|
+
perp = pygame.Vector2(-chord.y, chord.x).normalize()
|
274
|
+
|
275
|
+
# Distance of center from midpoint, based on tightness
|
276
|
+
h = chord.length() * tightness
|
277
|
+
center = mid + perp * h
|
278
|
+
|
279
|
+
# Radius and angles
|
280
|
+
r = (p0 - center).length()
|
281
|
+
ang0 = math.atan2(p0.y - center.y, p0.x - center.x)
|
282
|
+
ang1 = math.atan2(p1.y - center.y, p1.x - center.x)
|
283
|
+
|
284
|
+
# Normalize sweep direction based on sign of tightness
|
285
|
+
sweep = ang1 - ang0
|
286
|
+
if tightness > 0 and sweep < 0:
|
287
|
+
sweep += 2 * math.pi
|
288
|
+
elif tightness < 0 and sweep > 0:
|
289
|
+
sweep -= 2 * math.pi
|
290
|
+
|
291
|
+
# Number of points
|
292
|
+
arc_len = abs(sweep * r)
|
293
|
+
segs = max(2, int(arc_len / max(resolution, 1)))
|
294
|
+
|
295
|
+
points = []
|
296
|
+
for i in range(segs + 1):
|
297
|
+
t = i / segs
|
298
|
+
a = ang0 + sweep * t
|
299
|
+
points.append((
|
300
|
+
center.x + math.cos(a) * r,
|
301
|
+
center.y + math.sin(a) * r
|
302
|
+
))
|
303
|
+
if antialias:
|
304
|
+
return pygame.draw.aalines(surface, color, False, points)
|
305
|
+
|
306
|
+
return pygame.draw.lines(surface, color, False, points, width)
|
@@ -1,15 +1,36 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.2
|
2
2
|
Name: batframework
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.9a9
|
4
4
|
Summary: Pygame framework for making games easier.
|
5
5
|
Author-email: Turan Baturay <baturayturan@gmail.com>
|
6
|
+
License: MIT License
|
7
|
+
|
8
|
+
Copyright (c) [2023] [TURAN BATURAY]
|
9
|
+
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
12
|
+
in the Software without restriction, including without limitation the rights
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
15
|
+
furnished to do so, subject to the following conditions:
|
16
|
+
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
18
|
+
copies or substantial portions of the Software.
|
19
|
+
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26
|
+
SOFTWARE.
|
6
27
|
Project-URL: Homepage, https://github.com/TuranBaturay/batFramework
|
7
28
|
Classifier: Programming Language :: Python :: 3
|
8
29
|
Classifier: License :: OSI Approved :: MIT License
|
9
30
|
Classifier: Operating System :: OS Independent
|
10
31
|
Requires-Python: >=3.11
|
11
32
|
Description-Content-Type: text/markdown
|
12
|
-
License-File:
|
33
|
+
License-File: LICENSE
|
13
34
|
Requires-Dist: pygame-ce
|
14
35
|
|
15
36
|
# batFramework
|
@@ -0,0 +1,67 @@
|
|
1
|
+
batFramework/__init__.py,sha256=6-NSXYHNIO713OHgmJmHvry25eLpqwdI0aIG17JtH-k,2961
|
2
|
+
batFramework/action.py,sha256=-h8aXHcfPeClJbfz_7tF_zCdDTExCQHye_ev6-Do43s,8397
|
3
|
+
batFramework/actionContainer.py,sha256=qy6-YY3iX26KJ8NqFMSYo6JExohD8HFk0sC1qhb7qA8,2602
|
4
|
+
batFramework/animatedSprite.py,sha256=NW5fkrooEKytSRxsPruAT3kYY-7cx2whfHAPU-er61Y,1992
|
5
|
+
batFramework/animation.py,sha256=kwkfw4Xbh_jkDC-FXUd1lnwNeTQCcA_Eqz3z5OAiakA,3015
|
6
|
+
batFramework/audioManager.py,sha256=hloFlneDBZQpk4PLWH3Yn5vk52pC-pEX53_exIhnciY,3941
|
7
|
+
batFramework/baseScene.py,sha256=Hxdo6mfjW6c1Ain44XCGWL6yTMpIirHDD0S8SL2NLGY,7092
|
8
|
+
batFramework/camera.py,sha256=jukVjwX6GQmv4Odm8beRKIOj0BReVXeYfcsFfsxYAzg,9559
|
9
|
+
batFramework/constants.py,sha256=bNVqILsVm2y9hXgzCv8x6HzyntIbipoCadoR0H1EtoU,1543
|
10
|
+
batFramework/cutscene.py,sha256=q3HTbHI20MAgt4Qhw_z1pq52KX4FZeKAfqWNtCmzkZM,7473
|
11
|
+
batFramework/cutsceneManager.py,sha256=Mb4f7Esx-QAOgS5q1dfFz-xWqsOo6rK7o3MNXiBHbCI,1071
|
12
|
+
batFramework/drawable.py,sha256=Mhcj2E3Fibo-9W0jPPDd_JNKZMU3bHNTW9qbTTor30o,2297
|
13
|
+
batFramework/dynamicEntity.py,sha256=SjXShy5aT4cQzjlTem05zSQRiNeq52AUXEBVodEG6gI,736
|
14
|
+
batFramework/easingController.py,sha256=dql9m5EFHCQ8_u-8iT2XrFn9WHqEsocYll_2mTM6cug,1792
|
15
|
+
batFramework/entity.py,sha256=tf6BaLa186jzo1WWqdLtGNnCEK2_ywki7d5qf6B9jN4,3460
|
16
|
+
batFramework/enums.py,sha256=kYKnPmJjeuQ2Wwm56bD97HllCtLVBr7vCeskst3zGkY,3137
|
17
|
+
batFramework/fontManager.py,sha256=M7h6AVq9Fwr51UTCFoGsg_PSurdjByA4w8qouXq4EKE,2254
|
18
|
+
batFramework/manager.py,sha256=-tDp8Vph11W6EKSi7fkZLw40B3uwdPAhepfWG8lIFuI,4427
|
19
|
+
batFramework/particle.py,sha256=k-t8H1BwksMUbZ5kDSMMXR5n7ahKEgHMARKgb2pXyr0,3178
|
20
|
+
batFramework/propertyEaser.py,sha256=vW9txE-IRE5zplV7KFS7ALnrcb6y9Yn1RLJqAgRLCZQ,2583
|
21
|
+
batFramework/renderGroup.py,sha256=e6p76CXVtV4lwJ9OzmLlLIncni8yyUriJeik2bNJNhw,1089
|
22
|
+
batFramework/resourceManager.py,sha256=Vb1AxkMybRdSe-IyKS2XqK2MV55pSbJSyXkq-BvMZW8,4588
|
23
|
+
batFramework/scene.py,sha256=GjJtIS2daY20EZhjakEeCX7V-riUD9Q_4bl6r4bl_5c,930
|
24
|
+
batFramework/sceneLayer.py,sha256=0LJtliyPKn8DSL9mMfS6m5DgXogGPm3yDwXSkBqDTaU,4645
|
25
|
+
batFramework/sceneManager.py,sha256=1uND5fFsOr1OzHzRh6li1HLrTZjT4xxi7HJkleOm1A8,6898
|
26
|
+
batFramework/scrollingSprite.py,sha256=weIvJkDur71ZJgevvL4aZoQZ9yoDAqBoXX68fawsfbo,4169
|
27
|
+
batFramework/sprite.py,sha256=hPE2aMRnW1h5W3RWVVNIHazNRnmtf2_s-dgHpboTW2k,1627
|
28
|
+
batFramework/stateMachine.py,sha256=wC-5xbKvf-vGm_N16X9KhgMya5915GyVXL79uk5Bapw,1359
|
29
|
+
batFramework/tileset.py,sha256=3AJBWHx90PC43BdLYCBFm811XBrMvWoB-nsUgyo6s-I,1728
|
30
|
+
batFramework/timeManager.py,sha256=oWAKWLZZA1be2CwM8qTtOcqnSK3_qLW50tnFLepupRE,6660
|
31
|
+
batFramework/transition.py,sha256=kG_6nFmEwCg2ko9--XKor2_hiF9ltwMLr-nPr2QOdyk,5026
|
32
|
+
batFramework/triggerZone.py,sha256=MaPp20UoyRHAMiN0_sBanJJ_0cWnYXZEeY-BEaDTDxQ,652
|
33
|
+
batFramework/utils.py,sha256=6dDELGW8irN8ZBbY5tMb_-NaBgdnbq-2VkoZjFngnIk,12254
|
34
|
+
batFramework/gui/__init__.py,sha256=K_T6t1wZAhd5zeVXwL_ULSwmunSPz533kqMKvg1iPzA,796
|
35
|
+
batFramework/gui/animatedLabel.py,sha256=17EunGRfohYI_1cacrXJU3o3IlSSPKkQE9v55U58PYA,3082
|
36
|
+
batFramework/gui/button.py,sha256=g4S60hsXpuhZjtrv8C9ht0TEwBHJh-jrsLdxRkSMmbE,552
|
37
|
+
batFramework/gui/clickableWidget.py,sha256=vgNpS_NvIF7cyhqeTVs3VYbdz1wj1a22S0-RmOAH8OM,8149
|
38
|
+
batFramework/gui/container.py,sha256=WFcJXYdfHHZDLUPA3822zev-mDH8d2fDIoW48HQo1mw,6796
|
39
|
+
batFramework/gui/debugger.py,sha256=7SYBZ9KonlbiK2AOvpVelgRS86yxaqfoB1cC9kdmC08,3665
|
40
|
+
batFramework/gui/draggableWidget.py,sha256=8gIyIdKTucJmz3MSzfcC_cVBE29anuma5LNfVQrUPy0,1887
|
41
|
+
batFramework/gui/image.py,sha256=zzuHGZ7gkTwO7HEzd1jvrG82vV9ami3fgme0sA-8c5I,1755
|
42
|
+
batFramework/gui/indicator.py,sha256=uJEqaE93ed13T9C60FW_LTf0aFt9xNbKweAoQD4SYSk,3158
|
43
|
+
batFramework/gui/interactiveWidget.py,sha256=UlzRiSp1mW6VmincahCcob1O32LyDZl1H-bw89rW9r8,7786
|
44
|
+
batFramework/gui/label.py,sha256=yZGAY-qQijCa9_SxWI_Sfs3mf4xB9ufXQa0nCwuYYPo,11675
|
45
|
+
batFramework/gui/layout.py,sha256=0qqEqENSnuXY-3BpdmN5pHkhAN4e3gFsE6WeMkcESTk,17302
|
46
|
+
batFramework/gui/meter.py,sha256=OhwEsuJjWW43oMdG-S9HVLReqbE7m1yC6advQVPTVYE,3203
|
47
|
+
batFramework/gui/radioButton.py,sha256=TPgYIf75BdKyR4j9mlpJ2OPDabDBCJ1dYAbJBN40PMc,1281
|
48
|
+
batFramework/gui/root.py,sha256=RCMya7OM-DU5j9SeDbvU-1JYOeAA2rHdyshBYjw4WvE,7523
|
49
|
+
batFramework/gui/selector.py,sha256=1GZMmGWycNERkKX_7r281sQDRncYraFlb7AdcyMWEiY,8240
|
50
|
+
batFramework/gui/shape.py,sha256=CdxLt4H71RZ2Q7FSuoNczzsJZvwC_YorhtK70VZcboI,9633
|
51
|
+
batFramework/gui/slider.py,sha256=iclIEjHcNQqZ4P8u3_7GIIv4v1YXy6pUt1b65pz2vgI,15063
|
52
|
+
batFramework/gui/style.py,sha256=OeLbft0RkIslQ2IcZpBeF6TaQDONIoBcAHj_Bkh9gFw,131
|
53
|
+
batFramework/gui/styleManager.py,sha256=mg9VbK0Ux9pwTbq9oICilnQG3xJLnnZEjOzzSg0IVpY,1424
|
54
|
+
batFramework/gui/syncedVar.py,sha256=AuDeOLkU3jHzA0t5fD7COETCCBGA3Gm0f1_8tMAyTsc,1577
|
55
|
+
batFramework/gui/textInput.py,sha256=RCGKWCRmW-Nl18UUKiNXSaZ_viVrar8vHQ2odhEDOLE,12136
|
56
|
+
batFramework/gui/toggle.py,sha256=07WmNIm8I0Ts8PYB4LxTLo7OFM0Xj0K8dkO7gWRfWe8,4616
|
57
|
+
batFramework/gui/tooltip.py,sha256=Lay-4I7l6r5efk66j-KNfh4cqHmHF2mY9YtKgPYUiSk,887
|
58
|
+
batFramework/gui/widget.py,sha256=KJdjMcveDuFgX9pRLMt5lnl7FPjx-8ni-YfYoqC0QB0,18155
|
59
|
+
batFramework/gui/constraints/__init__.py,sha256=qqXE8nnSrEvCSeHdqY8UYPZLetqdubFPI7IdZuh35QE,26
|
60
|
+
batFramework/gui/constraints/constraints.py,sha256=LwbaIyerVRo5AJhVgjhcFfxFva6Wm9YcOneC0tONlP4,31598
|
61
|
+
batFramework/templates/__init__.py,sha256=E9PmclsTSsTZo-aDrIMiplFJeK4KiUJVFoA9mZw6ur0,25
|
62
|
+
batFramework/templates/controller.py,sha256=xylgodtCUj4Tpz6Yze6-uFgarxs44m7HaKY4q6nWqVQ,2969
|
63
|
+
batframework-1.0.9a9.dist-info/LICENSE,sha256=A65iXbMDbOxQLDNOODJLqA7o5RxszYlEqIgNSzBQRf4,1073
|
64
|
+
batframework-1.0.9a9.dist-info/METADATA,sha256=vdFDSc2TcwiFGX0LLaCHaOYqI7xnNUj3Oi38kWlz3S8,2937
|
65
|
+
batframework-1.0.9a9.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
|
66
|
+
batframework-1.0.9a9.dist-info/top_level.txt,sha256=vxAKBIk1oparFTxeXGBrgfIO7iq_YR5Fv1JvPVAIwmA,13
|
67
|
+
batframework-1.0.9a9.dist-info/RECORD,,
|
batFramework/character.py
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
import batFramework as bf
|
2
|
-
from .stateMachine import State
|
3
|
-
from .animatedSprite import AnimatedSprite
|
4
|
-
from .dynamicEntity import DynamicEntity
|
5
|
-
|
6
|
-
class Character(DynamicEntity,AnimatedSprite):
|
7
|
-
def __init__(self,*args,**kwargs) -> None:
|
8
|
-
super().__init__(*args,**kwargs)
|
9
|
-
self.state_machine = bf.StateMachine(self)
|
10
|
-
self.do_setup_animations()
|
11
|
-
self.do_setup_states()
|
12
|
-
|
13
|
-
def set_state(self,state_name:str):
|
14
|
-
self.state_machine.set_state(state_name)
|
15
|
-
|
16
|
-
def get_current_state(self)->State:
|
17
|
-
return self.state_machine.get_current_state()
|
18
|
-
|
19
|
-
def update(self, dt: float) -> None:
|
20
|
-
self.state_machine.update(dt)
|
21
|
-
super().update(dt)
|
22
|
-
|
23
|
-
def do_setup_states(self):
|
24
|
-
pass
|
25
|
-
|
26
|
-
def do_setup_animations(self):
|
27
|
-
pass
|
@@ -1,43 +0,0 @@
|
|
1
|
-
import batFramework as bf
|
2
|
-
import pygame
|
3
|
-
from .states import *
|
4
|
-
|
5
|
-
class Platform2DCharacter(bf.Character):
|
6
|
-
def __init__(self,*args,**kwargs):
|
7
|
-
super().__init__(*args,**kwargs)
|
8
|
-
self.actions = bf.ActionContainer(
|
9
|
-
*bf.DirectionalKeyControls(),
|
10
|
-
bf.Action("jump").add_key_control(pygame.K_SPACE).set_holding()
|
11
|
-
)
|
12
|
-
self.on_ground : bool = False
|
13
|
-
self.max_jumps = 2
|
14
|
-
self.jump_counter = 0
|
15
|
-
self.jump_force = 150
|
16
|
-
self.speed = 100
|
17
|
-
self.acceleration = 30
|
18
|
-
self.friction = 0.7
|
19
|
-
self.gravity = 300
|
20
|
-
self.terminal_velocity = 1000
|
21
|
-
|
22
|
-
def do_setup_animations(self):
|
23
|
-
self.add_animation(bf.Animation("idle"))
|
24
|
-
self.add_animation(bf.Animation("run"))
|
25
|
-
self.add_animation(bf.Animation("jump"))
|
26
|
-
self.add_animation(bf.Animation("fall"))
|
27
|
-
|
28
|
-
|
29
|
-
def do_setup_states(self):
|
30
|
-
self.state_machine.add_state(Platform2DIdle())
|
31
|
-
self.state_machine.add_state(Platform2DRun())
|
32
|
-
self.state_machine.add_state(Platform2DJump())
|
33
|
-
self.state_machine.add_state(Platform2DFall())
|
34
|
-
self.state_machine.set_state("idle")
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
def do_reset_actions(self) -> None:
|
39
|
-
self.actions.reset()
|
40
|
-
|
41
|
-
def do_process_actions(self, event: pygame.Event) -> None:
|
42
|
-
self.actions.process_event(event)
|
43
|
-
|