public static int nk_toggle_behavior(nk_input _in_, nk_rect select, ref uint state, int active)
        {
            if (((state) & NK_WIDGET_STATE_MODIFIED) != 0)
            {
                (state) = (uint)(NK_WIDGET_STATE_INACTIVE | NK_WIDGET_STATE_MODIFIED);
            }
            else
            {
                (state) = (uint)(NK_WIDGET_STATE_INACTIVE);
            }
            if ((nk_button_behavior(ref state, (nk_rect)(select), _in_, (int)(NK_BUTTON_DEFAULT))) != 0)
            {
                state  = (uint)(NK_WIDGET_STATE_ACTIVE);
                active = active != 0 ? 0 : 1;
            }

            if (((state & NK_WIDGET_STATE_HOVER) != 0) && (nk_input_is_mouse_prev_hovering_rect(_in_, (nk_rect)(select)) == 0))
            {
                state |= (uint)(NK_WIDGET_STATE_ENTERED);
            }
            else if ((nk_input_is_mouse_prev_hovering_rect(_in_, (nk_rect)(select))) != 0)
            {
                state |= (uint)(NK_WIDGET_STATE_LEFT);
            }
            return((int)(active));
        }
Exemplo n.º 2
0
        public static nk_vec2 nk_rect_size(nk_rect r)
        {
            nk_vec2 ret = new nk_vec2();

            ret.x = (float)(r.w);
            ret.y = (float)(r.h);
            return((nk_vec2)(ret));
        }
Exemplo n.º 3
0
        public static nk_vec2 nk_rect_pos(nk_rect r)
        {
            nk_vec2 ret = new nk_vec2();

            ret.x = (float)(r.x);
            ret.y = (float)(r.y);
            return((nk_vec2)(ret));
        }
Exemplo n.º 4
0
 public static void nk_unify(ref nk_rect clip, ref nk_rect a, float x0, float y0, float x1, float y1)
 {
     clip.x = (float)((a.x) < (x0) ? (x0) : (a.x));
     clip.y = (float)((a.y) < (y0) ? (y0) : (a.y));
     clip.w = (float)(((a.x + a.w) < (x1) ? (a.x + a.w) : (x1)) - clip.x);
     clip.h = (float)(((a.y + a.h) < (y1) ? (a.y + a.h) : (y1)) - clip.y);
     clip.w = (float)((0) < (clip.w) ? (clip.w) : (0));
     clip.h = (float)((0) < (clip.h) ? (clip.h) : (0));
 }
Exemplo n.º 5
0
 public static nk_rect nk_pad_rect(nk_rect r, nk_vec2 pad)
 {
     r.w  = (float)((r.w) < (2 * pad.x) ? (2 * pad.x) : (r.w));
     r.h  = (float)((r.h) < (2 * pad.y) ? (2 * pad.y) : (r.h));
     r.x += (float)(pad.x);
     r.y += (float)(pad.y);
     r.w -= (float)(2 * pad.x);
     r.h -= (float)(2 * pad.y);
     return((nk_rect)(r));
 }
        public static int nk_input_any_mouse_click_in_rect(nk_input _in_, nk_rect b)
        {
            int i;
            int down = (int)(0);

            for (i = (int)(0); (i) < (NK_BUTTON_MAX); ++i)
            {
                down = (int)(((down) != 0) || ((nk_input_is_mouse_click_in_rect(_in_, (int)(i), (nk_rect)(b))) != 0) ? 1 : 0);
            }
            return((int)(down));
        }
 public static int nk_input_is_mouse_prev_hovering_rect(nk_input i, nk_rect rect)
 {
     if (i == null)
     {
         return((int)(nk_false));
     }
     return((((rect.x) <= (i.mouse.prev.x)) && ((i.mouse.prev.x) < (rect.x + rect.w))) &&
            (((rect.y) <= (i.mouse.prev.y)) && ((i.mouse.prev.y) < (rect.y + rect.h)))
                         ? 1
                         : 0);
 }
Exemplo n.º 8
0
        public static nk_rect nk_shrink_rect_(nk_rect r, float amount)
        {
            nk_rect res = new nk_rect();

            r.w   = (float)((r.w) < (2 * amount) ? (2 * amount) : (r.w));
            r.h   = (float)((r.h) < (2 * amount) ? (2 * amount) : (r.h));
            res.x = (float)(r.x + amount);
            res.y = (float)(r.y + amount);
            res.w = (float)(r.w - 2 * amount);
            res.h = (float)(r.h - 2 * amount);
            return((nk_rect)(res));
        }
        public static int nk_input_has_mouse_click_down_in_rect(nk_input i, int id, nk_rect b, int down)
        {
            nk_mouse_button *btn;

            if (i == null)
            {
                return((int)(nk_false));
            }
            btn = (nk_mouse_button *)i.mouse.buttons + id;
            return
                ((int)(((nk_input_has_mouse_click_in_rect(i, (int)(id), (nk_rect)(b))) != 0) && ((btn->down) == (down)) ? 1 : 0));
        }
 public static int nk_input_mouse_clicked(nk_input i, int id, nk_rect rect)
 {
     if (i == null)
     {
         return((int)(nk_false));
     }
     if (nk_input_is_mouse_hovering_rect(i, (nk_rect)(rect)) == 0)
     {
         return((int)(nk_false));
     }
     return((int)(nk_input_is_mouse_click_in_rect(i, (int)(id), (nk_rect)(rect))));
 }
        public static int nk_input_has_mouse_click_in_rect(nk_input i, int id, nk_rect b)
        {
            nk_mouse_button *btn;

            if (i == null)
            {
                return((int)(nk_false));
            }
            btn = (nk_mouse_button *)i.mouse.buttons + id;
            if (
                !((((b.x) <= (btn->clicked_pos.x)) && ((btn->clicked_pos.x) < (b.x + b.w))) &&
                  (((b.y) <= (btn->clicked_pos.y)) && ((btn->clicked_pos.y) < (b.y + b.h)))))
            {
                return((int)(nk_false));
            }
            return((int)(nk_true));
        }
Exemplo n.º 12
0
        public static int nk_widget(nk_rect *bounds, nk_context ctx)
        {
            nk_rect   c = new nk_rect();
            nk_rect   v = new nk_rect();
            nk_window win;
            nk_panel  layout;
            nk_input  _in_;

            if (((ctx == null) || (ctx.current == null)) || (ctx.current.layout == null))
            {
                return((int)(NK_WIDGET_INVALID));
            }
            nk_panel_alloc_space(bounds, ctx);
            win       = ctx.current;
            layout    = win.layout;
            _in_      = ctx.input;
            c         = (nk_rect)(layout.clip);
            bounds->x = ((float)((int)(bounds->x)));
            bounds->y = ((float)((int)(bounds->y)));
            bounds->w = ((float)((int)(bounds->w)));
            bounds->h = ((float)((int)(bounds->h)));
            c.x       = ((float)((int)(c.x)));
            c.y       = ((float)((int)(c.y)));
            c.w       = ((float)((int)(c.w)));
            c.h       = ((float)((int)(c.h)));
            nk_unify(ref v, ref c, (float)(bounds->x), (float)(bounds->y), (float)(bounds->x + bounds->w),
                     (float)(bounds->y + bounds->h));
            if (
                !(!(((((bounds->x) > (c.x + c.w)) || ((bounds->x + bounds->w) < (c.x))) || ((bounds->y) > (c.y + c.h))) ||
                    ((bounds->y + bounds->h) < (c.y)))))
            {
                return((int)(NK_WIDGET_INVALID));
            }
            if (
                !((((v.x) <= (_in_.mouse.pos.x)) && ((_in_.mouse.pos.x) < (v.x + v.w))) &&
                  (((v.y) <= (_in_.mouse.pos.y)) && ((_in_.mouse.pos.y) < (v.y + v.h)))))
            {
                return((int)(NK_WIDGET_ROM));
            }
            return((int)(NK_WIDGET_VALID));
        }
Exemplo n.º 13
0
        public static void nk_triangle_from_direction(nk_vec2 *result, nk_rect r, float pad_x, float pad_y, int direction)
        {
            float w_half;
            float h_half;

            r.w    = (float)((2 * pad_x) < (r.w) ? (r.w) : (2 * pad_x));
            r.h    = (float)((2 * pad_y) < (r.h) ? (r.h) : (2 * pad_y));
            r.w    = (float)(r.w - 2 * pad_x);
            r.h    = (float)(r.h - 2 * pad_y);
            r.x    = (float)(r.x + pad_x);
            r.y    = (float)(r.y + pad_y);
            w_half = (float)(r.w / 2.0f);
            h_half = (float)(r.h / 2.0f);
            if ((direction) == (NK_UP))
            {
                result[0] = (nk_vec2)(nk_vec2_((float)(r.x + w_half), (float)(r.y)));
                result[1] = (nk_vec2)(nk_vec2_((float)(r.x + r.w), (float)(r.y + r.h)));
                result[2] = (nk_vec2)(nk_vec2_((float)(r.x), (float)(r.y + r.h)));
            }
            else if ((direction) == (NK_RIGHT))
            {
                result[0] = (nk_vec2)(nk_vec2_((float)(r.x), (float)(r.y)));
                result[1] = (nk_vec2)(nk_vec2_((float)(r.x + r.w), (float)(r.y + h_half)));
                result[2] = (nk_vec2)(nk_vec2_((float)(r.x), (float)(r.y + r.h)));
            }
            else if ((direction) == (NK_DOWN))
            {
                result[0] = (nk_vec2)(nk_vec2_((float)(r.x), (float)(r.y)));
                result[1] = (nk_vec2)(nk_vec2_((float)(r.x + r.w), (float)(r.y)));
                result[2] = (nk_vec2)(nk_vec2_((float)(r.x + w_half), (float)(r.y + r.h)));
            }
            else
            {
                result[0] = (nk_vec2)(nk_vec2_((float)(r.x), (float)(r.y + h_half)));
                result[1] = (nk_vec2)(nk_vec2_((float)(r.x + r.w), (float)(r.y)));
                result[2] = (nk_vec2)(nk_vec2_((float)(r.x + r.w), (float)(r.y + r.h)));
            }
        }
