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