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

Conversation

Projects
None yet
1 participant
@steffen-wilke
Copy link
Collaborator

steffen-wilke commented Dec 15, 2018

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()

steffen-wilke added some commits Nov 20, 2018

Introduce a new GameWindow interface.
This will allow for better separation between ScreenManger (which should manage screens) and GameWindow which should provide window specific functionality.
Merge branch 'master' of https://github.com/gurkenlabs/litiengine int…
…o separate-screenmanager-gamewindow
Merge branch 'master' of https://github.com/gurkenlabs/litiengine int…
…o separate-screenmanager-gamewindow
Basic overhaul of the Game API
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().
Improve the Game API
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().
Merge branch 'master' of https://github.com/gurkenlabs/litiengine int…
…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

0 of 3 checks passed

codeclimate 3 issues to fix
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/travis-ci/push The Travis CI build is in progress
Details

@steffen-wilke steffen-wilke deleted the revamp-game-api branch Dec 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment