Removed C89 errors and warnings and style issues

This commit is contained in:
vurtun 2016-05-10 14:05:55 +02:00
parent 7e96bfc586
commit b712a3a163

View File

@ -851,6 +851,8 @@ NK_API struct nk_rect nk_recti(int x, int y, int w, int h);
NK_API struct nk_rect nk_recta(struct nk_vec2 pos, struct nk_vec2 size);
NK_API struct nk_rect nk_rectv(const float *xywh);
NK_API struct nk_rect nk_rectiv(const int *xywh);
NK_API struct nk_vec2 nk_rect_pos(struct nk_rect);
NK_API struct nk_vec2 nk_rect_size(struct nk_rect);
/* string*/
NK_API int nk_strlen(const char *str);
@ -10190,13 +10192,6 @@ nk_input_is_mouse_released(const struct nk_input *i, enum nk_buttons id)
return (!i->mouse.buttons[id].down && i->mouse.buttons[id].clicked);
}
NK_API struct nk_vec2
nk_input_mouse_accumulated_drag_delta(const struct nk_input *i, enum nk_buttons id)
{
if (!i || !i->mouse.buttons[id].down) return nk_vec2(0.0f, 0.0f);
return nk_vec2_sub(i->mouse.pos, i->mouse.buttons[id].clicked_pos);
}
NK_API int
nk_input_is_key_pressed(const struct nk_input *i, enum nk_keys key)
{
@ -15899,30 +15894,32 @@ nk_panel_end(struct nk_context *ctx)
&scaler->data.image);
} else {
nk_fill_triangle(out, scaler_x + scaler_w, scaler_y, scaler_x + scaler_w,
scaler_y + scaler_h, scaler_x, scaler_y + scaler_h,
scaler->data.color);
scaler_y + scaler_h, scaler_x, scaler_y + scaler_h, scaler->data.color);
}
/* do window scaling logic */
/* do window scaling */
if (!(window->flags & NK_WINDOW_ROM)) {
struct nk_vec2 delta;
float prev_x = in->mouse.prev.x;
float prev_y = in->mouse.prev.y;
struct nk_vec2 window_size = style->window.min_size;
int incursor = NK_INBOX(prev_x,prev_y,scaler_x,scaler_y,scaler_w,scaler_h);
if (nk_input_is_mouse_down(in, NK_BUTTON_LEFT) &&
(incursor || window->scaling.active == nk_true)) {
(incursor || window->scaling.active == nk_true))
{
if(window->scaling.active == nk_false)
window->scaling.start_size = nk_rect_size(window->bounds);
window->scaling.active = nk_true;
struct nk_vec2 delta = nk_input_mouse_accumulated_drag_delta(in, NK_BUTTON_LEFT);
window->bounds.w = NK_MAX(window_size.x,
window->scaling.start_size.x + delta.x);
if (!in || !in->mouse.buttons[NK_BUTTON_LEFT].down)
delta = nk_vec2(0,0);
else delta = nk_vec2_sub(in->mouse.pos, in->mouse.buttons[NK_BUTTON_LEFT].clicked_pos);
window->bounds.w = NK_MAX(window_size.x, window->scaling.start_size.x + delta.x);
/* dragging in y-direction is only possible if static window */
if (!(layout->flags & NK_WINDOW_DYNAMIC))
window->bounds.h = NK_MAX(window_size.y,
window->scaling.start_size.y + delta.y);
window->bounds.h = NK_MAX(window->scaling.start_size.y + delta.y, window_size.y);
} else window->scaling.active = nk_false;
}
}