batframework 1.0.8a10__py3-none-any.whl → 1.0.8a11__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/manager.py +39 -1
- {batframework-1.0.8a10.dist-info → batframework-1.0.8a11.dist-info}/METADATA +1 -1
- {batframework-1.0.8a10.dist-info → batframework-1.0.8a11.dist-info}/RECORD +6 -6
- {batframework-1.0.8a10.dist-info → batframework-1.0.8a11.dist-info}/WHEEL +1 -1
- {batframework-1.0.8a10.dist-info → batframework-1.0.8a11.dist-info}/LICENCE +0 -0
- {batframework-1.0.8a10.dist-info → batframework-1.0.8a11.dist-info}/top_level.txt +0 -0
batFramework/manager.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import batFramework as bf
|
2
2
|
import pygame
|
3
|
+
import asyncio
|
3
4
|
import random
|
4
5
|
|
5
|
-
|
6
6
|
class Manager(bf.SceneManager):
|
7
7
|
def __init__(self, *initial_scene_list) -> None:
|
8
8
|
# random.seed("random")
|
@@ -12,6 +12,8 @@ class Manager(bf.SceneManager):
|
|
12
12
|
self._cutsceneManager = bf.CutsceneManager()
|
13
13
|
self._cutsceneManager.set_manager(self)
|
14
14
|
self._clock: pygame.Clock = pygame.Clock()
|
15
|
+
self._is_async_running : bool = False
|
16
|
+
self._running = False
|
15
17
|
pygame.mouse.set_cursor(bf.const.DEFAULT_CURSOR)
|
16
18
|
self.do_pre_init()
|
17
19
|
self.init_scenes(*initial_scene_list)
|
@@ -55,7 +57,43 @@ class Manager(bf.SceneManager):
|
|
55
57
|
def stop(self) -> None:
|
56
58
|
self._running = False
|
57
59
|
|
60
|
+
async def run_async(self):
|
61
|
+
if self._running:
|
62
|
+
print("Error : Already running")
|
63
|
+
return
|
64
|
+
self._is_async_running = True
|
65
|
+
self._running = True
|
66
|
+
dt: float = 0
|
67
|
+
while self._running:
|
68
|
+
for event in pygame.event.get():
|
69
|
+
event.consumed = False
|
70
|
+
self.process_event(event)
|
71
|
+
if not event.consumed:
|
72
|
+
if event.type == pygame.QUIT:
|
73
|
+
self._running = False
|
74
|
+
break
|
75
|
+
if event.type == pygame.VIDEORESIZE and not (
|
76
|
+
bf.const.FLAGS & pygame.SCALED
|
77
|
+
):
|
78
|
+
bf.const.set_resolution((event.w, event.h))
|
79
|
+
# update
|
80
|
+
dt = self._clock.tick(bf.const.FPS) / 1000
|
81
|
+
# dt = min(dt, 0.02) dirty fix for dt being too high when window not focused for a long time
|
82
|
+
self._timeManager.update(dt)
|
83
|
+
self._cutsceneManager.update(dt)
|
84
|
+
self.update(dt)
|
85
|
+
# render
|
86
|
+
self._screen.fill((0, 0, 0))
|
87
|
+
self.draw(self._screen)
|
88
|
+
pygame.display.flip()
|
89
|
+
await asyncio.sleep(0)
|
90
|
+
pygame.quit()
|
91
|
+
|
92
|
+
|
58
93
|
def run(self) -> None:
|
94
|
+
if self._running:
|
95
|
+
print("Error : Already running")
|
96
|
+
return
|
59
97
|
self._running = True
|
60
98
|
dt: float = 0
|
61
99
|
while self._running:
|
@@ -13,7 +13,7 @@ batFramework/easingController.py,sha256=4N8GIp1fsaWBUlDxXx3SMwOq1Mrhn10MZZIO51_C
|
|
13
13
|
batFramework/entity.py,sha256=34gYC6uEMmLkqWtoTG9bgMWRmHRSxhQfxXZKzWS7H2o,2127
|
14
14
|
batFramework/enums.py,sha256=re12gHw2g-5qtCNmGOfZbEC5cL5E8-FA79hfKGrI6-I,2078
|
15
15
|
batFramework/fontManager.py,sha256=iCVavr4hpn0T4xsaUAzdNd01j5ebpcj30fvFHzm1g-M,2246
|
16
|
-
batFramework/manager.py,sha256=
|
16
|
+
batFramework/manager.py,sha256=atzqg1B3ekL60BZZZ4VEpgT7J-Y-yYf6fK0eHg5Cp0Y,4162
|
17
17
|
batFramework/object.py,sha256=_3sfRxrjaiDuVyz5Yk-fYJqYx-Ehq_3-dA4eDTb9kok,3329
|
18
18
|
batFramework/particle.py,sha256=SD_DRqfhzlEeWlORDVPh1R__2_RplNcBujmqovN9Mww,3079
|
19
19
|
batFramework/renderGroup.py,sha256=_VDvmP4iB-XarFJo_Uh5YKwWq1cazHmOBmTXZkqKk40,2020
|
@@ -55,8 +55,8 @@ batFramework/gui/constraints/constraints.py,sha256=nyPew0HIJ24rl4JcdBjUYu2aFynTr
|
|
55
55
|
batFramework/templates/__init__.py,sha256=8XN-7JwYFKTRx_lnUL_If3spwgn5_2b7bwmrRRBPON0,46
|
56
56
|
batFramework/templates/character.py,sha256=S-EkKYrMPg6539r1I5xNf9_bNVIC5-wISIJundbTlBQ,1319
|
57
57
|
batFramework/templates/states.py,sha256=WeomVrQ10vHxVCj9Wnk1PcinKyb871uV910mQe287kI,5370
|
58
|
-
batframework-1.0.
|
59
|
-
batframework-1.0.
|
60
|
-
batframework-1.0.
|
61
|
-
batframework-1.0.
|
62
|
-
batframework-1.0.
|
58
|
+
batframework-1.0.8a11.dist-info/LICENCE,sha256=A65iXbMDbOxQLDNOODJLqA7o5RxszYlEqIgNSzBQRf4,1073
|
59
|
+
batframework-1.0.8a11.dist-info/METADATA,sha256=0V-yZUn90_z6VuhU6zUvFHbDRyt5WsYTBT8qeI0gUWs,1695
|
60
|
+
batframework-1.0.8a11.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
61
|
+
batframework-1.0.8a11.dist-info/top_level.txt,sha256=vxAKBIk1oparFTxeXGBrgfIO7iq_YR5Fv1JvPVAIwmA,13
|
62
|
+
batframework-1.0.8a11.dist-info/RECORD,,
|
File without changes
|
File without changes
|