瀏覽代碼

Fixed #545 with window pos/size modifier

vurtun 8 年之前
父節點
當前提交
7eb08b8bcf
共有 2 個文件被更改,包括 11 次插入12 次删除
  1. 1 0
      CHANGELOG.txt
  2. 10 12
      nuklear.h

+ 1 - 0
CHANGELOG.txt

@@ -11,6 +11,7 @@
 
 Changes:
 --------
+- 2017/11/07 (2.00.3) - Fixed window size and position modifier functions
 - 2017/09/14 (2.00.2) - Fixed nk_edit_buffer and nk_edit_focus behavior
 - 2017/09/14 (2.00.1) - Fixed window closing behavior
 - 2017/09/14 (2.00.0) - BREAKING CHANGE: Modifing window position and size funtions now

+ 10 - 12
nuklear.h

@@ -18965,11 +18965,10 @@ nk_window_set_position(struct nk_context *ctx,
     const char *name, struct nk_vec2 pos)
 {
     struct nk_rect bounds;
-    bounds.x = pos.x;
-    bounds.y = pos.y;
-    bounds.w = ctx->current->bounds.w;
-    bounds.h = ctx->current->bounds.h;
-    nk_window_set_bounds(ctx, name, bounds);
+    struct nk_window *win = nk_window_find(ctx, name);
+    if (!win) return;
+    win->bounds.x = pos.x;
+    win->bounds.y = pos.y;
 }
 
 NK_API void
@@ -18977,11 +18976,10 @@ nk_window_set_size(struct nk_context *ctx,
     const char *name, struct nk_vec2 size)
 {
     struct nk_rect bounds;
-    bounds.x = ctx->current->bounds.x;
-    bounds.y = ctx->current->bounds.y;
-    bounds.w = size.x;
-    bounds.h = size.y;
-    nk_window_set_bounds(ctx, name, bounds);
+    struct nk_window *win = nk_window_find(ctx, name);
+    if (!win) return;
+    win->bounds.w = size.x;
+    win->bounds.h = size.y;
 }
 
 NK_API void
@@ -21268,8 +21266,8 @@ nk_edit_string(struct nk_context *ctx, nk_flags flags,
         win->edit.sel_start = edit->select_start;
         win->edit.sel_end = edit->select_end;
         win->edit.mode = edit->mode;
-        win->edit.scrollbar.x = (nk_ushort)edit->scrollbar.x;
-        win->edit.scrollbar.y = (nk_ushort)edit->scrollbar.y;
+        win->edit.scrollbar.x = (nk_uint)edit->scrollbar.x;
+        win->edit.scrollbar.y = (nk_uint)edit->scrollbar.y;
     }
     return state;
 }