Esempio n. 1
0
        /// <summary>
        /// Renders the dropdown's interactive elements.
        /// </summary>
        /// <param name="deltaTime">The change in time.</param>
        public override void RenderInteractiveElements(float deltaTime)
        {
            if (HasFocus)
            {
                api.Render.Render2DTexture(highlightTexture.TextureId, highlightBounds);
            }

            api.Render.Render2DTexturePremultipliedAlpha(
                currentValueTexture.TextureId,
                (int)Bounds.renderX,
                (int)Bounds.renderY + (Bounds.InnerHeight - valueHeight) / 2,
                valueWidth,
                valueHeight
                );

            double renderX = Bounds.renderX + Bounds.InnerWidth - arrowDownButtonReleased.Width;
            double renderY = Bounds.renderY;


            if (listMenu.IsOpened)
            {
                api.Render.Render2DTexturePremultipliedAlpha(arrowDownButtonPressed.TextureId, renderX, renderY, arrowDownButtonReleased.Width, arrowDownButtonReleased.Height);
            }
            else
            {
                api.Render.Render2DTexturePremultipliedAlpha(arrowDownButtonReleased.TextureId, renderX, renderY, arrowDownButtonReleased.Width, arrowDownButtonReleased.Height);
            }



            listMenu.RenderInteractiveElements(deltaTime);
        }
Esempio n. 2
0
        public override void RenderInteractiveElements(float deltaTime)
        {
            if (!firstFrameRendered && movable)
            {
                // In case the dialog somehow got out of bounds, make sure that its still movable by keeping it inside the window bounds
                double x = GameMath.Clamp((int)Bounds.ParentBounds.fixedX + Bounds.ParentBounds.absOffsetX, 0, api.Render.FrameWidth - 4) - Bounds.ParentBounds.absOffsetX;
                double y = GameMath.Clamp((int)Bounds.ParentBounds.fixedY + Bounds.ParentBounds.absOffsetY, 0, api.Render.FrameHeight - 4) - Bounds.ParentBounds.absOffsetY;

                api.Gui.SetDialogPosition(baseComposer.dialogName, new Vec2i((int)x, (int)y));

                Bounds.ParentBounds.fixedX = x;
                Bounds.ParentBounds.fixedY = y;
                Bounds.ParentBounds.CalcWorldBounds();


                firstFrameRendered = true;
            }

            int mouseX = api.Input.MouseX;
            int mouseY = api.Input.MouseY;

            if (closeIconRect.PointInside(mouseX - Bounds.absX, mouseY - Bounds.absY))
            {
                api.Render.Render2DTexturePremultipliedAlpha(closeIconHoverTexture.TextureId, Bounds.absX + closeIconRect.X - 3, Bounds.absY + closeIconRect.Y - 1, closeIconRect.Width + 4, closeIconRect.Height + 4, 200);
            }

            if (menuIconRect.PointInside(mouseX - Bounds.absX, mouseY - Bounds.absY) || listMenu.IsOpened)
            {
                api.Render.Render2DTexturePremultipliedAlpha(menuIconHoverTexture.TextureId, Bounds.absX + menuIconRect.X - 2, Bounds.absY + menuIconRect.Y - 1, menuIconRect.Width + 6, menuIconRect.Height + 6, 200);
            }

            listMenu.RenderInteractiveElements(deltaTime);
        }