Browse Source

Rename UpdateNuklearCustom() to UpdateNuklearEx()

Rob Loach 1 year ago
parent
commit
a740edbb4a
3 changed files with 8 additions and 13 deletions
  1. 1 0
      README.md
  2. 4 13
      include/raylib-nuklear.h
  3. 3 0
      test/raylib-nuklear-test.c

+ 1 - 0
README.md

@@ -76,6 +76,7 @@ struct nk_context* InitNuklear(int fontSize);                // Initialize the N
 struct nk_context* InitNuklearEx(Font font, float fontSize); // Initialize the Nuklear GUI context, with a custom font
 struct nk_context* InitNuklearEx(Font font, float fontSize); // Initialize the Nuklear GUI context, with a custom font
 Font LoadFontFromNuklear(int fontSize);                      // Loads the default Nuklear font
 Font LoadFontFromNuklear(int fontSize);                      // Loads the default Nuklear font
 void UpdateNuklear(struct nk_context * ctx);                 // Update the input state and internal components for Nuklear
 void UpdateNuklear(struct nk_context * ctx);                 // Update the input state and internal components for Nuklear
+void UpdateNuklearEx(struct nk_context * ctx, float deltaTime); // Update the input state and internal components for Nuklear, with a custom frame time
 void DrawNuklear(struct nk_context * ctx);                   // Render the Nuklear GUI on the screen
 void DrawNuklear(struct nk_context * ctx);                   // Render the Nuklear GUI on the screen
 void UnloadNuklear(struct nk_context * ctx);                 // Deinitialize the Nuklear context
 void UnloadNuklear(struct nk_context * ctx);                 // Deinitialize the Nuklear context
 struct nk_color ColorToNuklear(Color color);                 // Convert a raylib Color to a Nuklear color object
 struct nk_color ColorToNuklear(Color color);                 // Convert a raylib Color to a Nuklear color object

+ 4 - 13
include/raylib-nuklear.h

@@ -63,7 +63,7 @@ NK_API struct nk_context* InitNuklear(int fontSize);                // Initializ
 NK_API struct nk_context* InitNuklearEx(Font font, float fontSize); // Initialize the Nuklear GUI context, with a custom font
 NK_API struct nk_context* InitNuklearEx(Font font, float fontSize); // Initialize the Nuklear GUI context, with a custom font
 NK_API Font LoadFontFromNuklear(int fontSize);                      // Loads the default Nuklear font
 NK_API Font LoadFontFromNuklear(int fontSize);                      // Loads the default Nuklear font
 NK_API void UpdateNuklear(struct nk_context * ctx);                 // Update the input state and internal components for Nuklear
 NK_API void UpdateNuklear(struct nk_context * ctx);                 // Update the input state and internal components for Nuklear
-NK_API void UpdateNuklearCustom(struct nk_context * ctx, float deltaTime); // Update the input state and internal components for Nuklear
+NK_API void UpdateNuklearEx(struct nk_context * ctx, float deltaTime); // Update the input state and internal components for Nuklear, with a custom frame time
 NK_API void DrawNuklear(struct nk_context * ctx);                   // Render the Nuklear GUI on the screen
 NK_API void DrawNuklear(struct nk_context * ctx);                   // Render the Nuklear GUI on the screen
 NK_API void UnloadNuklear(struct nk_context * ctx);                 // Deinitialize the Nuklear context
 NK_API void UnloadNuklear(struct nk_context * ctx);                 // Deinitialize the Nuklear context
 NK_API struct nk_color ColorToNuklear(Color color);                 // Convert a raylib Color to a Nuklear color object
 NK_API struct nk_color ColorToNuklear(Color color);                 // Convert a raylib Color to a Nuklear color object
@@ -847,19 +847,10 @@ nk_raylib_input_mouse(struct nk_context * ctx)
  *
  *
  * @param ctx The nuklear context to act upon.
  * @param ctx The nuklear context to act upon.
  */
  */
-NK_API void
+NK_API inline void
 UpdateNuklear(struct nk_context * ctx)
 UpdateNuklear(struct nk_context * ctx)
 {
 {
-    // Update the time that has changed since last frame.
-    ctx->delta_time_seconds = GetFrameTime();
-
-    // Update the input state.
-    nk_input_begin(ctx);
-    {
-        nk_raylib_input_mouse(ctx);
-        nk_raylib_input_keyboard(ctx);
-    }
-    nk_input_end(ctx);
+    UpdateNuklearEx(ctx, GetFrameTime());
 }
 }
 
 
 /**
 /**
@@ -869,7 +860,7 @@ UpdateNuklear(struct nk_context * ctx)
  * @param deltaTime Time in seconds since last frame.
  * @param deltaTime Time in seconds since last frame.
  */
  */
 NK_API void
 NK_API void
-UpdateNuklearCustom(struct nk_context * ctx, float deltaTime)
+UpdateNuklearEx(struct nk_context * ctx, float deltaTime)
 {
 {
     // Update the time that has changed since last frame.
     // Update the time that has changed since last frame.
     ctx->delta_time_seconds = deltaTime;
     ctx->delta_time_seconds = deltaTime;

+ 3 - 0
test/raylib-nuklear-test.c

@@ -33,6 +33,9 @@ int main(int argc, char *argv[]) {
     // UpdateNuklear()
     // UpdateNuklear()
     UpdateNuklear(ctx);
     UpdateNuklear(ctx);
 
 
+    // UpdateNuklearEx()
+    UpdateNuklearEx(ctx, 1.0f / 60.0f);
+
     // Nuklear GUI Code
     // Nuklear GUI Code
     // https://github.com/Immediate-Mode-UI/Nuklear/wiki/Window
     // https://github.com/Immediate-Mode-UI/Nuklear/wiki/Window
     if (nk_begin(ctx, "Nuklear", nk_rect(50, 50, 400, 400),
     if (nk_begin(ctx, "Nuklear", nk_rect(50, 50, 400, 400),