Exemplo n.º 14
0
 public static void nk_push_scissor(nk_command_buffer *cbuf, nk_rect r) => _nk_push_scissor(cbuf, r);
Exemplo n.º 15
0
 public static void nk_draw_text(nk_command_buffer *cbuf, nk_rect r, byte *text, int len, nk_user_font *userfont, nk_color col, nk_color col2) => _nk_draw_text(cbuf, r, text, len, userfont, col, col2);
Exemplo n.º 16
0
 public static void nk_draw_image(nk_command_buffer *cbuf, nk_rect r, nk_image *img, nk_color col) => _nk_draw_image(cbuf, r, img, col);
Exemplo n.º 17
0
 public static void nk_fill_circle(nk_command_buffer *cbuf, nk_rect r, nk_color col) => _nk_fill_circle(cbuf, r, col);
Exemplo n.º 18
0
 public static void nk_fill_rect_multi_color(nk_command_buffer *cbuf, nk_rect r, nk_color left, nk_color top, nk_color right, nk_color bottom) => _nk_fill_rect_multi_color(cbuf, r, left, top, right, bottom);
Exemplo n.º 19
0
 public static void nk_fill_rect(nk_command_buffer *cbuf, nk_rect r, float rounding, nk_color col) => _nk_fill_rect(cbuf, r, rounding, col);
Exemplo n.º 20
0
 public static void nk_stroke_circle(nk_command_buffer *cbuf, nk_rect r, float line_thickness, nk_color col) => _nk_stroke_circle(cbuf, r, line_thickness, col);
Exemplo n.º 21
0
 public static void nk_stroke_rect(nk_command_buffer *cbuf, nk_rect r, float rounding, float line_thickness, nk_color col) => _nk_stroke_rect(cbuf, r, rounding, line_thickness, col);
Exemplo n.º 22
0
 public static void nk_draw_list_add_image(nk_draw_list *dl, nk_image texture, nk_rect rect, nk_color col) => _nk_draw_list_add_image(dl, texture, rect, col);
Exemplo n.º 23
0
 public static void nk_draw_list_fill_rect(nk_draw_list *dl, nk_rect rect, nk_color col, float rounding) => _nk_draw_list_fill_rect(dl, rect, col, rounding);
Exemplo n.º 24
0
 public static void nk_push_custom(nk_command_buffer *cbuf, nk_rect r, nk_command_custom_callback cb, nk_handle userdata) => _nk_push_custom(cbuf, r, cb, userdata);
Exemplo n.º 25
0
 public static void nk_draw_list_stroke_rect(nk_draw_list *dl, nk_rect rect, nk_color col, float rounding, float thickness) => _nk_draw_list_stroke_rect(dl, rect, col, rounding, thickness);
Exemplo n.º 26
0
 public static nk_rect nk_layout_space_rect_to_local(nk_context *ctx, nk_rect r) => _nk_layout_space_rect_to_local(ctx, r);
Exemplo n.º 27
0
 public static void nk_draw_list_fill_rect_multi_color(nk_draw_list *dl, nk_rect rect, nk_color left, nk_color top, nk_color right, nk_color bottom) => _nk_draw_list_fill_rect_multi_color(dl, rect, left, top, right, bottom);
Exemplo n.º 28
0
 public static void nk_layout_space_push(nk_context *ctx, nk_rect bounds) => _nk_layout_space_push(ctx, bounds);
Exemplo n.º 29
0
 public static void nk_draw_list_add_text(nk_draw_list *dl, nk_user_font *userfont, nk_rect rect, byte *text, int len, float font_height, nk_color col) => _nk_draw_list_add_text(dl, userfont, rect, text, len, font_height, col);
Exemplo n.º 30
0
 public static int nk_begin(nk_context *context, byte *title, nk_rect bounds, uint flags_nkflags) => _nk_begin(context, title, bounds, flags_nkflags);