protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); // TODO: Add your drawing code here _grid.Draw(); // Draw model DrawModel(); //var effect = (BasicEffect)meshPart.Effect; //effect.EnableDefaultLighting(); //effect.PreferPerPixelLighting = true; //effect.World = transforms[mesh.ParentBone.Index] * wworld; //effect.View = _renderer.View; //effect.Projection = _renderer.Projection; //spriteBatch.Begin(); //spriteBatch.Draw(_icon, Vector2.Zero); //spriteBatch.End(); // Call BeforeLayout first to set things up _imGuiRenderer.BeforeLayout(gameTime); // Draw our UI ImGuiLayout(); // Call AfterLayout now to finish up and draw all the things _imGuiRenderer.AfterLayout(); base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.SetRenderTarget(RenderTarget); GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise; GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp; GraphicsDevice.SamplerStates[1] = SamplerState.PointClamp; Mesh.ResetStats(); SkyModule.Draw(gameTime); ChunkModule.Draw(gameTime); HighlightModule.Draw(gameTime); HudModule.Draw(gameTime); ChatModule.Draw(gameTime); WindowModule.Draw(gameTime); DebugInfoModule.Draw(gameTime); _imgui.BeforeLayout(gameTime); ImGuiLayout(); _imgui.AfterLayout(); GraphicsDevice.SetRenderTarget(null); SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque); SpriteBatch.Draw(RenderTarget, Vector2.Zero, Color.White); SpriteBatch.End(); base.Draw(gameTime); }
public override void Draw(GameTime gameTime) { _imGuiRenderer.BeforeLayout(gameTime); ImGui.Text("Hello, world!"); ImGui.SliderFloat("float", ref f, 0.0f, 1.0f, string.Empty, 1f); ImGui.ColorEdit3("clear color", ref clear_color); if (ImGui.Button("Test Window")) { _showTestWindow = !_showTestWindow; } ImGui.Text(string.Format("Application average {0:F3} ms/frame ({1:F1} FPS)", 1000f / ImGui.GetIO().Framerate, ImGui.GetIO().Framerate)); ImGui.InputText("Text input", _textBuffer, 100); ImGui.Text("Texture sample"); /*ImGui.Image(_imGuiTexture, * new System.Numerics.Vector2(300, 150), * System.Numerics.Vector2.Zero, * System.Numerics.Vector2.One, * System.Numerics.Vector4.One, * System.Numerics.Vector4.One);*/ if (_showTestWindow) { ImGui.ShowDemoWindow(ref _showTestWindow); } _imGuiRenderer.AfterLayout(); }
public void Render() { _imGuiRenderer.BeforeLayout(_gameClock.GameTime); RenderDock(); for (var i = 0; i < _windows.Count; i++) { _windows[i].Render(); } _imGuiRenderer.AfterLayout(); }
/// <summary> /// Draw the sample explorer. /// </summary> /// <param name="gameTime">Holds the time state of a <see cref="Game" />.</param> public void DrawSampleExplorer(GameTime gameTime) { // Call BeforeLayout first to set things up ImGuiRenderer.BeforeLayout(gameTime); // Draw our UI ImGuiLayout(SamplesByCategory); // Call AfterLayout now to finish up and draw all the things ImGuiRenderer.AfterLayout(); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); // TODO: Add your drawing code here imGuiRenderer.BeforeLayout(gameTime); ImGui.PushFont(font); ImGui.ShowDemoWindow(); imGuiRenderer.AfterLayout(); base.Draw(gameTime); }
public override void Draw(GameTime gameTime) { _graphicsDevice.SetRenderTarget(null); _graphicsDevice.Clear(ClearOptions.DepthBuffer, Color.White, 1, 0); _imGuiTexture[0] = _imGuiRenderer.BindTexture(ShaderManager.Instance.Color); _imGuiTexture[1] = _imGuiRenderer.BindTexture(ShaderManager.Instance.Depth); _imGuiTexture[2] = _imGuiRenderer.BindTexture(ShaderManager.Instance.LightInfo); _imGuiTexture[3] = _imGuiRenderer.BindTexture(ShaderManager.Instance.Normal); _imGuiTexture[4] = _imGuiRenderer.BindTexture(ShaderManager.Instance.Lights); _imGuiTexture[5] = _imGuiRenderer.BindTexture(ShaderManager.Instance.ShadowMap); _imGuiTexture[6] = _imGuiRenderer.BindTexture(ShaderManager.Instance.SSAO); var viewports = _viewportRenderSystem.GetViewports(); _viewPortTextures = new IntPtr[viewports.Length]; for (var i = 0; i < viewports.Length; i++) { _viewPortTextures[i] = _imGuiRenderer.BindTexture(viewports[i].GetViewport()); } // Call BeforeLayout first to set things up _imGuiRenderer.BeforeLayout(gameTime); // Draw our UI ImGuiLayout(); // Call AfterLayout now to finish up and draw all the things _imGuiRenderer.AfterLayout(); _imGuiRenderer.UnbindTexture(_imGuiTexture[0]); _imGuiRenderer.UnbindTexture(_imGuiTexture[1]); _imGuiRenderer.UnbindTexture(_imGuiTexture[2]); _imGuiRenderer.UnbindTexture(_imGuiTexture[3]); _imGuiRenderer.UnbindTexture(_imGuiTexture[4]); _imGuiRenderer.UnbindTexture(_imGuiTexture[5]); _imGuiRenderer.UnbindTexture(_imGuiTexture[6]); for (var i = 0; i < viewports.Length; i++) { _imGuiRenderer.UnbindTexture(_viewPortTextures[i]); } }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); // Something may have altered the rendering state, and this might cause ImGui's textures to render // with artifacts. So we want to reset the render state just for ImGui var oldSamplerState = GraphicsDevice.SamplerStates[0]; GraphicsDevice.SamplerStates[0] = new SamplerState(); _imGuiRenderer.BeforeLayout(gameTime); // Must be called prior to calling any ImGui controls ImGui.ShowDemoWindow(); // Render the built in demonstration window _imGuiRenderer.AfterLayout(); // Must be called after ImGui control calls // Reset the sample state to what was originally set GraphicsDevice.SamplerStates[0] = oldSamplerState; base.Draw(gameTime); }
private void DrawUi(GameTime gameTime) { _imguiRenderer.BeforeLayout(gameTime); // Draw viewport overlays if (!string.IsNullOrEmpty(hoveredentityId)) { DrawSpriteBounds(hoveredentityId, Color.CornflowerBlue.PackedValue); } else if (!string.IsNullOrEmpty(selectedEntityId)) { DrawSpriteBounds(selectedEntityId, Color.GreenYellow.PackedValue); } ImGui.Begin("timeline"); ImGuiEx.DrawUiTimeline(_state.Animator); ImGui.End(); var hierarchyWindowWidth = 256; ImGui.SetNextWindowPos(new NVector2(GraphicsDevice.Viewport.Width - hierarchyWindowWidth, 0), ImGuiCond.FirstUseEver); ImGui.SetNextWindowSize(NVector2.UnitX * hierarchyWindowWidth + NVector2.UnitY * GraphicsDevice.Viewport.Height, ImGuiCond.FirstUseEver); ImGui.Begin("Management"); { DrawUiActions(); DrawUiHierarchyFrame(); DrawUiProperties(); } ImGui.End(); _imguiRenderer.AfterLayout(); if (ImGui.IsWindowHovered(ImGuiHoveredFlags.AnyWindow)) { ImGui.CaptureKeyboardFromApp(); ImGui.CaptureMouseFromApp(); } }
/// <summary> /// Draw the scene. /// </summary> public override void Draw() { //Render areas. WindowManager.RenderAreas(); //Rebuild fonts. if (Style.FontRebuildNeeded) { Helper.ImGuiRenderer.RebuildFontAtlas(); Style.FontRebuildNeeded = false; } //Wallpapers. Wallpapers.Draw(); Helper.SpriteBatch.End(); Helper.SpriteBatch.Begin(); //Run data before layout. ImGuiRenderer.BeforeLayout(Helper.Time); //Set up font. ImGui.PushFont(Style.FontPtr); //Debug. if (Helper.DebugMode) { ImGui.ShowDemoWindow(); } //Main menu. DrawMainMenu(); //Draw windows. WindowManager.Draw(); //Run data after layout. ImGuiRenderer.AfterLayout(); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(backgroundColor); guiEngine.DrawGameComponentBeforeGUI(); // TODO: Add your drawing code here imGuiRenderer.BeforeLayout(gameTime); app.Draw(); imGuiRenderer.AfterLayout(); spriteBatch.Begin(); if (imageLoadQueue.Count != 0) { List <ImageSource> removeFromQueue = new List <ImageSource>(); lock (imageLoadQueue) { foreach (ImageSource image in imageLoadQueue) { image.Texture = imGuiRenderer.BindTexture((Texture2D)image.MGTexture); removeFromQueue.Add(image); } foreach (ImageSource image in removeFromQueue) { imageLoadQueue.Remove(image); } } } spriteBatch.End(); guiEngine.DrawGameComponentAfterGUI(); base.Draw(gameTime); }
public void OnUpdate(GraphicsDevice gfxDevice, GameTime gameTime) { gfxDevice.Clear(ClearOptions.DepthBuffer, Color.Black, 0.0f, 1); Rendering.ChangeDrawCall(SpriteSortMode.Immediate, null, BlendState.AlphaBlend); ImGuiRenderer.BeforeLayout(gameTime); EditorGUI.Paint(); ImGuiRenderer.AfterLayout(); // TEST: Create game instance. // TODO: Implement properly. Needs to dynamically open any type of SE Game. if (InputManager.KeyCodePressed(Microsoft.Xna.Framework.Input.Keys.F2)) { SceneManager.CurrentScene.Unload(); Game gameInstance = (Game)Activator.CreateInstance(typeof(SEDemos.Game), null, this, this); gameInstance.KeepWindowOnDipose = true; // Hook into the game instance. OnUpdate will be called from this instance, // until the game exited. gameInstance.Run(); ChangeInstance(null); //Exit(); // TODO: Exit and reopen program. } // Test reload. // This is how hot reloading of code will work. Even though it isn't hot reloading. // Detect change -> Save editor state -> Close -> Reopen -> Restore editor state. if (InputManager.KeyCodePressed(Microsoft.Xna.Framework.Input.Keys.F9)) { Process.Start(AppDomain.CurrentDomain.BaseDirectory + "/SEEditor.exe"); Thread.Sleep(2000); Environment.Exit(-1); } }
public void Visualize(ImGuiRenderer renderer, GameTime gameTime) { renderer.BeforeLayout(gameTime); ImGui.ShowDemoWindow(); ImGui.Begin("Visuals"); foreach (var kv in _attachables) { if (ImGui.TreeNode(kv.Key)) { kv.Value.Visualize(renderer); foreach (var kv2 in kv.Value.Attach().Map) { ImGui.Text($"{kv2.Key}: {kv2.Value}"); } } } ImGui.End(); renderer.AfterLayout(); }
public static void End() { Renderer.AfterLayout(); }
public void Draw(GameTime time) { _renderer.BeforeLayout(time); ImGui.Text("Hello world!"); _renderer.AfterLayout(); }