MVC with QGraphicsScene
-
So I am trying to implement MVC for a simple game. For the purpose of this imagine a simple game with a background and sprite that moves. I think I'm almost there with MVC, just not sure exactly where to put things.
-
Should my 'View' inherit or have as an attribute the QGraphicsScene?
-
From my understanding the view takes user input such as key presses. It is very tempting to move my character straight away. But is the correct way to send the event to the controller and let the controller decide what to do with it and then tell the view to actually move the character?
-
Would I be rite to say that the model would check that the player move is valid for the controller? How should this communication work? Should the controller make a method call on the model or should I use signals and slots?
I understand than the model and view notify the controller (observer) using signals. But how does the controller ask them. -
Finally, does the view contain all the actual 'things' in my game such as the player/character? How should the controller tell the character to move left 32 pixels. Should the view itself have movePlayerLeft() or should I dirrectly access my character and call methods on it like view->player->moveLeft() from the controller?
-