Engine.breakpoint which accepts a block with a debugger (e.g. { binding.pry }, { debugger })
Can be called from anywhere:
with a debugger block, to break where the Engine.breakpoint { binding.pry } line has been added
without a block, causing a breakpoint in the main thread where the breakpoint method is defined
Globally defined KEY_BACKSPACE to hit a breakpoint at any point
Engine::Window class
Collects all of the Window logic, and removes it from Engine.rb
Removes the need to pass around height and width (Game Entrypoint -> Engine.start -> Engine.open_window)
Ability to toggle fullscreen with KEY_F
Auto switches from fullscreen to windowed (and back) when hitting a breakpoint
Engine::Cursor class
Handles some basics of the cursor input mode
Why
When I'm on my laptop, with a single screen, I can't hit a breakpoint and tab away from the running game.
By making it easy to switch to windowed mode (and/or handling it by default when hitting a breakpoint) I can now switch between running the engine and debugging.
[!TIP]
It's easy to override the default height/width/fullscreen state:
What
Adds:
Engine.breakpoint
which accepts a block with a debugger (e.g.{ binding.pry }
,{ debugger }
)Engine.breakpoint { binding.pry }
line has been addedKEY_BACKSPACE
to hit a breakpoint at any pointEngine::Window
classEngine.rb
height
andwidth
(Game Entrypoint
->Engine.start
->Engine.open_window
)KEY_F
Engine::Cursor
classWhy
When I'm on my laptop, with a single screen, I can't hit a breakpoint and tab away from the running game. By making it easy to switch to windowed mode (and/or handling it by default when hitting a breakpoint) I can now switch between running the engine and debugging.