private static void ArrangeServices() { var spriteBatchService = new SpriteBatchService(new SpriteBatch(CurrentGraphicsDevice)); var physicsService = new PhysicsService(); var settingsService = new SettingsService(); services = new Dictionary <Type, object>() { { typeof(IDrawableService), new DrawableService(spriteBatchService) }, { typeof(IContentManagerService), new ContentManagerService(CurrentContentManager) }, { typeof(ISpriteBatchService), spriteBatchService }, { typeof(IPhysicsService), physicsService }, { typeof(ISettingsService), settingsService }, { typeof(IGameControls), new GameControls(physicsService, settingsService) }, { typeof(IJudgeService), new JudgeService() } }; }
/// <summary> /// Draw this instance. /// </summary> /// <param name="gameTime">Game time.</param> public void Draw(GameTime gameTime) { var fps = (int)GlobalData ["FPS"]; SpriteBatchService.Begin(); TextBatchService.Begin(); SpriteBatchService.Draw(texture, position, source, globalColor, rotation, origin, 0.5f); for (var i = 0; i < 100; i++) { SpriteBatchService.Draw(texture2, position2, globalColor); } TextBatchService.DrawString(font, fps.ToString(), textPosition, globalColor); SpriteBatchService.End(); TextBatchService.End(); }