mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-06 06:13:10 +00:00
Minor format tweaks
This commit is contained in:
parent
84737a9fc1
commit
f1719480e0
@ -1188,7 +1188,7 @@ Image GetClipboardImage(void)
|
|||||||
size_t dataSize = 0;
|
size_t dataSize = 0;
|
||||||
void *fileData = NULL;
|
void *fileData = NULL;
|
||||||
|
|
||||||
for (int i = 0; i < SDL_arraysize(imageFormats); ++i)
|
for (int i = 0; i < SDL_arraysize(imageFormats); i++)
|
||||||
{
|
{
|
||||||
// NOTE: This pointer should be free with SDL_free() at some point
|
// NOTE: This pointer should be free with SDL_free() at some point
|
||||||
fileData = SDL_GetClipboardData(imageFormats[i], &dataSize);
|
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
|
// WARNING: Indexes into this array are obtained by using SDL_Scancode values, not SDL_Keycode values
|
||||||
//const Uint8 *keys = SDL_GetKeyboardState(NULL);
|
//const Uint8 *keys = SDL_GetKeyboardState(NULL);
|
||||||
//for (int i = 0; i < 256; ++i) CORE.Input.Keyboard.currentKeyState[i] = keys[i];
|
//for (int i = 0; i < 256; i++) CORE.Input.Keyboard.currentKeyState[i] = keys[i];
|
||||||
|
|
||||||
CORE.Window.resizedLastFrame = false;
|
CORE.Window.resizedLastFrame = false;
|
||||||
|
|
||||||
@ -1562,7 +1562,7 @@ void PollInputEvents(void)
|
|||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
{
|
{
|
||||||
#if defined(USING_VERSION_SDL3)
|
#if defined(USING_VERSION_SDL3)
|
||||||
// SDL3 Migration: The following structures have been removed: * SDL_Keysym
|
// SDL3 Migration: The following structures have been removed: SDL_Keysym
|
||||||
KeyboardKey key = ConvertScancodeToKey(event.key.scancode);
|
KeyboardKey key = ConvertScancodeToKey(event.key.scancode);
|
||||||
#else
|
#else
|
||||||
KeyboardKey key = ConvertScancodeToKey(event.key.keysym.scancode);
|
KeyboardKey key = ConvertScancodeToKey(event.key.keysym.scancode);
|
||||||
@ -1697,7 +1697,7 @@ void PollInputEvents(void)
|
|||||||
int jid = event.jdevice.which; // Joystick device index
|
int jid = event.jdevice.which; // Joystick device index
|
||||||
|
|
||||||
// check if already added at InitPlatform
|
// check if already added at InitPlatform
|
||||||
for (int i = 0; i < MAX_GAMEPADS; ++i)
|
for (int i = 0; i < MAX_GAMEPADS; i++)
|
||||||
{
|
{
|
||||||
if (jid == platform.gamepadId[i])
|
if (jid == platform.gamepadId[i])
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1456,7 +1456,7 @@ int InitPlatform(void)
|
|||||||
|
|
||||||
// find the EGL config that matches the previously setup GBM format
|
// find the EGL config that matches the previously setup GBM format
|
||||||
int found = 0;
|
int found = 0;
|
||||||
for (EGLint i = 0; i < matchingNumConfigs; ++i)
|
for (EGLint i = 0; i < matchingNumConfigs; i++)
|
||||||
{
|
{
|
||||||
EGLint id = 0;
|
EGLint id = 0;
|
||||||
if (!eglGetConfigAttrib(platform.device, configs[i], EGL_NATIVE_VISUAL_ID, &id))
|
if (!eglGetConfigAttrib(platform.device, configs[i], EGL_NATIVE_VISUAL_ID, &id))
|
||||||
@ -1878,7 +1878,7 @@ static void InitEvdevInput(void)
|
|||||||
platform.mouseFd = -1;
|
platform.mouseFd = -1;
|
||||||
|
|
||||||
// Reset variables
|
// Reset variables
|
||||||
for (int i = 0; i < MAX_TOUCH_POINTS; ++i)
|
for (int i = 0; i < MAX_TOUCH_POINTS; i++)
|
||||||
{
|
{
|
||||||
CORE.Input.Touch.position[i].x = -1;
|
CORE.Input.Touch.position[i].x = -1;
|
||||||
CORE.Input.Touch.position[i].y = -1;
|
CORE.Input.Touch.position[i].y = -1;
|
||||||
@ -2463,7 +2463,7 @@ static int FindNearestConnectorMode(const drmModeConnector *connector, uint widt
|
|||||||
continue;
|
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;
|
const int fpsDiff = mode->vrefresh - fps;
|
||||||
|
|
||||||
if ((unusedPixels < minUnusedPixels) ||
|
if ((unusedPixels < minUnusedPixels) ||
|
||||||
|
|||||||
@ -1671,8 +1671,8 @@ static EM_BOOL EmscriptenGamepadCallback(int eventType, const EmscriptenGamepadE
|
|||||||
eventType != 0? emscripten_event_type_to_string(eventType) : "Gamepad state",
|
eventType != 0? emscripten_event_type_to_string(eventType) : "Gamepad state",
|
||||||
gamepadEvent->timestamp, gamepadEvent->connected, gamepadEvent->index, gamepadEvent->numAxes, gamepadEvent->numButtons, gamepadEvent->id, gamepadEvent->mapping);
|
gamepadEvent->timestamp, gamepadEvent->connected, gamepadEvent->index, gamepadEvent->numAxes, gamepadEvent->numButtons, gamepadEvent->id, gamepadEvent->mapping);
|
||||||
|
|
||||||
for (int i = 0; i < gamepadEvent->numAxes; ++i) TRACELOGD("Axis %d: %g", i, gamepadEvent->axis[i]);
|
for (int i = 0; i < gamepadEvent->numAxes; i++) TRACELOGD("Axis %d: %g", i, gamepadEvent->axis[i]);
|
||||||
for (int i = 0; i < gamepadEvent->numButtons; ++i) TRACELOGD("Button %d: Digital: %d, Analog: %g", i, gamepadEvent->digitalButton[i], gamepadEvent->analogButton[i]);
|
for (int i = 0; i < gamepadEvent->numButtons; i++) TRACELOGD("Button %d: Digital: %d, Analog: %g", i, gamepadEvent->digitalButton[i], gamepadEvent->analogButton[i]);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (gamepadEvent->connected && (gamepadEvent->index < MAX_GAMEPADS))
|
if (gamepadEvent->connected && (gamepadEvent->index < MAX_GAMEPADS))
|
||||||
|
|||||||
@ -3289,7 +3289,7 @@ Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize)
|
|||||||
|
|
||||||
for (int z = 0; z < cubicmap.height; ++z)
|
for (int z = 0; z < cubicmap.height; ++z)
|
||||||
{
|
{
|
||||||
for (int x = 0; x < cubicmap.width; ++x)
|
for (int x = 0; x < cubicmap.width; x++)
|
||||||
{
|
{
|
||||||
// Define the 8 vertex of the cube, we will combine them accordingly later...
|
// Define the 8 vertex of the cube, we will combine them accordingly later...
|
||||||
Vector3 v1 = { w*(x - 0.5f), h2, h*(z - 0.5f) };
|
Vector3 v1 = { w*(x - 0.5f), h2, h*(z - 0.5f) };
|
||||||
|
|||||||
@ -3341,14 +3341,14 @@ void ImageClearBackground(Image *dst, Color color)
|
|||||||
|
|
||||||
unsigned char *pSrcPixel = (unsigned char *)dst->data;
|
unsigned char *pSrcPixel = (unsigned char *)dst->data;
|
||||||
int bytesPerPixel = GetPixelDataSize(1, 1, dst->format);
|
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,
|
// Repeat the first pixel data throughout the image,
|
||||||
// doubling the pixels copied on each iteration
|
// doubling the pixels copied on each iteration
|
||||||
for (int i = 1; i < totalPixels; i *= 2)
|
for (int i = 1; i < totalPixels; i *= 2)
|
||||||
{
|
{
|
||||||
int pixelsToCopy = MIN(i, totalPixels - i);
|
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)
|
for (int x = 1; x < (int)rec.width; x *= 2)
|
||||||
{
|
{
|
||||||
int pixelsToCopy = MIN(x, (int)rec.width - x);
|
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
|
// Repeat the first row data for all other rows
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user