batframework 1.1.0__py3-none-any.whl → 2.0.0__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 +84 -51
  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.1.0.dist-info → batframework-2.0.0.dist-info}/LICENSE +1 -1
  69. {batframework-1.1.0.dist-info → batframework-2.0.0.dist-info}/METADATA +8 -4
  70. batframework-2.0.0.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.1.0.dist-info/RECORD +0 -43
  80. {batframework-1.1.0.dist-info → batframework-2.0.0.dist-info}/WHEEL +0 -0
  81. {batframework-1.1.0.dist-info → batframework-2.0.0.dist-info}/top_level.txt +0 -0
batFramework/__init__.py CHANGED
@@ -1,66 +1,99 @@
1
- import pygame
2
- from .constants import Constants as const
3
- import os
4
- import json
5
- initialized = False
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)
1
+ import pathlib
2
+ import tomllib
3
+ from importlib.metadata import version, PackageNotFoundError
25
4
 
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)
5
+ def get_version() -> str:
6
+ try:
7
+ return version("batframework")
8
+ except PackageNotFoundError:
9
+ pyproject = pathlib.Path(__file__).resolve().parent.parent / "pyproject.toml"
10
+ if pyproject.exists():
11
+ with open(pyproject, "rb") as f:
12
+ data = tomllib.load(f)
13
+ return data["project"]["version"]
14
+ return "0.0.0"
30
15
 
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
16
+ __version__ = get_version()
41
17
 
42
- from .constants import Colors as color
43
- from .constants import Axis as axis
18
+ import os
19
+ import pygame
20
+ import json
21
+ import batFramework as bf
22
+ from .constants import Constants as const
44
23
  from .utils import Singleton
24
+ from .enums import *
25
+ from .resourceManager import ResourceManager
26
+ from .fontManager import FontManager
45
27
  from .utils import Utils as utils
46
- from .time import Time, Timer
47
- from .cutscene import Cutscene,CutsceneManager
48
- from .cutsceneBlocks import *
49
- from .easing import Easing, EasingAnimation
28
+ from .tileset import Tileset
29
+ from .timeManager import TimeManager,Timer,SceneTimer
30
+ from .easingController import EasingController
31
+ from .propertyEaser import PropertyEaser
32
+ from .cutsceneManager import CutsceneManager
33
+ import batFramework.cutscene as cutscene
50
34
  from .audioManager import AudioManager
51
- from .utils import Layout, Alignment, Direction
52
- from .transition import *
35
+ import batFramework.transition as transition
53
36
  from .action import Action
54
- from .actionContainer import ActionContainer
37
+ from .actionContainer import *
55
38
  from .camera import Camera
56
39
  from .entity import Entity
40
+ from .drawable import Drawable
41
+ from .renderGroup import RenderGroup
57
42
  from .dynamicEntity import DynamicEntity
58
- from .animatedSprite import AnimatedSprite, AnimState
43
+ from .sprite import Sprite
44
+ from .scrollingSprite import ScrollingSprite
45
+ from .particle import *
46
+ from .animation import Animation
47
+ from .animatedSprite import AnimatedSprite
59
48
  from .stateMachine import State, StateMachine
60
- from .particles import Particle, ParticleManager
61
- # from .debugger import Debugger
49
+ from .sceneLayer import SceneLayer
62
50
  from .scene import Scene
63
- from .gui import *
51
+ from .baseScene import BaseScene
52
+ import batFramework.gui as gui
64
53
  from .sceneManager import SceneManager
65
54
  from .manager import Manager
55
+ from .templates import *
56
+
57
+
58
+
66
59
 
60
+ def init_screen(resolution: tuple[int, int], flags: int = 0, vsync: int = 0):
61
+ const.set_resolution(resolution)
62
+ const.FLAGS = flags
63
+ const.VSYNC = vsync
64
+ const.SCREEN = pygame.display.set_mode(
65
+ const.RESOLUTION, const.FLAGS, vsync=const.VSYNC
66
+ )
67
+ print(
68
+ f"Window : {resolution[0]}x{resolution[1]}"
69
+ )
70
+
71
+
72
+ def print_version():
73
+ print(f"BatFramework version: {__version__}")
74
+
75
+ def init(
76
+ resolution: tuple[int, int],
77
+ flags: int = 0,
78
+ window_caption: str = "BatFramework Project",
79
+ resource_path: str | None = None,
80
+ default_font_size=None,
81
+ default_font=None,
82
+ fps_limit: int = 0,
83
+ vsync: int = 0,
84
+ ):
85
+ print_version()
86
+ pygame.display.set_caption(window_caption)
87
+ init_screen(resolution, flags, vsync)
88
+ pygame.mixer.init()
89
+
90
+ ResourceManager().set_resource_path(
91
+ resource_path if resource_path is not None else "."
92
+ )
93
+ if resource_path is not None:
94
+ ResourceManager().load_resources(ResourceManager().RESOURCE_PATH)
95
+ if default_font_size is not None:
96
+ FontManager().set_default_text_size(default_font_size)
97
+ FontManager().init_font(default_font)
98
+ const.BF_INITIALIZED = True
99
+ const.set_fps_limit(fps_limit)