From 7f70abc5db83b2fb51d502e7a3cb90e908e647ed Mon Sep 17 00:00:00 2001 From: Ray Date: Sat, 17 Jun 2023 17:03:36 +0200 Subject: [PATCH] RENAMED gui module for consistency --- examples/animation_curve/animation_curve.c | 4 +-- .../{gui_curve_edit.h => gui_curve_editor.h} | 33 +++++++++---------- .../VS2022/examples/animation_curve.vcxproj | 3 ++ 3 files changed, 20 insertions(+), 20 deletions(-) rename examples/animation_curve/{gui_curve_edit.h => gui_curve_editor.h} (97%) diff --git a/examples/animation_curve/animation_curve.c b/examples/animation_curve/animation_curve.c index 8f443f0..26e7150 100644 --- a/examples/animation_curve/animation_curve.c +++ b/examples/animation_curve/animation_curve.c @@ -31,8 +31,8 @@ #undef RAYGUI_IMPLEMENTATION // Avoid including raygui implementation again -#define GUI_CURVE_EDIT_IMPLEMENTATION -#include "gui_curve_edit.h" +#define GUI_CURVE_EDITOR_IMPLEMENTATION +#include "gui_curve_editor.h" //------------------------------------------------------------------------------------ // Helper function diff --git a/examples/animation_curve/gui_curve_edit.h b/examples/animation_curve/gui_curve_editor.h similarity index 97% rename from examples/animation_curve/gui_curve_edit.h rename to examples/animation_curve/gui_curve_editor.h index 46a1819..ed855d0 100644 --- a/examples/animation_curve/gui_curve_edit.h +++ b/examples/animation_curve/gui_curve_editor.h @@ -3,7 +3,7 @@ * CurveEdit v1.0 - A cubic Hermite editor for making animation curves * * MODULE USAGE: -* #define GUI_CURVE_EDIT_IMPLEMENTATION +* #define GUI_CURVE_EDITOR_IMPLEMENTATION * #include "gui_curve_edit.h" * * INIT: GuiCurveEditState state = InitCurveEdit(); @@ -46,12 +46,12 @@ #include "raylib.h" -#ifndef GUI_CURVE_EDIT_H -#define GUI_CURVE_EDIT_H +#ifndef GUI_CURVE_EDITOR_H +#define GUI_CURVE_EDITOR_H -#ifndef GUI_CURVE_EDIT_MAX_POINTS - #define GUI_CURVE_EDIT_MAX_POINTS 30 +#ifndef GUI_CURVE_EDITOR_MAX_POINTS + #define GUI_CURVE_EDITOR_MAX_POINTS 30 #endif //---------------------------------------------------------------------------------- @@ -75,7 +75,7 @@ typedef struct { int selectedIndex; // Unsorted array with at least one point (constant curve) - GuiCurveEditorPoint points[GUI_CURVE_EDIT_MAX_POINTS]; + GuiCurveEditorPoint points[GUI_CURVE_EDITOR_MAX_POINTS]; int numPoints; // Private variables @@ -92,9 +92,7 @@ extern "C" { // Prevents name mangling of functions //---------------------------------------------------------------------------------- // Module Functions Declaration //---------------------------------------------------------------------------------- - - -GuiCurveEditorState GuiInitCurveEditor(); // Initialize curve editor state +GuiCurveEditorState InitGuiCurveEditor(); // Initialize curve editor state void GuiCurveEditor(GuiCurveEditorState *state, Rectangle bounds); // Draw and update curve control // 1D Interpolation @@ -106,14 +104,14 @@ float GuiCurveEval(GuiCurveEditorState *state, float t); } #endif -#endif // GUI_CURVE_EDIT_H +#endif // GUI_CURVE_EDITOR_H /*********************************************************************************** * -* GUI_CURVE_EDIT IMPLEMENTATION +* GUI_CURVE_EDITOR IMPLEMENTATION * ************************************************************************************/ -#if defined(GUI_CURVE_EDIT_IMPLEMENTATION) +#if defined(GUI_CURVE_EDITOR_IMPLEMENTATION) #include "../../src/raygui.h" // Change this to fit your project @@ -122,8 +120,7 @@ float GuiCurveEval(GuiCurveEditorState *state, float t); //---------------------------------------------------------------------------------- // Module Functions Definition //---------------------------------------------------------------------------------- - -GuiCurveEditorState GuiInitCurveEditor() +GuiCurveEditorState InitGuiCurveEditor() { GuiCurveEditorState state = { 0 }; @@ -155,7 +152,7 @@ static int CompareGuiCurveEditPointPtr(const void *a, const void *b) float GuiCurveEval(GuiCurveEditorState *state, float t) { // Sort points - GuiCurveEditorPoint* sortedPoints[GUI_CURVE_EDIT_MAX_POINTS]; + GuiCurveEditorPoint* sortedPoints[GUI_CURVE_EDITOR_MAX_POINTS]; for (int i=0; i < state->numPoints; i++) sortedPoints[i] = &state->points[i]; @@ -313,7 +310,7 @@ void GuiCurveEditor(GuiCurveEditorState *state, Rectangle bounds) for (int i = hoveredPointIndex; i < state->numPoints; i++) state->points[i] = state->points[i+1]; } // Add a point (check against innerBounds) - else if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) && CheckCollisionPointRec(mouse, innerBounds) && (state->numPoints < GUI_CURVE_EDIT_MAX_POINTS)) + else if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) && CheckCollisionPointRec(mouse, innerBounds) && (state->numPoints < GUI_CURVE_EDITOR_MAX_POINTS)) { state->editLeftTangent = false; state->editRightTangent = false; @@ -347,7 +344,7 @@ void GuiCurveEditor(GuiCurveEditorState *state, Rectangle bounds) } // Sort points - GuiCurveEditorPoint *sortedPoints[GUI_CURVE_EDIT_MAX_POINTS] = { 0 }; + GuiCurveEditorPoint *sortedPoints[GUI_CURVE_EDITOR_MAX_POINTS] = { 0 }; for (int i = 0; i < state->numPoints; i++) sortedPoints[i] = &state->points[i]; qsort(sortedPoints, state->numPoints, sizeof(GuiCurveEditorPoint*), CompareGuiCurveEditPointPtr); @@ -553,5 +550,5 @@ void GuiCurveEditor(GuiCurveEditorState *state, Rectangle bounds) } } -#endif // GUI_CURVE_EDIT_IMPLEMENTATION +#endif // GUI_CURVE_EDITOR_IMPLEMENTATION diff --git a/projects/VS2022/examples/animation_curve.vcxproj b/projects/VS2022/examples/animation_curve.vcxproj index c3b3f84..51031e4 100644 --- a/projects/VS2022/examples/animation_curve.vcxproj +++ b/projects/VS2022/examples/animation_curve.vcxproj @@ -351,6 +351,9 @@ + + +