batframework 1.1.0__py3-none-any.whl → 2.0.0a1__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 +84 -52
- batFramework/action.py +280 -252
- batFramework/actionContainer.py +105 -38
- batFramework/animatedSprite.py +81 -117
- batFramework/animation.py +91 -0
- batFramework/audioManager.py +156 -85
- batFramework/baseScene.py +249 -0
- batFramework/camera.py +245 -123
- batFramework/constants.py +57 -75
- batFramework/cutscene.py +239 -119
- batFramework/cutsceneManager.py +34 -0
- batFramework/drawable.py +107 -0
- batFramework/dynamicEntity.py +30 -23
- batFramework/easingController.py +58 -0
- batFramework/entity.py +130 -123
- batFramework/enums.py +171 -0
- batFramework/fontManager.py +65 -0
- batFramework/gui/__init__.py +28 -14
- batFramework/gui/animatedLabel.py +90 -0
- batFramework/gui/button.py +18 -84
- batFramework/gui/clickableWidget.py +244 -0
- batFramework/gui/collapseContainer.py +98 -0
- batFramework/gui/constraints/__init__.py +1 -0
- batFramework/gui/constraints/constraints.py +1066 -0
- batFramework/gui/container.py +220 -49
- batFramework/gui/debugger.py +140 -47
- batFramework/gui/draggableWidget.py +63 -0
- batFramework/gui/image.py +61 -23
- batFramework/gui/indicator.py +116 -40
- batFramework/gui/interactiveWidget.py +243 -22
- batFramework/gui/label.py +147 -110
- batFramework/gui/layout.py +442 -81
- batFramework/gui/meter.py +155 -0
- batFramework/gui/radioButton.py +43 -0
- batFramework/gui/root.py +228 -60
- batFramework/gui/scrollingContainer.py +282 -0
- batFramework/gui/selector.py +232 -0
- batFramework/gui/shape.py +286 -86
- batFramework/gui/slider.py +353 -0
- batFramework/gui/style.py +10 -0
- batFramework/gui/styleManager.py +49 -0
- batFramework/gui/syncedVar.py +43 -0
- batFramework/gui/textInput.py +331 -0
- batFramework/gui/textWidget.py +308 -0
- batFramework/gui/toggle.py +140 -62
- batFramework/gui/tooltip.py +35 -0
- batFramework/gui/widget.py +546 -307
- batFramework/manager.py +131 -50
- batFramework/particle.py +118 -0
- batFramework/propertyEaser.py +79 -0
- batFramework/renderGroup.py +34 -0
- batFramework/resourceManager.py +130 -0
- batFramework/scene.py +31 -226
- batFramework/sceneLayer.py +134 -0
- batFramework/sceneManager.py +200 -165
- batFramework/scrollingSprite.py +115 -0
- batFramework/sprite.py +46 -0
- batFramework/stateMachine.py +49 -51
- batFramework/templates/__init__.py +2 -0
- batFramework/templates/character.py +15 -0
- batFramework/templates/controller.py +158 -0
- batFramework/templates/stateMachine.py +39 -0
- batFramework/tileset.py +46 -0
- batFramework/timeManager.py +213 -0
- batFramework/transition.py +162 -157
- batFramework/triggerZone.py +22 -22
- batFramework/utils.py +306 -184
- {batframework-1.1.0.dist-info → batframework-2.0.0a1.dist-info}/LICENSE +20 -20
- {batframework-1.1.0.dist-info → batframework-2.0.0a1.dist-info}/METADATA +7 -2
- batframework-2.0.0a1.dist-info/RECORD +72 -0
- batFramework/cutsceneBlocks.py +0 -176
- batFramework/debugger.py +0 -48
- batFramework/easing.py +0 -71
- batFramework/gui/constraints.py +0 -204
- batFramework/gui/frame.py +0 -19
- batFramework/particles.py +0 -77
- batFramework/time.py +0 -75
- batFramework/transitionManager.py +0 -0
- batframework-1.1.0.dist-info/RECORD +0 -43
- {batframework-1.1.0.dist-info → batframework-2.0.0a1.dist-info}/WHEEL +0 -0
- {batframework-1.1.0.dist-info → batframework-2.0.0a1.dist-info}/top_level.txt +0 -0
batFramework/__init__.py
CHANGED
@@ -1,66 +1,98 @@
|
|
1
|
-
import
|
2
|
-
|
1
|
+
import pathlib
|
2
|
+
import tomllib
|
3
|
+
from importlib.metadata import version, PackageNotFoundError
|
4
|
+
|
3
5
|
import os
|
6
|
+
import pygame
|
4
7
|
import json
|
5
|
-
|
6
|
-
|
7
|
-
def init(
|
8
|
-
resolution:tuple[int,int],
|
9
|
-
flags:int=0,
|
10
|
-
vsync:int = 0,
|
11
|
-
default_text_size=None,
|
12
|
-
default_font=None,
|
13
|
-
resource_path:str|None=None,
|
14
|
-
window_title:str="BatFramework Project",
|
15
|
-
fps_limit : int = 0
|
16
|
-
):
|
17
|
-
global initialized
|
18
|
-
if not initialized:
|
19
|
-
pygame.init()
|
20
|
-
pygame.display.set_caption(window_title)
|
21
|
-
|
22
|
-
# Initialize display
|
23
|
-
const.init_screen(resolution,flags,vsync)
|
24
|
-
const.set_fps_limit(fps_limit)
|
25
|
-
|
26
|
-
# Initialize default text size
|
27
|
-
if default_text_size: const.set_default_text_size(default_text_size)
|
28
|
-
# Initialize resource path for game data
|
29
|
-
if resource_path: const.set_resource_path(resource_path)
|
30
|
-
|
31
|
-
# Initialize default font cache
|
32
|
-
from .utils import Utils
|
33
|
-
if default_font is None or isinstance(default_font,str):
|
34
|
-
Utils.init_font(default_font)
|
35
|
-
else:
|
36
|
-
raise ValueError(f"default_font '{default_font}' can be either string or None")
|
37
|
-
|
38
|
-
f = list(Utils.FONTS[None].values())[0]
|
39
|
-
print(f"Set default font to : {f.name} {'' if default_font is not None else '(default value)'}")
|
40
|
-
initialized = True
|
41
|
-
|
42
|
-
from .constants import Colors as color
|
43
|
-
from .constants import Axis as axis
|
8
|
+
import batFramework as bf
|
9
|
+
from .constants import Constants as const
|
44
10
|
from .utils import Singleton
|
11
|
+
from .enums import *
|
12
|
+
from .resourceManager import ResourceManager
|
13
|
+
from .fontManager import FontManager
|
45
14
|
from .utils import Utils as utils
|
46
|
-
from .
|
47
|
-
from .
|
48
|
-
from .
|
49
|
-
from .
|
15
|
+
from .tileset import Tileset
|
16
|
+
from .timeManager import TimeManager,Timer,SceneTimer
|
17
|
+
from .easingController import EasingController
|
18
|
+
from .propertyEaser import PropertyEaser
|
19
|
+
from .cutsceneManager import CutsceneManager
|
20
|
+
import batFramework.cutscene as cutscene
|
50
21
|
from .audioManager import AudioManager
|
51
|
-
|
52
|
-
from .transition import *
|
22
|
+
import batFramework.transition as transition
|
53
23
|
from .action import Action
|
54
|
-
from .actionContainer import
|
24
|
+
from .actionContainer import *
|
55
25
|
from .camera import Camera
|
56
26
|
from .entity import Entity
|
27
|
+
from .drawable import Drawable
|
28
|
+
from .renderGroup import RenderGroup
|
57
29
|
from .dynamicEntity import DynamicEntity
|
58
|
-
from .
|
30
|
+
from .sprite import Sprite
|
31
|
+
from .scrollingSprite import ScrollingSprite
|
32
|
+
from .particle import *
|
33
|
+
from .animation import Animation
|
34
|
+
from .animatedSprite import AnimatedSprite
|
59
35
|
from .stateMachine import State, StateMachine
|
60
|
-
from .
|
61
|
-
# from .debugger import Debugger
|
36
|
+
from .sceneLayer import SceneLayer
|
62
37
|
from .scene import Scene
|
63
|
-
from .
|
38
|
+
from .baseScene import BaseScene
|
39
|
+
import batFramework.gui as gui
|
64
40
|
from .sceneManager import SceneManager
|
65
41
|
from .manager import Manager
|
42
|
+
from .templates import *
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
def get_version() -> str:
|
47
|
+
try:
|
48
|
+
return version("batframework")
|
49
|
+
except PackageNotFoundError:
|
50
|
+
pyproject = pathlib.Path(__file__).resolve().parent.parent / "pyproject.toml"
|
51
|
+
if pyproject.exists():
|
52
|
+
with open(pyproject, "rb") as f:
|
53
|
+
data = tomllib.load(f)
|
54
|
+
return data["project"]["version"]
|
55
|
+
return "0.0.0"
|
56
|
+
|
57
|
+
__version__ = get_version()
|
66
58
|
|
59
|
+
def init_screen(resolution: tuple[int, int], flags: int = 0, vsync: int = 0):
|
60
|
+
const.set_resolution(resolution)
|
61
|
+
const.FLAGS = flags
|
62
|
+
const.VSYNC = vsync
|
63
|
+
const.SCREEN = pygame.display.set_mode(
|
64
|
+
const.RESOLUTION, const.FLAGS, vsync=const.VSYNC
|
65
|
+
)
|
66
|
+
print(
|
67
|
+
f"Window : {resolution[0]}x{resolution[1]}"
|
68
|
+
)
|
69
|
+
|
70
|
+
|
71
|
+
def print_version():
|
72
|
+
print(f"BatFramework version: {__version__}")
|
73
|
+
|
74
|
+
def init(
|
75
|
+
resolution: tuple[int, int],
|
76
|
+
flags: int = 0,
|
77
|
+
window_caption: str = "BatFramework Project",
|
78
|
+
resource_path: str | None = None,
|
79
|
+
default_font_size=None,
|
80
|
+
default_font=None,
|
81
|
+
fps_limit: int = 0,
|
82
|
+
vsync: int = 0,
|
83
|
+
):
|
84
|
+
print_version()
|
85
|
+
pygame.display.set_caption(window_caption)
|
86
|
+
init_screen(resolution, flags, vsync)
|
87
|
+
pygame.mixer.init()
|
88
|
+
|
89
|
+
ResourceManager().set_resource_path(
|
90
|
+
resource_path if resource_path is not None else "."
|
91
|
+
)
|
92
|
+
if resource_path is not None:
|
93
|
+
ResourceManager().load_resources(ResourceManager().RESOURCE_PATH)
|
94
|
+
if default_font_size is not None:
|
95
|
+
FontManager().set_default_text_size(default_font_size)
|
96
|
+
FontManager().init_font(default_font)
|
97
|
+
const.BF_INITIALIZED = True
|
98
|
+
const.set_fps_limit(fps_limit)
|