mirror of
https://github.com/raysan5/raylib.git
synced 2026-07-11 00:01:56 -04:00
Compare commits
5 Commits
962bbfc6bf
...
3edfe19438
| Author | SHA1 | Date | |
|---|---|---|---|
| 3edfe19438 | |||
| 9215540015 | |||
| 83cb4cc210 | |||
| d1a14bee5d | |||
| ba3b8f8370 |
12
src/rcore.c
12
src/rcore.c
@ -3934,7 +3934,11 @@ bool IsGamepadAvailable(int gamepad)
|
|||||||
// Get gamepad internal name id
|
// Get gamepad internal name id
|
||||||
const char *GetGamepadName(int gamepad)
|
const char *GetGamepadName(int gamepad)
|
||||||
{
|
{
|
||||||
return CORE.Input.Gamepad.name[gamepad];
|
const char *name = NULL;
|
||||||
|
|
||||||
|
if ((gamepad >= 0) && (gamepad < MAX_GAMEPADS)) name = CORE.Input.Gamepad.name[gamepad];
|
||||||
|
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if gamepad button has been pressed once
|
// Check if gamepad button has been pressed once
|
||||||
@ -3999,7 +4003,11 @@ int GetGamepadButtonPressed(void)
|
|||||||
// Get gamepad axis count
|
// Get gamepad axis count
|
||||||
int GetGamepadAxisCount(int gamepad)
|
int GetGamepadAxisCount(int gamepad)
|
||||||
{
|
{
|
||||||
return CORE.Input.Gamepad.axisCount[gamepad];
|
int result = 0;
|
||||||
|
|
||||||
|
if ((gamepad >= 0) && (gamepad < MAX_GAMEPADS)) result = CORE.Input.Gamepad.axisCount[gamepad];
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get axis movement vector for a gamepad
|
// Get axis movement vector for a gamepad
|
||||||
|
|||||||
@ -1237,7 +1237,11 @@ void rlMatrixMode(int mode)
|
|||||||
// Push the current matrix into RLGL.State.stack
|
// Push the current matrix into RLGL.State.stack
|
||||||
void rlPushMatrix(void)
|
void rlPushMatrix(void)
|
||||||
{
|
{
|
||||||
if (RLGL.State.stackCounter >= RL_MAX_MATRIX_STACK_SIZE) TRACELOG(RL_LOG_ERROR, "RLGL: Matrix stack overflow (RL_MAX_MATRIX_STACK_SIZE)");
|
if (RLGL.State.stackCounter >= RL_MAX_MATRIX_STACK_SIZE)
|
||||||
|
{
|
||||||
|
TRACELOG(RL_LOG_ERROR, "RLGL: Matrix stack overflow (RL_MAX_MATRIX_STACK_SIZE)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (RLGL.State.currentMatrixMode == RL_MODELVIEW)
|
if (RLGL.State.currentMatrixMode == RL_MODELVIEW)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3142,6 +3142,8 @@ Mesh GenMeshCone(float radius, float height, int slices)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate torus mesh
|
// Generate torus mesh
|
||||||
|
// NOTE: The distance between the center of the hole and the center of the
|
||||||
|
// tube is half size of the radius of the tube (radius*size/2)
|
||||||
Mesh GenMeshTorus(float radius, float size, int radSeg, int sides)
|
Mesh GenMeshTorus(float radius, float size, int radSeg, int sides)
|
||||||
{
|
{
|
||||||
Mesh mesh = { 0 };
|
Mesh mesh = { 0 };
|
||||||
|
|||||||
@ -1919,10 +1919,14 @@ char *TextReplaceBetween(const char *text, const char *begin, const char *end, c
|
|||||||
int replaceLen = (replacement == NULL)? 0 : TextLength(replacement);
|
int replaceLen = (replacement == NULL)? 0 : TextLength(replacement);
|
||||||
//int toreplaceLen = endIndex - beginIndex - beginLen;
|
//int toreplaceLen = endIndex - beginIndex - beginLen;
|
||||||
|
|
||||||
|
if ((beginIndex + beginLen + replaceLen + (textLen - endIndex)) < (MAX_TEXT_BUFFER_LENGTH - 1))
|
||||||
|
{
|
||||||
strncpy(buffer, text, beginIndex + beginLen); // Copy first text part
|
strncpy(buffer, text, beginIndex + beginLen); // Copy first text part
|
||||||
if (replacement != NULL) strncpy(buffer + beginIndex + beginLen, replacement, replaceLen); // Copy replacement (if provided)
|
if (replacement != NULL) strncpy(buffer + beginIndex + beginLen, replacement, replaceLen); // Copy replacement (if provided)
|
||||||
strncpy(buffer + beginIndex + beginLen + replaceLen, text + endIndex, textLen - endIndex); // Copy end text part
|
strncpy(buffer + beginIndex + beginLen + replaceLen, text + endIndex, textLen - endIndex); // Copy end text part
|
||||||
}
|
}
|
||||||
|
else TRACELOG(LOG_WARNING, "TEXT: Text with replaced string is longer than internal buffer (MAX_TEXT_BUFFER_LENGTH)");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user