/// <summary> /// begins an IMGUI window specifying where and how large it should be. If you are not using IMGUI in world space (for example, inside /// a Scene with a scaled resolution policy) passing false for useRawMousePosition will use the Input.scaledMousePosition. /// </summary> /// <param name="x">The x coordinate.</param> /// <param name="y">The y coordinate.</param> /// <param name="width">Width.</param> /// <param name="height">Height.</param> /// <param name="useRawMousePosition">If set to <c>true</c> use raw mouse position.</param> public static void BeginWindow(float x, float y, float width, float height, bool useRawMousePosition = true) { _batcher.Begin(); _batcher.DrawRect(x, y, width, height, WINDOW_COLOR); _elementX = x + ELEMENT_PADDING; _lastY = y; _windowWidth = width; _windowHeight = height; _elementWidth = _windowWidth - 2f * ELEMENT_PADDING; var mousePos = useRawMousePosition ? Input.RawMousePosition : Input.MousePosition.ToPoint(); _mouseInWorldCoords = mousePos - new Point(Core.GraphicsDevice.Viewport.X, Core.GraphicsDevice.Viewport.Y); }
internal static void Flush(Batcher batcher) { for (int i = 0; i < DeferredCount; i++) { var evt = DeferredEvents[i]; switch (evt.Type) { case 1: batcher.DrawString(Theme.DeveloperFont, evt.Message, evt.Position, evt.Color); break; case 2: batcher.DrawRect(evt.Rect, evt.Color); break; case 3: batcher.DrawHollowRect(evt.Rect, evt.Color, evt.Size); break; case 4: batcher.DrawPixel(evt.Position, evt.Color, evt.Size); break; case 5: batcher.DrawCircle(evt.Position, evt.Radius, evt.Color, evt.Size); break; case 6: batcher.DrawLine(evt.Position, evt.End, evt.Color, evt.Size); break; } } stringSplat.X = messagePadding; stringSplat.Y = messagePadding; DeferredCount = 0; }