Skip to content

Commit efbe01e

Browse files
committed
update
1 parent 6d0ae60 commit efbe01e

16 files changed

Lines changed: 122 additions & 44 deletions

File tree

docs/raymath.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2777,7 +2777,7 @@ <h1><a class="toc-backref" href="#19">Exports</a></h1>
27772777
<div class="twelve-columns footer">
27782778
<span class="nim-sprite"></span>
27792779
<br>
2780-
<small style="color: var(--hint);">Made with Nim. Generated: 2025-08-13 12:31:55 UTC</small>
2780+
<small style="color: var(--hint);">Made with Nim. Generated: 2025-08-31 19:00:31 UTC</small>
27812781
</div>
27822782
</div>
27832783
</div>

src/raylib/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,10 @@ ifeq ($(PLATFORM_OS), LINUX)
342342
CFLAGS += -fPIC
343343
endif
344344

345+
ifeq ($(PLATFORM_OS),WINDOWS)
346+
CFLAGS += -DUNICODE
347+
endif
348+
345349
ifeq ($(RAYLIB_BUILD_MODE),DEBUG)
346350
CFLAGS += -g -D_DEBUG
347351
endif
@@ -628,6 +632,9 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
628632
LDLIBS += -latomic
629633
endif
630634
endif
635+
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_WIN32)
636+
LDLIBS = -lgdi32 -lwinmm -lopengl32 -lshcore
637+
endif
631638
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
632639
LDLIBS = -llog -landroid -lEGL -lGLESv2 -lOpenSLES -lc -lm
633640
endif

src/raylib/external/rl_gputex.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
288288
if (header->ddspf.flags == 0x40) // No alpha channel
289289
{
290290
int data_size = image_pixel_size*sizeof(unsigned short);
291-
if (header->mipmap_count > 1) data_size = data_size + data_size / 3;
291+
if (header->mipmap_count > 1) data_size = data_size + data_size/3;
292292
image_data = RL_GPUTEX_MALLOC(data_size);
293293

294294
RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
@@ -300,7 +300,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
300300
if (header->ddspf.a_bit_mask == 0x8000) // 1bit alpha
301301
{
302302
int data_size = image_pixel_size*sizeof(unsigned short);
303-
if (header->mipmap_count > 1) data_size = data_size + data_size / 3;
303+
if (header->mipmap_count > 1) data_size = data_size + data_size/3;
304304
image_data = RL_GPUTEX_MALLOC(data_size);
305305

306306
RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
@@ -320,7 +320,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
320320
else if (header->ddspf.a_bit_mask == 0xf000) // 4bit alpha
321321
{
322322
int data_size = image_pixel_size*sizeof(unsigned short);
323-
if (header->mipmap_count > 1) data_size = data_size + data_size / 3;
323+
if (header->mipmap_count > 1) data_size = data_size + data_size/3;
324324
image_data = RL_GPUTEX_MALLOC(data_size);
325325

326326
RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
@@ -342,7 +342,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
342342
else if ((header->ddspf.flags == 0x40) && (header->ddspf.rgb_bit_count == 24)) // DDS_RGB, no compressed
343343
{
344344
int data_size = image_pixel_size*3*sizeof(unsigned char);
345-
if (header->mipmap_count > 1) data_size = data_size + data_size / 3;
345+
if (header->mipmap_count > 1) data_size = data_size + data_size/3;
346346
image_data = RL_GPUTEX_MALLOC(data_size);
347347

348348
RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
@@ -352,7 +352,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
352352
else if ((header->ddspf.flags == 0x41) && (header->ddspf.rgb_bit_count == 32)) // DDS_RGBA, no compressed
353353
{
354354
int data_size = image_pixel_size*4*sizeof(unsigned char);
355-
if (header->mipmap_count > 1) data_size = data_size + data_size / 3;
355+
if (header->mipmap_count > 1) data_size = data_size + data_size/3;
356356
image_data = RL_GPUTEX_MALLOC(data_size);
357357

358358
RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
@@ -376,7 +376,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
376376
int data_size = 0;
377377

378378
// Calculate data size, including all mipmaps
379-
if (header->mipmap_count > 1) data_size = header->pitch_or_linear_size + header->pitch_or_linear_size / 3;
379+
if (header->mipmap_count > 1) data_size = header->pitch_or_linear_size + header->pitch_or_linear_size/3;
380380
else data_size = header->pitch_or_linear_size;
381381

382382
image_data = RL_GPUTEX_MALLOC(data_size*sizeof(unsigned char));
@@ -1547,4 +1547,4 @@ typedef enum VkFormat {
15471547
// Provided by VK_KHR_maintenance5
15481548
VK_FORMAT_A8_UNORM_KHR = VK_FORMAT_A8_UNORM,
15491549
} VkFormat;
1550-
*/
1550+
*/

src/raylib/platforms/rcore_desktop_glfw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* Custom flag for rcore on target platform -not used-
2525
*
2626
* DEPENDENCIES:
27-
* - rglfw: Manage graphic device, OpenGL context and inputs (Windows, Linux, OSX, FreeBSD...)
27+
* - rglfw: Manage graphic device, OpenGL context and inputs (Windows, Linux, OSX/macOS, FreeBSD...)
2828
* - gestures: Gestures system for touch-ready devices (or simulated from mouse inputs)
2929
*
3030
*

src/raylib/platforms/rcore_desktop_rgfw.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,8 +1041,8 @@ void PollInputEvents(void)
10411041
// if we are doing automatic DPI scaling, then the "screen" size is divided by the window scale
10421042
if (IsWindowState(FLAG_WINDOW_HIGHDPI))
10431043
{
1044-
CORE.Window.screen.width = (int)(platform.window->r.w / GetWindowScaleDPI().x);
1045-
CORE.Window.screen.height = (int)(platform.window->r.h / GetWindowScaleDPI().y);
1044+
CORE.Window.screen.width = (int)(platform.window->r.w/GetWindowScaleDPI().x);
1045+
CORE.Window.screen.height = (int)(platform.window->r.h/GetWindowScaleDPI().y);
10461046
}
10471047
else
10481048
{
@@ -1207,13 +1207,13 @@ void PollInputEvents(void)
12071207
{
12081208
case 0:
12091209
{
1210-
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_LEFT_X] = event->axis[0].x / 100.0f;
1211-
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_LEFT_Y] = event->axis[0].y / 100.0f;
1210+
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_LEFT_X] = event->axis[0].x/100.0f;
1211+
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_LEFT_Y] = event->axis[0].y/100.0f;
12121212
} break;
12131213
case 1:
12141214
{
1215-
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_RIGHT_X] = event->axis[1].x / 100.0f;
1216-
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_RIGHT_Y] = event->axis[1].y / 100.0f;
1215+
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_RIGHT_X] = event->axis[1].x/100.0f;
1216+
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_RIGHT_Y] = event->axis[1].y/100.0f;
12171217
} break;
12181218
case 2: axis = GAMEPAD_AXIS_LEFT_TRIGGER;
12191219
case 3:

