Skip to content

Commit

Permalink
Merge pull request #136 from ekiefl/numba-cache-loading-screen
Browse files Browse the repository at this point in the history
Numba cache loading screen
  • Loading branch information
ekiefl authored Aug 25, 2024
2 parents 5620776 + 957d29a commit eec3ffe
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
11 changes: 11 additions & 0 deletions pooltool/ani/animate.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from pooltool.ani.menu import GenericMenu, menus
from pooltool.ani.modes import Mode, ModeManager, all_modes
from pooltool.ani.mouse import mouse
from pooltool.evolution import simulate
from pooltool.evolution.continuize import continuize
from pooltool.game.datatypes import GameType
from pooltool.layouts import get_rack
Expand Down Expand Up @@ -518,6 +519,16 @@ def enter_game(self):
if ani.settings["graphics"]["hud"]:
hud.init()

code_comp_menu = GenericMenu(
title="Compiling simulation code...",
frame_color=(0, 0, 0, 0.4),
title_pos=(0, 0, 0),
)
code_comp_menu.show()
boop(2)
simulate(System.example(), inplace=True)
code_comp_menu.hide()

Global.mode_mgr.change_mode(Mode.aim)

def create_system(self):
Expand Down
14 changes: 10 additions & 4 deletions pooltool/ani/modes/calculate.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pooltool.ani.modes.datatypes import BaseMode, Mode
from pooltool.ani.mouse import MouseMode, mouse
from pooltool.evolution import simulate
from pooltool.system.datatypes import multisystem
from pooltool.system.datatypes import System, multisystem


class CalculateMode(BaseMode):
Expand All @@ -30,7 +30,13 @@ def enter(self):
title_pos=(0, 0, -0.2),
)

tasks.add(self.run_simulation, "run_simulation", taskChain="simulation")
tasks.add(
self.run_simulation,
"run_simulation",
extraArgs=[multisystem.active],
taskChain="simulation",
appendTask=True,
)

self.register_keymap_event("escape", Action.quit, True)
self.register_keymap_event("mouse1", Action.zoom, True)
Expand Down Expand Up @@ -74,11 +80,11 @@ def calculate_view_task(self, task):

return task.cont

def run_simulation(self, task):
def run_simulation(self, system: System, task):
"""Run a pool simulation"""

simulate(
multisystem.active,
system,
continuous=True,
inplace=True,
)
Expand Down
2 changes: 1 addition & 1 deletion pooltool/system/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ def example(cls) -> System:
},
)
system.set_ballset(BallSet("pooltool_pocket"))
system.cue.set_state(V0=1.5, b=-0.3, phi=95.07668213305062)
system.cue.set_state(V0=1.5, b=-0.3, a=-0.4, phi=95.14)
return system


Expand Down

0 comments on commit eec3ffe

Please sign in to comment.