public void Draw() { Game1.graphicsDevice.SetRenderTarget(null); Game1.graphicsDevice.Clear(Color.Black); #if !EDITOR //try #endif { if (!Loading && MyScene != null) { #if EDITOR && WINDOWS Render.RenderTime.Reset(); #endif if (!MyScene.CanLoad) { MyScene.Load(); } #if !EDITOR if (MyScene.WindowSize.X != Game1.ResolutionX || MyScene.WindowSize.Y != Game1.ResolutionY) { MyScene.SetWindowSize(new Vector2(Game1.ResolutionX, Game1.ResolutionY)); } #endif #if EDITOR if (MyScene.WindowSize.X != Game1.self.Window.ClientBounds.Width || MyScene.WindowSize.Y != Game1.self.Window.ClientBounds.Height) { MyScene.SetWindowSize(new Vector2(Game1.self.Window.ClientBounds.Width, Game1.self.Window.ClientBounds.Height)); } #endif #if WINDOWS && EDITOR if (!LevelForEditing || Game1.self.IsActive) #endif MyScene.PreDraw(); MyScene.Draw2D(GameObjectTag.SceneDrawScene); Game1.graphicsDevice.SetRenderTarget(null); MasterManager.SetViewportToFullscreen(); } } #if !EDITOR //catch (Exception e) //{ MasterManager.e = e; } #endif loadingScreen.Draw(Math.Min(LoadingProgressBar, LoadingProgressBarMax), LoadingProgressBarMax, LoadingProgressBarAlpha); PlayerProfile.Draw(); }
private SceneObject AddScene(SceneObject scene) { if (Scenes.Count == 0) { StartingScene = scene; } if (!Scenes.Contains(scene)) { Scenes.AddFirst(scene); } Level.ObjectCreate(scene, null, this); if (!scene.Created) { scene.SetParents(this, null); scene.Create(); } MyScene = scene; #if EDITOR && WINDOWS if (MySceneHieararchy != null) { MySceneHieararchy.Add(scene); } ModifyWindows(); if (LevelForEditing) { scene.Load(); } #endif return(scene); }