Skip to content

Conversation

@kkafar
Copy link
Collaborator

@kkafar kkafar commented Apr 12, 2022

Description

Proposal of the new architecture

How it works

  • Whole world is loaded from configuration files via Initializer class into Game class
  • Game class holds reference to Controller and is main class of our application. It was separated from the controller to make menu addition possible (it should be happening there)
  • Controller holds references to current LocationModel (which holds all the logical state concerning location being currently displayed) & current LocationView (which holds all the data needed for representation of model).
  • LocationView additionaly (as a Scene subclass) is responsible for collecting user keyboard input. When it receives one, it passes it to the controller via observer pattern. Controller then decides what to do (updates model -> model notifies view).
  • Each model class (GameObject, etc.) has its own counterpart - View (e.g. GameObjectView). This serves main purpouse of separating representation from the data.
  • Classes such as GameObjectView are responsible for collecting user mouse input. If one is collected it is passed to controller via observer pattern.
  • Controller is responsible for updating the model basing on input it receives.
  • Model after update notifies View so the latter can update itself.

This way we achieve almost Model-View-Controller pattern!

@kkafar kkafar marked this pull request as draft April 12, 2022 18:49
@kkafar kkafar self-assigned this Apr 13, 2022
@kkafar kkafar marked this pull request as ready for review April 13, 2022 14:36
@kkafar kkafar marked this pull request as draft April 13, 2022 14:37
Copy link
Collaborator

@co012 co012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jednak przepchołeść te 2 spacje

@kkafar
Copy link
Collaborator Author

kkafar commented Apr 13, 2022

Nie, konfigurację lintera ustalimy jak zrobimy sobie jakieś spotkanie. Ja na razie nic nie ustawiałem, po prostu przekleiłem Java Style by Google.

Edit: Ale 2 spacje >> 4 spacje wcięcia xD

@kkafar kkafar marked this pull request as ready for review April 16, 2022 10:19
@kkafar kkafar merged commit d76966a into master Apr 16, 2022
@kkafar kkafar deleted the @kkafar/arch-proposal branch April 16, 2022 10:20
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.

3 participants