IDrawable.Draw(GameTime gt) to Draw(GameTime gt, SpriteBatch sb)?

Hi, I’ve been poking around MonoGame over the summer, and recently came across the IGameComponent interface. I want to try implementing this, along with IUpdatable and IDrawable in my 2D game, but I have no idea how to pass in the SpriteBatch to the GameComponents like I’ve always done. Any ideas/workarounds/suggestions?

You can simply have a field that stores a reference to your SpriteBatch instance and can be set through your GameComponent constructor, or alternatively a get/set property.

Thanks for the quick reply. So sending it separately is really the only way to do it?

Definitely not, but its one solution, you can also create a static class that has all the devices that you can access anywhere in your entire application without creating a handle reference to any objects that needs to access devices…

public static class GlobalDevices
    public static GraphicsDeviceManager _DeviceGraphics;
    public static SpriteBatch           _Device2D;  
    public static GraphicsDevice        _Device3D;
    public static BasicEffect           _DeviceBasicFX;    
    public static ContentManger         _DeviceContent;

    // do initialization 
    // do disposing