Skip to content

Commit

Permalink
RELEASE - 12/2024
Browse files Browse the repository at this point in the history
Changelog

BUG FIXES:

* cleaned up memory leaks on shutdown (glfw, nvg, and image vector)

* save/restore didn't retain state across frames

* changed file encoding for CP_System.c so git could properly track and diff

* Screen to world calculations in Math and Input suffered from a race condition where reads and writes were happening to the same matrix.

* CP_Font_Free was missing from the API

* Draw calls that were already in the queue would still render to the screen even if CP_Graphics_ClearBackground was called.  The expectation is that if you clear the background, stuff doesn't magically not clear.

IMPROVEMENTS:

* Overhaul of CP_Image internals.  Switched CP_Image to use vect.h for container.  One big plus is that you can now draw and free an image in a single frame and it will still render correctly.

* CP_Settings_RectMode now defaults to CP_POSITION_CENTER.  This matches the other draw objects, Ellipse and Image.

* CP_Graphics_DrawPoint now uses stroke settings to assign color, weight, and shape style.

* Added focus awareness.  We now stop processing input when the window loses focus.  We also added a function so the user can check focus status.

* Add CP_Vector_AngleCW and AngleCCW to clear up some vector angle ambiguity.
      CP_Vector_AngleCW is always positive, [0, 360)
      CP_Vector_AngleCCW is always negative, [0, -360)

* Added CP_Image_SubImageAdvanced to now support simple rotation of a subimage.

* Increased default frame rate to 60Hz.  Also added CP_System_GetDisplayRefreshRate so the user can request the device refresh rate in Hz.
  • Loading branch information
justinchambers-dp committed Dec 18, 2024
1 parent d9fe7c2 commit 1fdd3b9
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 13 deletions.
24 changes: 15 additions & 9 deletions Processing_Empty/CProcessing/inc/cprocessing.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,12 @@ CP_API int CP_System_GetWindowWidth (void);
CP_API int CP_System_GetWindowHeight (void);
CP_API int CP_System_GetDisplayWidth (void);
CP_API int CP_System_GetDisplayHeight (void);
CP_API int CP_System_GetDisplayRefreshRate (void);
CP_API HWND CP_System_GetWindowHandle (void);
CP_API void CP_System_SetWindowTitle (const char* title);
CP_API CP_BOOL CP_System_GetWindowFocus (void);
CP_API void CP_System_ShowCursor (CP_BOOL show);
CP_API int CP_System_GetFrameCount (void);
CP_API unsigned CP_System_GetFrameCount (void);
CP_API float CP_System_GetFrameRate (void);
CP_API void CP_System_SetFrameRate (float fps);
CP_API float CP_System_GetDt (void);
Expand Down Expand Up @@ -157,6 +159,7 @@ CP_API int CP_Image_GetHeight (CP_Image img);
CP_API void CP_Image_Draw (CP_Image img, float x, float y, float w, float h, int alpha);
CP_API void CP_Image_DrawAdvanced (CP_Image img, float x, float y, float w, float h, int alpha, float degrees);
CP_API void CP_Image_DrawSubImage (CP_Image img, float x, float y, float w, float h, float u0, float v0, float u1, float v1, int alpha);
CP_API void CP_Image_DrawSubImageAdvanced (CP_Image img, float x, float y, float w, float h, float u0, float v0, float u1, float v1, int alpha, float degrees);
CP_API CP_Image CP_Image_CreateFromData (int w, int h, unsigned char* pixelDataInput);
CP_API CP_Image CP_Image_Screenshot (int x, int y, int w, int h);
CP_API void CP_Image_GetPixelData (CP_Image img, CP_Color* pixelDataOutput);
Expand Down Expand Up @@ -189,6 +192,7 @@ CP_API float CP_Sound_GetGroupPitch (CP_SOUND_GROUP group);
// All functions related to loading and drawing fonts
CP_API CP_Font CP_Font_GetDefault (void);
CP_API CP_Font CP_Font_Load (const char* filepath);
CP_API void CP_Font_Free (CP_Font* font);
CP_API void CP_Font_Set (CP_Font font);
CP_API void CP_Font_DrawText (const char* text, float x, float y);
CP_API void CP_Font_DrawTextBox (const char* text, float x, float y, float rowWidth);
Expand Down Expand Up @@ -217,21 +221,21 @@ CP_API float CP_Input_GetMouseDeltaY (void);
CP_API float CP_Input_GetMouseWorldX (void);
CP_API float CP_Input_GetMouseWorldY (void);
CP_API CP_BOOL CP_Input_GamepadTriggered (CP_GAMEPAD button);
CP_API CP_BOOL CP_Input_GamepadTriggeredAdvanced (CP_GAMEPAD button, int gamepadIndex);
CP_API CP_BOOL CP_Input_GamepadTriggeredAdvanced (CP_GAMEPAD button, unsigned gamepadIndex);
CP_API CP_BOOL CP_Input_GamepadReleased (CP_GAMEPAD button);
CP_API CP_BOOL CP_Input_GamepadReleasedAdvanced (CP_GAMEPAD button, int gamepadIndex);
CP_API CP_BOOL CP_Input_GamepadReleasedAdvanced (CP_GAMEPAD button, unsigned gamepadIndex);
CP_API CP_BOOL CP_Input_GamepadDown (CP_GAMEPAD button);
CP_API CP_BOOL CP_Input_GamepadDownAdvanced (CP_GAMEPAD button, int gamepadIndex);
CP_API CP_BOOL CP_Input_GamepadDownAdvanced (CP_GAMEPAD button, unsigned gamepadIndex);
CP_API float CP_Input_GamepadRightTrigger (void);
CP_API float CP_Input_GamepadRightTriggerAdvanced(int gamepadIndex);
CP_API float CP_Input_GamepadRightTriggerAdvanced(unsigned gamepadIndex);
CP_API float CP_Input_GamepadLeftTrigger (void);
CP_API float CP_Input_GamepadLeftTriggerAdvanced (int gamepadIndex);
CP_API float CP_Input_GamepadLeftTriggerAdvanced (unsigned gamepadIndex);
CP_API CP_Vector CP_Input_GamepadRightStick (void);
CP_API CP_Vector CP_Input_GamepadRightStickAdvanced (int gamepadIndex);
CP_API CP_Vector CP_Input_GamepadRightStickAdvanced (unsigned gamepadIndex);
CP_API CP_Vector CP_Input_GamepadLeftStick (void);
CP_API CP_Vector CP_Input_GamepadLeftStickAdvanced (int gamepadIndex);
CP_API CP_Vector CP_Input_GamepadLeftStickAdvanced (unsigned gamepadIndex);
CP_API CP_BOOL CP_Input_GamepadConnected (void);
CP_API CP_BOOL CP_Input_GamepadConnectedAdvanced (int gamepadIndex);
CP_API CP_BOOL CP_Input_GamepadConnectedAdvanced (unsigned gamepadIndex);


