/// <summary> /// Binds this Root class to the graphics device from the game, and also sets the resolution and fullscreen/windowed mode. You must call Root.Init() before using any other Auxiliary functions. /// </summary> /// <param name="game">The primary Game class containg the SpriteBatch and GraphicsDeviceManager.</param> /// <param name="spriteBatch">The spriteBatch Auxiliary will use to draw. Auxiliary will assume all calls to its method (that could potentially draw something) are inside spriteBatch.Begin() and spriteBatch.End() calls.</param> /// <param name="graphics">The primary GraphicsDeviceManager from the Game class.</param> /// <param name="defaultResolution">The resolution to set the game to, or null to leave unchanged.</param> /// <param name="fullscreenMode">Whether to set the fullscreen mode or windowed mode.</param> public static void Init(Game game, SpriteBatch spriteBatch, GraphicsDeviceManager graphics, Resolution defaultResolution = null, bool fullscreenMode = false) { inGame = game; inSpriteBatch = spriteBatch; inGraphics = graphics; // Load basic textures Library = new Auxiliary.Library(game); Library.LoadBaseTextures(Execute_DoNotLoadXxlTextures); // Load graphical functions Auxiliary.Primitives.Init(spriteBatch, game.GraphicsDevice); // Load FPS Counter Root.inFpsCounter = new FpsupsCounter(); // Load keyboard input Root.KeyboardInput = new KeyboardInput(); // Set resolution if (defaultResolution != null) { SetResolution(defaultResolution); } Root.IsFullscreen = fullscreenMode; }
public static void Init(Game game, SpriteBatch spriteBatch, GraphicsDeviceManager graphics, Resolution defaultResolution = null, bool fullscreenMode = false) { inGame = game; inSpriteBatch = spriteBatch; inGraphics = graphics; // Load basic textures Library = new Auxiliary.Library(game); Library.LoadBaseTextures(EXECUTE_DoNotLoadXXLTextures); // Load graphical functions Auxiliary.Primitives.Init(spriteBatch, game.GraphicsDevice); // Load FPS Counter Root.inFPSCounter = new FPSUPSCounter(spriteBatch); // Load keyboard input Root.KeyboardInput = new KeyboardInput(inGame.Window.Handle); // Set resolution if (defaultResolution != null) { SetResolution(defaultResolution); } Root.IsFullscreen = fullscreenMode; // Load application-wide settings bool settingsLoaded = Cother.ApplicationSettingsManagement.LoadSettings(inGame); }