I've started making a new game. The game has 3 classes so far:
- An app delegate, which doesn't do much.
- A view, responsible for drawing everything in the game and receiving touch events.
- A controller, responsible for processing the touch events and determining what needs to be drawn.
First question: are the responsibilities properly distributed between the two objects right now?
Second question: how should the view and controller communicate with each other? The view needs to be able to pass touch events to the controller, while the controller needs to pass what needs to be drawn to the view. Suggestions?
Edit:
After spending the better part of my Sunday, I appear to have found the answer to the second question.
Controllers are allowed to communicate directly with views. Views should use target/action to communicate with controllers. Or delegation.
- An app delegate, which doesn't do much.
- A view, responsible for drawing everything in the game and receiving touch events.
- A controller, responsible for processing the touch events and determining what needs to be drawn.
First question: are the responsibilities properly distributed between the two objects right now?
Second question: how should the view and controller communicate with each other? The view needs to be able to pass touch events to the controller, while the controller needs to pass what needs to be drawn to the view. Suggestions?
Edit:
After spending the better part of my Sunday, I appear to have found the answer to the second question.
Controllers are allowed to communicate directly with views. Views should use target/action to communicate with controllers. Or delegation.
Last edited: