Review formatting

This commit is contained in:
Ray
2024-02-29 18:50:44 +01:00
parent 1e8450665c
commit fea3395fc1
5 changed files with 62 additions and 58 deletions

View File

@@ -971,7 +971,7 @@ void SetMouseCursor(int cursor)
CORE.Input.Mouse.cursor = cursor; CORE.Input.Mouse.cursor = cursor;
} }
static void UpdateSDLTouchPoints(SDL_TouchFingerEvent event) static void UpdateTouchPointsSDL(SDL_TouchFingerEvent event)
{ {
CORE.Input.Touch.pointCount = SDL_GetNumTouchFingers(event.touchId); CORE.Input.Touch.pointCount = SDL_GetNumTouchFingers(event.touchId);
@@ -984,8 +984,7 @@ static void UpdateSDLTouchPoints(SDL_TouchFingerEvent event)
CORE.Input.Touch.currentTouchState[i] = 1; CORE.Input.Touch.currentTouchState[i] = 1;
} }
for (int i=CORE.Input.Touch.pointCount; i<MAX_TOUCH_POINTS; i++) for (int i = CORE.Input.Touch.pointCount; i < MAX_TOUCH_POINTS; i++) CORE.Input.Touch.currentTouchState[i] = 0;
CORE.Input.Touch.currentTouchState[i] = 0;
} }
// Register all input events // Register all input events
@@ -1218,19 +1217,19 @@ void PollInputEvents(void)
case SDL_FINGERDOWN: case SDL_FINGERDOWN:
{ {
UpdateSDLTouchPoints(event.tfinger); UpdateTouchPointsSDL(event.tfinger);
touchAction = 1; touchAction = 1;
realTouch = true; realTouch = true;
} break; } break;
case SDL_FINGERUP: case SDL_FINGERUP:
{ {
UpdateSDLTouchPoints(event.tfinger); UpdateTouchPointsSDL(event.tfinger);
touchAction = 0; touchAction = 0;
realTouch = true; realTouch = true;
} break; } break;
case SDL_FINGERMOTION: case SDL_FINGERMOTION:
{ {
UpdateSDLTouchPoints(event.tfinger); UpdateTouchPointsSDL(event.tfinger);
touchAction = 2; touchAction = 2;
realTouch = true; realTouch = true;
} break; } break;
@@ -1239,7 +1238,9 @@ void PollInputEvents(void)
case SDL_JOYDEVICEADDED: case SDL_JOYDEVICEADDED:
{ {
int jid = event.jdevice.which; int jid = event.jdevice.which;
if (!CORE.Input.Gamepad.ready[jid] && (jid < MAX_GAMEPADS)) {
if (!CORE.Input.Gamepad.ready[jid] && (jid < MAX_GAMEPADS))
{
platform.gamepad[jid] = SDL_JoystickOpen(jid); platform.gamepad[jid] = SDL_JoystickOpen(jid);
if (platform.gamepad[jid]) if (platform.gamepad[jid])
@@ -1260,7 +1261,9 @@ void PollInputEvents(void)
case SDL_JOYDEVICEREMOVED: case SDL_JOYDEVICEREMOVED:
{ {
int jid = event.jdevice.which; int jid = event.jdevice.which;
if (jid == SDL_JoystickInstanceID(platform.gamepad[jid])) {
if (jid == SDL_JoystickInstanceID(platform.gamepad[jid]))
{
SDL_JoystickClose(platform.gamepad[jid]); SDL_JoystickClose(platform.gamepad[jid]);
platform.gamepad[jid] = SDL_JoystickOpen(0); platform.gamepad[jid] = SDL_JoystickOpen(0);
CORE.Input.Gamepad.ready[jid] = false; CORE.Input.Gamepad.ready[jid] = false;

View File

@@ -54,8 +54,8 @@
#include "raymath.h" // Required for: Vector3, Quaternion and Matrix functionality #include "raymath.h" // Required for: Vector3, Quaternion and Matrix functionality
#include <stdio.h> // Required for: sprintf() #include <stdio.h> // Required for: sprintf()
#include <stdlib.h> // Required for: malloc(), free() #include <stdlib.h> // Required for: malloc(), calloc(), free()
#include <string.h> // Required for: memcmp(), strlen() #include <string.h> // Required for: memcmp(), strlen(), strncpy()
#include <math.h> // Required for: sinf(), cosf(), sqrtf(), fabsf() #include <math.h> // Required for: sinf(), cosf(), sqrtf(), fabsf()
#if defined(SUPPORT_FILEFORMAT_OBJ) || defined(SUPPORT_FILEFORMAT_MTL) #if defined(SUPPORT_FILEFORMAT_OBJ) || defined(SUPPORT_FILEFORMAT_MTL)
@@ -5657,16 +5657,16 @@ static Model LoadVOX(const char *fileName)
pmesh->vertexCount = (int)fmin(verticesMax, verticesRemain); pmesh->vertexCount = (int)fmin(verticesMax, verticesRemain);
size = pmesh->vertexCount*sizeof(float)*3; size = pmesh->vertexCount*sizeof(float)*3;
pmesh->vertices = RL_MALLOC(size); pmesh->vertices = (float *)RL_MALLOC(size);
memcpy(pmesh->vertices, pvertices, size); memcpy(pmesh->vertices, pvertices, size);
// Copy normals // Copy normals
pmesh->normals = RL_MALLOC(size); //Rk. size as vertices pmesh->normals = (float *)RL_MALLOC(size);
memcpy(pmesh->normals, pnormals, size); memcpy(pmesh->normals, pnormals, size);
// Copy indices // Copy indices
size = voxarray.indices.used*sizeof(unsigned short); size = voxarray.indices.used*sizeof(unsigned short);
pmesh->indices = RL_MALLOC(size); pmesh->indices = (float *)RL_MALLOC(size);
memcpy(pmesh->indices, pindices, size); memcpy(pmesh->indices, pindices, size);
pmesh->triangleCount = (pmesh->vertexCount/4)*2; pmesh->triangleCount = (pmesh->vertexCount/4)*2;
@@ -6076,6 +6076,7 @@ static ModelAnimation *LoadModelAnimationsM3D(const char *fileName, int *animCou
animations[a].framePoses = RL_MALLOC(animations[a].frameCount*sizeof(Transform *)); animations[a].framePoses = RL_MALLOC(animations[a].frameCount*sizeof(Transform *));
strncpy(animations[a].name, m3d->action[a].name, sizeof(animations[a].name)); strncpy(animations[a].name, m3d->action[a].name, sizeof(animations[a].name));
animations[a].name[sizeof(animations[a].name) - 1] = '\0'; animations[a].name[sizeof(animations[a].name) - 1] = '\0';
TRACELOG(LOG_INFO, "MODEL: [%s] animation #%i: %i msec, %i frames", fileName, a, m3d->action[a].durationmsec, animations[a].frameCount); TRACELOG(LOG_INFO, "MODEL: [%s] animation #%i: %i msec, %i frames", fileName, a, m3d->action[a].durationmsec, animations[a].frameCount);
for (i = 0; i < (int)m3d->numbone; i++) for (i = 0; i < (int)m3d->numbone; i++)

View File

@@ -338,7 +338,7 @@ void DrawCircleSector(Vector2 center, float radius, float startAngle, float endA
} }
// NOTE: In case number of segments is odd, we add one last piece to the cake // NOTE: In case number of segments is odd, we add one last piece to the cake
if ((segments%2) == 1) if (((unsigned int)segments%2) == 1)
{ {
rlColor4ub(color.r, color.g, color.b, color.a); rlColor4ub(color.r, color.g, color.b, color.a);