Example #1
0
        public static bool WidgetIsMouseClicked(this NuklearContext ctx, int btn)
        {
            var c      = new RectangleF();
            var v      = new RectangleF();
            var bounds = new RectangleF();

            if (ctx == null || ctx.current == null || ctx.active != ctx.current)
            {
                return(false);
            }
            c        = ctx.current.Layout.Clip;
            c.X      = (int)c.X;
            c.Y      = (int)c.Y;
            c.Width  = (int)c.Width;
            c.Height = (int)c.Height;
            ctx.LayoutPeek(ref bounds);
            RectangleF.nk_unify(ref v, ref c, bounds.X, bounds.Y, bounds.X + bounds.Width,
                                bounds.Y + bounds.Height);
            if (
                !!(bounds.X > c.X + c.Width || bounds.X + bounds.Width < c.X || bounds.Y > c.Y + c.Height ||
                   bounds.Y + bounds.Height < c.Y))
            {
                return(false);
            }
            return(nk_input_mouse_clicked(ctx.input, btn, bounds));
        }
Example #2
0
        public static RectangleF WidgetBounds(this NuklearContext ctx)
        {
            var bounds = new RectangleF();

            if (ctx == null || ctx.current == null)
            {
                return(new RectangleF(0, 0, 0, 0));
            }
            ctx.LayoutPeek(ref bounds);
            return(bounds);
        }
Example #3
0
        public static Vector2 WidgetSize(this NuklearContext ctx)
        {
            var bounds = new RectangleF();

            if (ctx == null || ctx.current == null)
            {
                return(new Vector2(0, 0));
            }
            ctx.LayoutPeek(ref bounds);
            return(new Vector2(bounds.Width, bounds.Height));
        }
Example #4
0
        public static float WidgetHeight(this NuklearContext ctx)
        {
            var bounds = new RectangleF();

            if (ctx == null || ctx.current == null)
            {
                return(0);
            }
            ctx.LayoutPeek(ref bounds);
            return(bounds.Height);
        }
Example #5
0
        public static Vector2 WidgetPosition(this NuklearContext ctx)
        {
            var bounds = new RectangleF();

            if (ctx == null || ctx.current == null)
            {
                return(new Vector2(0, 0));
            }
            ctx.LayoutPeek(ref bounds);
            return(new Vector2(bounds.X, bounds.Y));
        }