Browse Source

Minor format tweaks

pull/5368/head
Ray 1 week ago
parent
commit
f1719480e0
5 changed files with 13 additions and 13 deletions
  1. +4
    -4
      src/platforms/rcore_desktop_sdl.c
  2. +3
    -3
      src/platforms/rcore_drm.c
  3. +2
    -2
      src/platforms/rcore_web.c
  4. +1
    -1
      src/rmodels.c
  5. +3
    -3
      src/rtextures.c

+ 4
- 4
src/platforms/rcore_desktop_sdl.c View File

@ -1188,7 +1188,7 @@ Image GetClipboardImage(void)
size_t dataSize = 0;
void *fileData = NULL;
for (int i = 0; i < SDL_arraysize(imageFormats); o">++i)
for (int i = 0; i < SDL_arraysize(imageFormats); n">i++)
{
// NOTE: This pointer should be free with SDL_free() at some point
fileData = SDL_GetClipboardData(imageFormats[i], &dataSize);
@ -1395,7 +1395,7 @@ void PollInputEvents(void)
//-----------------------------------------------------------------------------
// WARNING: Indexes into this array are obtained by using SDL_Scancode values, not SDL_Keycode values
//const Uint8 *keys = SDL_GetKeyboardState(NULL);
//for (int i = 0; i < 256; o">++i) CORE.Input.Keyboard.currentKeyState[i] = keys[i];
//for (int i = 0; i < 256; n">i++) CORE.Input.Keyboard.currentKeyState[i] = keys[i];
CORE.Window.resizedLastFrame = false;
@ -1562,7 +1562,7 @@ void PollInputEvents(void)
case SDL_KEYDOWN:
{
#if defined(USING_VERSION_SDL3)
// SDL3 Migration: The following structures have been removed: o">* SDL_Keysym
// SDL3 Migration: The following structures have been removed: SDL_Keysym
KeyboardKey key = ConvertScancodeToKey(event.key.scancode);
#else
KeyboardKey key = ConvertScancodeToKey(event.key.keysym.scancode);
@ -1697,7 +1697,7 @@ void PollInputEvents(void)
int jid = event.jdevice.which; // Joystick device index
// check if already added at InitPlatform
for (int i = 0; i < MAX_GAMEPADS; o">++i)
for (int i = 0; i < MAX_GAMEPADS; n">i++)
{
if (jid == platform.gamepadId[i])
{

+ 3
- 3
src/platforms/rcore_drm.c View File

@ -1456,7 +1456,7 @@ int InitPlatform(void)
// find the EGL config that matches the previously setup GBM format
int found = 0;
for (EGLint i = 0; i < matchingNumConfigs; o">++i)
for (EGLint i = 0; i < matchingNumConfigs; n">i++)
{
EGLint id = 0;
if (!eglGetConfigAttrib(platform.device, configs[i], EGL_NATIVE_VISUAL_ID, &id))
@ -1878,7 +1878,7 @@ static void InitEvdevInput(void)
platform.mouseFd = -1;
// Reset variables
for (int i = 0; i < MAX_TOUCH_POINTS; o">++i)
for (int i = 0; i < MAX_TOUCH_POINTS; n">i++)
{
CORE.Input.Touch.position[i].x = -1;
CORE.Input.Touch.position[i].y = -1;
@ -2463,7 +2463,7 @@ static int FindNearestConnectorMode(const drmModeConnector *connector, uint widt
continue;
}
const int unusedPixels = (mode->hdisplay - width) * (mode->vdisplay - height);
const int unusedPixels = (mode->hdisplay - width)*(mode->vdisplay - height);
const int fpsDiff = mode->vrefresh - fps;
if ((unusedPixels < minUnusedPixels) ||

+ 2
- 2
src/platforms/rcore_web.c View File

@ -1671,8 +1671,8 @@ static EM_BOOL EmscriptenGamepadCallback(int eventType, const EmscriptenGamepadE
eventType != 0? emscripten_event_type_to_string(eventType) : "Gamepad state",
gamepadEvent->timestamp, gamepadEvent->connected, gamepadEvent->index, gamepadEvent->numAxes, gamepadEvent->numButtons, gamepadEvent->id, gamepadEvent->mapping);
for (int i = 0; i < gamepadEvent->numAxes; o">++i) TRACELOGD("Axis %d: %g", i, gamepadEvent->axis[i]);
for (int i = 0; i < gamepadEvent->numButtons; o">++i) TRACELOGD("Button %d: Digital: %d, Analog: %g", i, gamepadEvent->digitalButton[i], gamepadEvent->analogButton[i]);
for (int i = 0; i < gamepadEvent->numAxes; n">i++) TRACELOGD("Axis %d: %g", i, gamepadEvent->axis[i]);
for (int i = 0; i < gamepadEvent->numButtons; n">i++) TRACELOGD("Button %d: Digital: %d, Analog: %g", i, gamepadEvent->digitalButton[i], gamepadEvent->analogButton[i]);
*/
if (gamepadEvent->connected && (gamepadEvent->index < MAX_GAMEPADS))

+ 1
- 1
src/rmodels.c View File

@ -3289,7 +3289,7 @@ Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize)
for (int z = 0; z < cubicmap.height; ++z)
{
for (int x = 0; x < cubicmap.width; o">++x)
for (int x = 0; x < cubicmap.width; n">x++)
{
// Define the 8 vertex of the cube, we will combine them accordingly later...
Vector3 v1 = { w*(x - 0.5f), h2, h*(z - 0.5f) };

+ 3
- 3
src/rtextures.c View File

@ -3341,14 +3341,14 @@ void ImageClearBackground(Image *dst, Color color)
unsigned char *pSrcPixel = (unsigned char *)dst->data;
int bytesPerPixel = GetPixelDataSize(1, 1, dst->format);
int totalPixels = dst->width * dst->height;
int totalPixels = dst->width*dst->height;
// Repeat the first pixel data throughout the image,
// doubling the pixels copied on each iteration
for (int i = 1; i < totalPixels; i *= 2)
{
int pixelsToCopy = MIN(i, totalPixels - i);
memcpy(pSrcPixel + i * bytesPerPixel, pSrcPixel, pixelsToCopy * bytesPerPixel);
memcpy(pSrcPixel + i*bytesPerPixel, pSrcPixel, pixelsToCopy*bytesPerPixel);
}
}
@ -3730,7 +3730,7 @@ void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color)
for (int x = 1; x < (int)rec.width; x *= 2)
{
int pixelsToCopy = MIN(x, (int)rec.width - x);
memcpy(pSrcPixel + x*bytesPerPixel, pSrcPixel, pixelsToCopy * bytesPerPixel);
memcpy(pSrcPixel + x*bytesPerPixel, pSrcPixel, pixelsToCopy*bytesPerPixel);
}
// Repeat the first row data for all other rows

Loading…
Cancel
Save