New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revamp game api #198
Merged
Merged
Revamp game api #198
Conversation
This file contains 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
This will allow for better separation between ScreenManger (which should manage screens) and GameWindow which should provide window specific functionality.
…reenmanager-gamewindow
…o separate-screenmanager-gamewindow
…o separate-screenmanager-gamewindow
Similar to the other static APIs in the engine (Input and Resources), this commit now streamlines the method naming on the Game class. It is intended to make the parts of the Game class better understandable and require less to type. Game.getPhysicsEngine() -> Game.physics() Game.getSoundEngine() -> Game.audio() Game.getRenderEngine() -> Game.graphics() Game.getConfiguration() -> Game.config() Game.getInfo -> Game.info() Game.getMetrics -> Game.metrics() Game.getTime -> Game.time() Game.getScreenManager() -> Game.screens() Game.getLoop() -> Game.loop() Game.getRenderLoop() -> Game.renderLoop() Also the GameWindow interface is now no longer implemented by IScreenManager which now requires to access the windows specific methods via Game.window() while the screen specific stuff is accessed via Game.screens().
Provide further documentation on the Game API. Improve the GameMetrics implementation. Extend the GameWindow with getWidth() and getHeight() methods instead of getResolution().getWidth() and getResolution().getHeight() which allows a more direct access for a very common use case of the GameWindow. Make use of these new methods. Rename getScreenLocation() to getWindowLocation().
…o revamp-game-api Fix the conflicts by just re-implementing the EnvironmentUnloadedListener usage in the Game class.
…o revamp-game-api
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.
With this change, we've revamped the last of our static APIs. This makes the API better readable there's less to type and it unifies it with the API that the
Resources
andInput
API expose. This now also separates theScreenManager
from the "stuff" that controls theGameWindow
by introducingGame.window()
.Overall, we've also added a lot of documentation and small improvements to the
Game
class.Changes in the API:
Game.getPhysicsEngine() -> Game.physics()
Game.getSoundEngine() -> Game.audio()
Game.getRenderEngine() -> Game.graphics()
Game.getConfiguration() -> Game.config()
Game.getInfo -> Game.info()
Game.getMetrics -> Game.metrics()
Game.getTime -> Game.time()
Game.getScreenManager() -> Game.screens()
Game.getLoop() -> Game.loop()
Game.getRenderLoop() -> Game.renderLoop()
Additions to the API:
Game.window()