src/raylib/platforms/rcore_desktop_sdl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,8 +1485,8 @@ void PollInputEvents(void)
14851485
// if we are doing automatic DPI scaling, then the "screen" size is divided by the window scale
14861486
if (IsWindowState(FLAG_WINDOW_HIGHDPI))
14871487
{
1488-
CORE.Window.screen.width = (int)(width / GetWindowScaleDPI().x);
1489-
CORE.Window.screen.height = (int)(height / GetWindowScaleDPI().y);
1488+
CORE.Window.screen.width = (int)(width/GetWindowScaleDPI().x);
1489+
CORE.Window.screen.height = (int)(height/GetWindowScaleDPI().y);
14901490
}
14911491
else
14921492
{

src/raylib/platforms/rcore_drm.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#include <termios.h> // POSIX terminal control definitions - tcgetattr(), tcsetattr()
5454
#include <pthread.h> // POSIX threads management (inputs reading)
5555
#include <dirent.h> // POSIX directory browsing
56+
#include <limits.h> // INT_MAX
5657

5758
#include <sys/ioctl.h> // Required for: ioctl() - UNIX System call for device-specific input/output operations
5859
#include <linux/kd.h> // Linux: KDSKBMODE, K_MEDIUMRAM constants definition
@@ -2150,6 +2151,8 @@ static int FindNearestConnectorMode(const drmModeConnector *connector, uint widt
21502151
if (NULL == connector) return -1;
21512152

21522153
int nearestIndex = -1;
2154+
int minUnusedPixels = INT_MAX;
2155+
int minFpsDiff = INT_MAX;
21532156
for (int i = 0; i < platform.connector->count_modes; i++)
21542157
{
21552158
const drmModeModeInfo *const mode = &platform.connector->modes[i];
@@ -2169,21 +2172,17 @@ static int FindNearestConnectorMode(const drmModeConnector *connector, uint widt
21692172
continue;
21702173
}
21712174

2172-
if (nearestIndex < 0)
2175+
const int unusedPixels = (mode->hdisplay - width) * (mode->vdisplay - height);
2176+
const int fpsDiff = mode->vrefresh - fps;
2177+
2178+
if ((unusedPixels < minUnusedPixels) ||
2179+
((unusedPixels == minUnusedPixels) && (abs(fpsDiff) < abs(minFpsDiff))) ||
2180+
((unusedPixels == minUnusedPixels) && (abs(fpsDiff) == abs(minFpsDiff)) && (fpsDiff > 0)))
21732181
{
21742182
nearestIndex = i;
2175-
continue;
2183+
minUnusedPixels = unusedPixels;
2184+
minFpsDiff = fpsDiff;
21762185
}
2177-
2178-
const int widthDiff = abs(mode->hdisplay - width);
2179-
const int heightDiff = abs(mode->vdisplay - height);
2180-
const int fpsDiff = abs(mode->vrefresh - fps);
2181-
2182-
const int nearestWidthDiff = abs(platform.connector->modes[nearestIndex].hdisplay - width);
2183-
const int nearestHeightDiff = abs(platform.connector->modes[nearestIndex].vdisplay - height);
2184-
const int nearestFpsDiff = abs(platform.connector->modes[nearestIndex].vrefresh - fps);
2185-
2186-
if ((widthDiff < nearestWidthDiff) || (heightDiff < nearestHeightDiff) || (fpsDiff < nearestFpsDiff)) nearestIndex = i;
21872186
}
21882187

21892188
return nearestIndex;

src/raylib/raylib.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,9 +1466,9 @@ RLAPI int GetPixelDataSize(int width, int height, int format); // G
14661466
// Font loading/unloading functions
14671467
RLAPI Font GetFontDefault(void); // Get the default Font
14681468
RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM)
1469-
RLAPI Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height
1469+
RLAPI Font LoadFontEx(const char *fileName, int fontSize, const int *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height
14701470
RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style)
1471-
RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
1471+
RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, const int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
14721472
RLAPI bool IsFontValid(Font font); // Check if a font is valid (font data loaded, WARNING: GPU texture not checked)
14731473
RLAPI GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount, int type); // Load font data for further use
14741474
RLAPI Image GenImageFontAtlas(const GlyphInfo *glyphs, rlRectangle **glyphRecs, int glyphCount, int fontSize, int padding, int packMethod); // Generate image font atlas using chars info
@@ -1506,6 +1506,8 @@ RLAPI const char *CodepointToUTF8(int codepoint, int *utf8Size);
15061506
// Text strings management functions (no UTF-8 strings, only byte chars)
15071507
// WARNING 1: Most of these functions use internal static buffers, it's recommended to store returned data on user-side for re-use
15081508
// WARNING 2: Some strings allocate memory internally for the returned strings, those strings must be free by user using MemFree()
1509+
RLAPI char **LoadTextLines(const char *text, int *count); // Load text as separate lines ('\n')
1510+
RLAPI void UnloadTextLines(char **text); // Unload text lines
15091511
RLAPI int TextCopy(char *dst, const char *src); // Copy one string to another, returns bytes copied
15101512
RLAPI bool TextIsEqual(const char *text1, const char *text2); // Check if two text string are equal
15111513
RLAPI unsigned int TextLength(const char *text); // Get text length, checks for '\0' ending
@@ -1522,7 +1524,6 @@ RLAPI char *TextToLower(const char *text);
15221524
RLAPI char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
15231525
RLAPI char *TextToSnake(const char *text); // Get Snake case notation version of provided string
15241526
RLAPI char *TextToCamel(const char *text); // Get Camel case notation version of provided string
1525-
15261527
RLAPI int TextToInteger(const char *text); // Get integer value from text
15271528
RLAPI float TextToFloat(const char *text); // Get float value from text
15281529

