I’m currently in the process of building a game using the MVC pattern. I am also using full blitting for the first time and have come to a cross roads in my code. I’m questioning where the data for the blitting should go (ie spritesheet, rectangle data etc). I feel like it should be part of the Model but it seems a bit clumsy, when drawing the pixel data in the View, to keep referring to the model for everything (ie model.canvas.copyPixels(model.spriteSheet, model.rectsArray[model.index], model.point) ).
Has anyone had any experience setting up MVC for use with blitting? Would this be the best set up?
One the one hand, graphics data should clearly go in the view. However, it’s often also important for things like bounds checking, collision shapes, etc. Therefore I advise to encapsulate the graphics data in a class/module with two interfaces.