Example #1
0
        /// <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.ScaledMousePosition.ToPoint();

            _mouseInWorldCoords = mousePos - new Point(Core.GraphicsDevice.Viewport.X, Core.GraphicsDevice.Viewport.Y);
        }