src/raylib/rcore.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,8 @@ const char *TextFormat(const char *text, ...); // Formatting of text with variab
555555
#include "platforms/rcore_desktop_sdl.c"
556556
#elif (defined(PLATFORM_DESKTOP_RGFW) || defined(PLATFORM_WEB_RGFW))
557557
#include "platforms/rcore_desktop_rgfw.c"
558+
#elif defined(PLATFORM_DESKTOP_WIN32)
559+
#include "platforms/rcore_desktop_win32.c"
558560
#elif defined(PLATFORM_WEB)
559561
#include "platforms/rcore_web.c"
560562
#elif defined(PLATFORM_DRM)
@@ -564,6 +566,7 @@ const char *TextFormat(const char *text, ...); // Formatting of text with variab
564566
#else
565567
// TODO: Include your custom platform backend!
566568
// i.e software rendering backend or console backend!
569+
#pragma message ("WARNING: No [rcore] platform defined")
567570
#endif
568571

569572
//----------------------------------------------------------------------------------
@@ -624,6 +627,8 @@ void InitWindow(int width, int height, const char *title)
624627
TRACELOG(LOG_INFO, "Platform backend: DESKTOP (SDL)");
625628
#elif defined(PLATFORM_DESKTOP_RGFW)
626629
TRACELOG(LOG_INFO, "Platform backend: DESKTOP (RGFW)");
630+
#elif defined(PLATFORM_DESKTOP_WIN32)
631+
TRACELOG(LOG_INFO, "Platform backend: DESKTOP (WIN32)");
627632
#elif defined(PLATFORM_WEB_RGFW)
628633
TRACELOG(LOG_INFO, "Platform backend: WEB (RGFW) (HTML5)");
629634
#elif defined(PLATFORM_WEB)
@@ -2998,8 +3003,9 @@ AutomationEventList LoadAutomationEventList(const char *fileName)
29983003
char buffer[256] = { 0 };
29993004
char eventDesc[64] = { 0 };
30003005

3001-
fgets(buffer, 256, raeFile);
3002-
3006+
char *result = fgets(buffer, 256, raeFile);
3007+
if (result != buffer) TRACELOG(LOG_WARNING, "AUTOMATION: [%s] Issue reading line to buffer", fileName);
3008+
30033009
while (!feof(raeFile))
30043010
{
30053011
switch (buffer[0])
@@ -3015,7 +3021,8 @@ AutomationEventList LoadAutomationEventList(const char *fileName)
30153021
default: break;
30163022
}
30173023

3018-
fgets(buffer, 256, raeFile);
3024+
result = fgets(buffer, 256, raeFile);
3025+
if (result != buffer) TRACELOG(LOG_WARNING, "AUTOMATION: [%s] Issue reading line to buffer", fileName);
30193026
}
30203027

30213028
if (counter != list.count)

src/raylib/rlgl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3243,6 +3243,7 @@ unsigned int rlLoadTexture(const void *data, int width, int height, int format,
32433243
int mipWidth = width;
32443244
int mipHeight = height;
32453245
int mipOffset = 0; // Mipmap data offset, only used for tracelog
3246+
(void)mipOffset; // Used to avoid gcc warnings about unused variable
32463247

32473248
// NOTE: Added pointer math separately from function to avoid UBSAN complaining
32483249
unsigned char *dataPtr = NULL;

0 commit comments

Comments
 (0)