mirror of
https://github.com/raysan5/raylib.git
synced 2025-11-17 15:51:19 +00:00
Review formatting
This commit is contained in:
@@ -971,21 +971,20 @@ void SetMouseCursor(int 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);
|
||||
|
||||
for (int i=0; i<CORE.Input.Touch.pointCount; i++)
|
||||
for (int i = 0; i < CORE.Input.Touch.pointCount; i++)
|
||||
{
|
||||
SDL_Finger *finger = SDL_GetTouchFinger(event.touchId, i);
|
||||
CORE.Input.Touch.pointId[i] = finger->id;
|
||||
CORE.Input.Touch.position[i].x = finger->x * CORE.Window.screen.width;
|
||||
CORE.Input.Touch.position[i].y = finger->y * CORE.Window.screen.height;
|
||||
CORE.Input.Touch.position[i].x = finger->x*CORE.Window.screen.width;
|
||||
CORE.Input.Touch.position[i].y = finger->y*CORE.Window.screen.height;
|
||||
CORE.Input.Touch.currentTouchState[i] = 1;
|
||||
}
|
||||
|
||||
for (int i=CORE.Input.Touch.pointCount; i<MAX_TOUCH_POINTS; i++)
|
||||
CORE.Input.Touch.currentTouchState[i] = 0;
|
||||
for (int i = CORE.Input.Touch.pointCount; i < MAX_TOUCH_POINTS; i++) CORE.Input.Touch.currentTouchState[i] = 0;
|
||||
}
|
||||
|
||||
// Register all input events
|
||||
@@ -1218,19 +1217,19 @@ void PollInputEvents(void)
|
||||
|
||||
case SDL_FINGERDOWN:
|
||||
{
|
||||
UpdateSDLTouchPoints(event.tfinger);
|
||||
UpdateTouchPointsSDL(event.tfinger);
|
||||
touchAction = 1;
|
||||
realTouch = true;
|
||||
} break;
|
||||
case SDL_FINGERUP:
|
||||
{
|
||||
UpdateSDLTouchPoints(event.tfinger);
|
||||
UpdateTouchPointsSDL(event.tfinger);
|
||||
touchAction = 0;
|
||||
realTouch = true;
|
||||
} break;
|
||||
case SDL_FINGERMOTION:
|
||||
{
|
||||
UpdateSDLTouchPoints(event.tfinger);
|
||||
UpdateTouchPointsSDL(event.tfinger);
|
||||
touchAction = 2;
|
||||
realTouch = true;
|
||||
} break;
|
||||
@@ -1239,7 +1238,9 @@ void PollInputEvents(void)
|
||||
case SDL_JOYDEVICEADDED:
|
||||
{
|
||||
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);
|
||||
|
||||
if (platform.gamepad[jid])
|
||||
@@ -1260,7 +1261,9 @@ void PollInputEvents(void)
|
||||
case SDL_JOYDEVICEREMOVED:
|
||||
{
|
||||
int jid = event.jdevice.which;
|
||||
if (jid == SDL_JoystickInstanceID(platform.gamepad[jid])) {
|
||||
|
||||
if (jid == SDL_JoystickInstanceID(platform.gamepad[jid]))
|
||||
{
|
||||
SDL_JoystickClose(platform.gamepad[jid]);
|
||||
platform.gamepad[jid] = SDL_JoystickOpen(0);
|
||||
CORE.Input.Gamepad.ready[jid] = false;
|
||||
|
||||
@@ -54,8 +54,8 @@
|
||||
#include "raymath.h" // Required for: Vector3, Quaternion and Matrix functionality
|
||||
|
||||
#include <stdio.h> // Required for: sprintf()
|
||||
#include <stdlib.h> // Required for: malloc(), free()
|
||||
#include <string.h> // Required for: memcmp(), strlen()
|
||||
#include <stdlib.h> // Required for: malloc(), calloc(), free()
|
||||
#include <string.h> // Required for: memcmp(), strlen(), strncpy()
|
||||
#include <math.h> // Required for: sinf(), cosf(), sqrtf(), fabsf()
|
||||
|
||||
#if defined(SUPPORT_FILEFORMAT_OBJ) || defined(SUPPORT_FILEFORMAT_MTL)
|
||||
@@ -5641,7 +5641,7 @@ static Model LoadVOX(const char *fileName)
|
||||
|
||||
// 6*4 = 12 vertices per voxel
|
||||
Vector3 *pvertices = (Vector3 *)voxarray.vertices.array;
|
||||
Vector3* pnormals = (Vector3*)voxarray.normals.array;
|
||||
Vector3 *pnormals = (Vector3 *)voxarray.normals.array;
|
||||
Color *pcolors = (Color *)voxarray.colors.array;
|
||||
|
||||
unsigned short *pindices = voxarray.indices.array; // 5461*6*6 = 196596 indices max per mesh
|
||||
@@ -5657,16 +5657,16 @@ static Model LoadVOX(const char *fileName)
|
||||
pmesh->vertexCount = (int)fmin(verticesMax, verticesRemain);
|
||||
|
||||
size = pmesh->vertexCount*sizeof(float)*3;
|
||||
pmesh->vertices = RL_MALLOC(size);
|
||||
pmesh->vertices = (float *)RL_MALLOC(size);
|
||||
memcpy(pmesh->vertices, pvertices, size);
|
||||
|
||||
// Copy normals
|
||||
pmesh->normals = RL_MALLOC(size); //Rk. size as vertices
|
||||
pmesh->normals = (float *)RL_MALLOC(size);
|
||||
memcpy(pmesh->normals, pnormals, size);
|
||||
|
||||
// Copy indices
|
||||
size = voxarray.indices.used*sizeof(unsigned short);
|
||||
pmesh->indices = RL_MALLOC(size);
|
||||
pmesh->indices = (float *)RL_MALLOC(size);
|
||||
memcpy(pmesh->indices, pindices, size);
|
||||
|
||||
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 *));
|
||||
strncpy(animations[a].name, m3d->action[a].name, sizeof(animations[a].name));
|
||||
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);
|
||||
|
||||
for (i = 0; i < (int)m3d->numbone; i++)
|
||||
|
||||
@@ -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
|
||||
if ((segments%2) == 1)
|
||||
if (((unsigned int)segments%2) == 1)
|
||||
{
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user