Skip to content
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 12 commits into from Dec 17, 2018
Merged

Revamp game api #198

merged 12 commits into from Dec 17, 2018

Conversation

steffen-wilke
Copy link
Contributor

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 and Input API expose. This now also separates the ScreenManager from the "stuff" that controls the GameWindow by introducing Game.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()

This will allow for better separation between ScreenManger (which should manage screens) and GameWindow which should provide window specific functionality.
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.
@steffen-wilke steffen-wilke merged commit e942b22 into master Dec 17, 2018
@steffen-wilke steffen-wilke deleted the revamp-game-api branch December 17, 2018 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant