GameServices are devices which allow you make certain aspects of your game, such as a SpriteBatch, available to the entire game without creating multiple instances.


Adding a SpriteBatch to the GameServices

Services.AddService(typeof(SpriteBatch), spriteBatch);

Retrieving the SpriteBatch for use in a Class

SpriteBatch sBatch = (SpriteBatch)Game.Services.GetService(typeof(SpriteBatch));
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License