//---------------------------------------------------------
Expand Down Expand Up @@ -265,6 +269,8 @@ CP_API float CP_Vector_Distance (CP_Vector a, CP_Vector b);
CP_API float CP_Vector_DotProduct (CP_Vector a, CP_Vector b);
CP_API float CP_Vector_CrossProduct (CP_Vector a, CP_Vector b);
CP_API float CP_Vector_Angle (CP_Vector a, CP_Vector b);
CP_API float CP_Vector_AngleCW (CP_Vector from, CP_Vector to);
CP_API float CP_Vector_AngleCCW (CP_Vector from, CP_Vector to);


//---------------------------------------------------------
Expand Down
Binary file modified Processing_Empty/CProcessing/lib/x64/CProcessing.dll
Binary file not shown.
Binary file modified Processing_Empty/CProcessing/lib/x64/CProcessing.lib
Binary file not shown.
Binary file modified Processing_Empty/CProcessing/lib/x64/CProcessingd.dll
Binary file not shown.
Binary file modified Processing_Empty/CProcessing/lib/x64/CProcessingd.lib
Binary file not shown.
Binary file modified Processing_Empty/CProcessing/lib/x86/CProcessing.dll
Binary file not shown.
Binary file modified Processing_Empty/CProcessing/lib/x86/CProcessing.lib
Binary file not shown.
Binary file modified Processing_Empty/CProcessing/lib/x86/CProcessingd.dll
Binary file not shown.
Binary file modified Processing_Empty/CProcessing/lib/x86/CProcessingd.lib
Binary file not shown.
8 changes: 4 additions & 4 deletions Processing_Empty/Processing_Sample.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,26 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
Expand Down
Binary file modified Releases/CProcessingTemplate.zip
Binary file not shown.

0 comments on commit 1fdd3b9

Please sign in to comment.