New HandleInput() loop added to the main game loop. #146
Merged
Conversation
… is called before update and is not affected by fixed framerate or dynamic substepping. HandleInput is in sync with Draw() and the main game loop.
Closed
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a dedicated HandleInput() method to the game loop that decouples input handling from the update logic. The new method is called once per frame before any update logic and uses raw frame time (not affected by fixed framerate or dynamic substepping), creating a clear separation of concerns between input processing and game state updates.
Changes:
- Added
HandleInput()method to the game loop hierarchy (Game, Scene, and CustomEvent classes) - Replaced obsolete fixed update interpolation hooks in CustomEvent with the new HandleInput hooks
- Updated example scene to demonstrate proper usage of the new HandleInput method
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| ShapeEngine/Core/Scene.cs | Added ResolveHandleInput() internal method and OnHandleInput() virtual method with comprehensive documentation |
| ShapeEngine/Core/GameDef/GameVirtual.cs | Added protected virtual HandleInput() method with detailed XML documentation |
| ShapeEngine/Core/GameDef/GameResolve.cs | Implemented ResolveHandleInput() method following the established pattern for event resolution |
| ShapeEngine/Core/GameDef/GameGameloop.cs | Integrated ResolveHandleInput() call into the main game loop before update logic |
| ShapeEngine/Core/GameDef/GameCustomEvent.cs | Replaced obsolete fixed update methods with new PreHandleInput() and PostHandleInput() hooks |
| Examples/Scenes/ExampleScene.cs | Migrated input handling from OnUpdate() to the new OnHandleInput() method, demonstrating proper usage |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This creates a logical place for input handling and decouples (possible fixed) update and input handling.