I am having some architecture level problems with my application. I am new to OOP and am seeing some problems with how I have things layered in my code. This is kind of a general OOP problem, but I posted in here so that someone may be able to make specific references to XNA to help me with example fixes.
Here is an example of what I have:
Base class for handling sprites:
public Sprite(Texture2D spriteTexture, Vector2 spritePosition, Rectangle textureSourceRectangle)
This class handles the drawing of the texture I want from a sheet of textures given the parameters.
I want to inherit from this for all other classes that will be drawn to the screen. So I have something similar to:
public class DrawMe : Sprite
public DrawMe(Texture2D drawTextures, Vector2 position)
: base(drawTextures, position, drawMeSource)
The problem is with the DrawMe class, I want to be able to define that class as having a drawMeSource that is only for the DrawMe class. This way I can make a new class (DrawYou) that can define a different textureSourceRectangle. I'm not sure how to implement this. The base constructor gets called before the derived so Im not sure how to pass in a special value for drawMeSource without passing it from the constructor of DrawMe. I do not want to define the drawMeSource in the constructor of DrawMe because every time I need a new object of DrawMe I do not want to have to define the same source rectangle.
I feel like it should be a field and/or a property of the DrawMe class but how do I implement this to keep this structure?
If this is completely bad design by some opinion, what do you suggest a better architecture for handling this scenario is?
Thanks for any help,
John