/// <summary> /// Register Multiform classes to the engine's MultiformManager. /// </summary> /// <param name="multiforms"></param> private void _RegisterMultiforms(object[] multiforms) { var i = 0; foreach (var multiform in multiforms) { if (multiform is Multiform) { MultiformManager.RegisterMultiform((Multiform)multiform); } else if (multiform is Type) { MultiformManager.RegisterMultiform((Type)multiform); } else { throw new MultiformRegistrationException( String.Format( "When registering multiforms, the given objects must either be a multiform " + "instance or a multiform type. The object at index {0} was neither (received {1}).", i, multiform)); } i++; } }
/// <summary> /// Indicate what multiform to construct upon game startup. /// </summary> /// <param name="multiform"></param> public static void StartWith(string multiformName) { if (!SetupCalled) { throw new EngineSetupException( "Must call Engine.Setup before call to Engine.StartWith."); } MultiformManager.Construct(multiformName); }
/// <summary> /// Indicate what multiform to construct upon game startup. /// </summary> /// <param name="multiform"></param> public static void StartWith(string multiformName) { if (!BeginCalled) { throw new EngineSetupException( "Must call Engine.Setup before call to Engine.StartWith."); } MultiformManager.Activate(null, multiformName, new MultiformConstructionArgs(null)); }
/// <summary> /// Required override of Monogame.Game.Initialize. Not actually part of the Artemis Engine. /// </summary> protected override sealed void Initialize() { base.Initialize(); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); _RenderPipeline = new RenderPipeline(spriteBatch, GraphicsDevice, graphics); _MultiformManager = new MultiformManager(); _GameTimer = new GlobalTimer(); _GameUpdater = new GlobalUpdater(); _Mouse = new MouseInput(); _Keyboard = new KeyboardInput(); }
private ArtemisEngine(GameProperties properties, Action initializer) : base() { this.initializer = initializer; Initialized = false; _GameProperties = properties; gameKernel = new GameKernel(this); _MultiformManager = new MultiformManager(); _GameTimer = new GlobalTimer(); _GameUpdater = new GlobalUpdater(); _Mouse = new MouseInput(); _Keyboard = new KeyboardInput(); }
private ArtemisEngine(Action initializer) : base() { this.initializer = initializer; Initialized = false; gameKernel = new GameKernel( this, GameConstants.ContentFolder, GameConstants.FixedTimeStep, GameConstants.DefaultFrameRate); // This should really be called *before* the ArtemisEngine singleton instance // is even created, but right now we have to call it after created the gameKernel // since gameKernel.FrameRate gets changed by an event that gets raised when the // "FrameRate" option gets changed in UserOptions (which will throw a NullReferenceException // if gameKernel is null). UserOptions.Read(); _MultiformManager = new MultiformManager(); _GameTimer = new GlobalTimer(); _GameUpdater = new GlobalUpdater(); _Mouse = new MouseInput(); _Keyboard = new KeyboardInput(); }