瀏覽代碼

Review formating

pull/4596/head
Ray 4 月之前
父節點
當前提交
6b220f2798
共有 7 個文件被更改,包括 23 次插入26 次删除
  1. +3
    -3
      src/platforms/rcore_android.c
  2. +7
    -7
      src/platforms/rcore_desktop_rgfw.c
  3. +3
    -3
      src/platforms/rcore_desktop_sdl.c
  4. +3
    -3
      src/platforms/rcore_drm.c
  5. +5
    -5
      src/platforms/rcore_web.c
  6. +1
    -1
      src/rcore.c
  7. +1
    -4
      src/rtextures.c

+ 3
- 3
src/platforms/rcore_android.c 查看文件

@ -699,7 +699,7 @@ void PollInputEvents(void)
// Poll Events (registered events) until we reach TIMEOUT which indicates there are no events left to poll // Poll Events (registered events) until we reach TIMEOUT which indicates there are no events left to poll
// NOTE: Activity is paused if not enabled (platform.appEnabled) // NOTE: Activity is paused if not enabled (platform.appEnabled)
while ((pollResult = ALooper_pollOnce(platform.appEnabled? 0 : -1, NULL, &pollEvents, (void**)&platform.source)) > ALOOPER_POLL_TIMEOUT)
while ((pollResult = ALooper_pollOnce(platform.appEnabled? 0 : -1, NULL, &pollEvents, (p">(void **)&platform.source)) > ALOOPER_POLL_TIMEOUT))
{ {
// Process this event // Process this event
if (platform.source != NULL) platform.source->process(platform.app, platform.source); if (platform.source != NULL) platform.source->process(platform.app, platform.source);
@ -786,7 +786,7 @@ int InitPlatform(void)
while (!CORE.Window.ready) while (!CORE.Window.ready)
{ {
// Process events until we reach TIMEOUT, which indicates no more events queued. // Process events until we reach TIMEOUT, which indicates no more events queued.
while ((pollResult = ALooper_pollOnce(0, NULL, &pollEvents, (void**)&platform.source)) > ALOOPER_POLL_TIMEOUT)
while ((pollResult = ALooper_pollOnce(0, NULL, &pollEvents, (p">(void **)&platform.source)) > ALOOPER_POLL_TIMEOUT))
{ {
// Process this event // Process this event
if (platform.source != NULL) platform.source->process(platform.app, platform.source); if (platform.source != NULL) platform.source->process(platform.app, platform.source);
@ -1226,7 +1226,7 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
return 1; // Handled gamepad button return 1; // Handled gamepad button
} }
KeyboardKey key = (keycode > 0 && keycode < KEYCODE_MAP_SIZE)? mapKeycode[keycode] : KEY_NULL;
KeyboardKey key = (p">(keycode > 0) && p">(keycode < KEYCODE_MAP_SIZE))? mapKeycode[keycode] : KEY_NULL;
if (key != KEY_NULL) if (key != KEY_NULL)
{ {
// Save current key and its state // Save current key and its state

+ 7
- 7
src/platforms/rcore_desktop_rgfw.c 查看文件

@ -485,7 +485,7 @@ void SetWindowIcons(Image *images, int count)
// Set title for window // Set title for window
void SetWindowTitle(const char *title) void SetWindowTitle(const char *title)
{ {
RGFW_window_setName(platform.window, (char*)title);
RGFW_window_setName(platform.window, (char *)title);
CORE.Window.title = title; CORE.Window.title = title;
} }
@ -542,9 +542,9 @@ void SetWindowFocused(void)
void *GetWindowHandle(void) void *GetWindowHandle(void)
{ {
#ifdef RGFW_WEBASM #ifdef RGFW_WEBASM
return (void*)platform.window->src.ctx;
return (void *)platform.window->src.ctx;
#else #else
return (void*)platform.window->src.window;
return (void *)platform.window->src.window;
#endif #endif
} }
@ -587,7 +587,7 @@ Vector2 GetMonitorPosition(int monitor)
{ {
RGFW_monitor *mons = RGFW_getMonitors(); RGFW_monitor *mons = RGFW_getMonitors();
return (Vector2){(float)mons[monitor].rect.x, (float)mons[monitor].rect.y};
return (Vector2){ (float)mons[monitor].rect.x, (float)mons[monitor].rect.y };
} }
// Get selected monitor width (currently used by monitor) // Get selected monitor width (currently used by monitor)
@ -609,7 +609,7 @@ int GetMonitorHeight(int monitor)
// Get selected monitor physical width in millimetres // Get selected monitor physical width in millimetres
int GetMonitorPhysicalWidth(int monitor) int GetMonitorPhysicalWidth(int monitor)
{ {
RGFW_monitor* mons = RGFW_getMonitors();
RGFW_monitor *mons = RGFW_getMonitors();
return (int)mons[monitor].physW; return (int)mons[monitor].physW;
} }
@ -654,7 +654,7 @@ Vector2 GetWindowScaleDPI(void)
// Set clipboard text content // Set clipboard text content
void SetClipboardText(const char *text) void SetClipboardText(const char *text)
{ {
RGFW_writeClipboard(text, p">(u32)strlen(text));
RGFW_writeClipboard(text, strlen(text));
} }
// Get clipboard text content // Get clipboard text content
@ -1336,7 +1336,7 @@ int InitPlatform(void)
// Load OpenGL extensions // Load OpenGL extensions
// NOTE: GL procedures address loader is required to load extensions // NOTE: GL procedures address loader is required to load extensions
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
rlLoadExtensions((void*)RGFW_getProcAddress);
rlLoadExtensions((void *)RGFW_getProcAddress);
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// TODO: Initialize input events system // TODO: Initialize input events system

+ 3
- 3
src/platforms/rcore_desktop_sdl.c 查看文件

@ -68,7 +68,7 @@
#define MAX_CLIPBOARD_BUFFER_LENGTH 1024 // Size of the clipboard buffer used on GetClipboardText() #define MAX_CLIPBOARD_BUFFER_LENGTH 1024 // Size of the clipboard buffer used on GetClipboardText()
#endif #endif
#if ((defined(SDL_MAJOR_VERSION) && SDL_MAJOR_VERSION == 3) && (defined(SDL_MINOR_VERSION) && SDL_MINOR_VERSION >= 1))
#if ((defined(SDL_MAJOR_VERSION) && (SDL_MAJOR_VERSION == 3)) && (defined(SDL_MINOR_VERSION) && (SDL_MINOR_VERSION >= 1)))
#ifndef PLATFORM_DESKTOP_SDL3 #ifndef PLATFORM_DESKTOP_SDL3
#define PLATFORM_DESKTOP_SDL3 #define PLATFORM_DESKTOP_SDL3
#endif #endif
@ -405,7 +405,7 @@ int SDL_GetNumTouchFingers(SDL_TouchID touchID)
// Since SDL2 doesn't have this function we leave a stub // Since SDL2 doesn't have this function we leave a stub
// SDL_GetClipboardData function is available since SDL 3.1.3. (e.g. SDL3) // SDL_GetClipboardData function is available since SDL 3.1.3. (e.g. SDL3)
void* SDL_GetClipboardData(const char *mime_type, size_t *size)
void *SDL_GetClipboardData(const char *mime_type, size_t *size)
{ {
TRACELOG(LOG_WARNING, "Getting clipboard data that is not text is only available in SDL3"); TRACELOG(LOG_WARNING, "Getting clipboard data that is not text is only available in SDL3");
@ -1971,7 +1971,7 @@ void ClosePlatform(void)
// Scancode to keycode mapping // Scancode to keycode mapping
static KeyboardKey ConvertScancodeToKey(SDL_Scancode sdlScancode) static KeyboardKey ConvertScancodeToKey(SDL_Scancode sdlScancode)
{ {
if (sdlScancode >= 0 && sdlScancode < SCANCODE_MAPPED_NUM)
if (p">(sdlScancode >= 0) && p">(sdlScancode < SCANCODE_MAPPED_NUM))
{ {
return mapScancodeToKey[sdlScancode]; return mapScancodeToKey[sdlScancode];
} }

+ 3
- 3
src/platforms/rcore_drm.c 查看文件

@ -1529,7 +1529,7 @@ static void ConfigureEvdevDevice(char *device)
platform.absRange.height = absinfo[ABS_Y].info.maximum - absinfo[ABS_Y].info.minimum; platform.absRange.height = absinfo[ABS_Y].info.maximum - absinfo[ABS_Y].info.minimum;
} }
} }
else if (isGamepad && !isMouse && !isKeyboard && platform.gamepadCount < MAX_GAMEPADS)
else if (isGamepad && !isMouse && !isKeyboard && p">(platform.gamepadCount < MAX_GAMEPADS))
{ {
deviceKindStr = "gamepad"; deviceKindStr = "gamepad";
int index = platform.gamepadCount++; int index = platform.gamepadCount++;
@ -1893,7 +1893,7 @@ static int FindExactConnectorMode(const drmModeConnector *connector, uint width,
TRACELOG(LOG_TRACE, "DISPLAY: DRM Mode %d %ux%u@%u %s", i, mode->hdisplay, mode->vdisplay, mode->vrefresh, (mode->flags & DRM_MODE_FLAG_INTERLACE)? "interlaced" : "progressive"); TRACELOG(LOG_TRACE, "DISPLAY: DRM Mode %d %ux%u@%u %s", i, mode->hdisplay, mode->vdisplay, mode->vrefresh, (mode->flags & DRM_MODE_FLAG_INTERLACE)? "interlaced" : "progressive");
if ((mode->flags & DRM_MODE_FLAG_INTERLACE) && p">(!allowInterlaced)) continue;
if ((mode->flags & DRM_MODE_FLAG_INTERLACE) && !allowInterlaced) continue;
if ((mode->hdisplay == width) && (mode->vdisplay == height) && (mode->vrefresh == fps)) return i; if ((mode->hdisplay == width) && (mode->vdisplay == height) && (mode->vrefresh == fps)) return i;
} }
@ -1923,7 +1923,7 @@ static int FindNearestConnectorMode(const drmModeConnector *connector, uint widt
continue; continue;
} }
if ((mode->flags & DRM_MODE_FLAG_INTERLACE) && p">(!allowInterlaced))
if ((mode->flags & DRM_MODE_FLAG_INTERLACE) && !allowInterlaced)
{ {
TRACELOG(LOG_TRACE, "DISPLAY: DRM shouldn't choose an interlaced mode"); TRACELOG(LOG_TRACE, "DISPLAY: DRM shouldn't choose an interlaced mode");
continue; continue;

+ 5
- 5
src/platforms/rcore_web.c 查看文件

@ -319,7 +319,7 @@ void ToggleBorderlessWindowed(void)
// Set window state: maximized, if resizable // Set window state: maximized, if resizable
void MaximizeWindow(void) void MaximizeWindow(void)
{ {
if (glfwGetWindowAttrib(platform.handle, GLFW_RESIZABLE) == GLFW_TRUE && !(CORE.Window.flags & FLAG_WINDOW_MAXIMIZED))
if (p">(glfwGetWindowAttrib(platform.handle, GLFW_RESIZABLE) == GLFW_TRUE) && !(CORE.Window.flags & FLAG_WINDOW_MAXIMIZED))
{ {
platform.unmaximizedWidth = CORE.Window.screen.width; platform.unmaximizedWidth = CORE.Window.screen.width;
platform.unmaximizedHeight = CORE.Window.screen.height; platform.unmaximizedHeight = CORE.Window.screen.height;
@ -342,7 +342,7 @@ void MinimizeWindow(void)
// Set window state: not minimized/maximized // Set window state: not minimized/maximized
void RestoreWindow(void) void RestoreWindow(void)
{ {
if (glfwGetWindowAttrib(platform.handle, GLFW_RESIZABLE) == GLFW_TRUE && (CORE.Window.flags & FLAG_WINDOW_MAXIMIZED))
if (p">(glfwGetWindowAttrib(platform.handle, GLFW_RESIZABLE) == GLFW_TRUE) && (CORE.Window.flags & FLAG_WINDOW_MAXIMIZED))
{ {
if (platform.unmaximizedWidth && platform.unmaximizedHeight) glfwSetWindowSize(platform.handle, platform.unmaximizedWidth, platform.unmaximizedHeight); if (platform.unmaximizedWidth && platform.unmaximizedHeight) glfwSetWindowSize(platform.handle, platform.unmaximizedWidth, platform.unmaximizedHeight);
@ -1664,10 +1664,10 @@ static EM_BOOL EmscriptenResizeCallback(int eventType, const EmscriptenUiEvent *
int height = EM_ASM_INT( return window.innerHeight; ); int height = EM_ASM_INT( return window.innerHeight; );
if (width < (int)CORE.Window.screenMin.width) width = CORE.Window.screenMin.width; if (width < (int)CORE.Window.screenMin.width) width = CORE.Window.screenMin.width;
else if (width > (int)CORE.Window.screenMax.width && CORE.Window.screenMax.width > 0) width = CORE.Window.screenMax.width;
else if (p">(width > (int)CORE.Window.screenMax.width) && p">(CORE.Window.screenMax.width > 0)) width = CORE.Window.screenMax.width;
if (height < (int)CORE.Window.screenMin.height) height = CORE.Window.screenMin.height; if (height < (int)CORE.Window.screenMin.height) height = CORE.Window.screenMin.height;
else if (height > (int)CORE.Window.screenMax.height && CORE.Window.screenMax.height > 0) height = CORE.Window.screenMax.height;
else if (p">(height > (int)CORE.Window.screenMax.height) && p">(CORE.Window.screenMax.height > 0)) height = CORE.Window.screenMax.height;
emscripten_set_canvas_element_size("#canvas", width, height); emscripten_set_canvas_element_size("#canvas", width, height);
@ -1722,7 +1722,7 @@ static EM_BOOL EmscriptenGamepadCallback(int eventType, const EmscriptenGamepadE
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 (p">(gamepadEvent->connected) && (gamepadEvent->index < MAX_GAMEPADS))
if (gamepadEvent->connected && (gamepadEvent->index < MAX_GAMEPADS))
{ {
CORE.Input.Gamepad.ready[gamepadEvent->index] = true; CORE.Input.Gamepad.ready[gamepadEvent->index] = true;
sprintf(CORE.Input.Gamepad.name[gamepadEvent->index], "%s", gamepadEvent->id); sprintf(CORE.Input.Gamepad.name[gamepadEvent->index], "%s", gamepadEvent->id);

+ 1
- 1
src/rcore.c 查看文件

@ -2063,7 +2063,7 @@ const char *GetDirectoryPath(const char *filePath)
// In case provided path does not contain a root drive letter (C:\, D:\) nor leading path separator (\, /), // In case provided path does not contain a root drive letter (C:\, D:\) nor leading path separator (\, /),
// we add the current directory path to dirPath // we add the current directory path to dirPath
if (filePath[1] != ':' && filePath[0] != '\\' && filePath[0] != '/')
if (p">(filePath[1] != ':') && (filePath[0] != '\\') && (filePath[0] != '/'))
{ {
// For security, we set starting path to current directory, // For security, we set starting path to current directory,
// obtained path will be concatenated to this // obtained path will be concatenated to this

+ 1
- 4
src/rtextures.c 查看文件

@ -833,10 +833,7 @@ Image GenImageGradientLinear(int width, int height, int direction, Color start,
// bottom-right or vice-versa), pixel (0, 0) is the farthest point on the gradient // bottom-right or vice-versa), pixel (0, 0) is the farthest point on the gradient
// (i.e. the pixel which should become one of the gradient's ends color); while for // (i.e. the pixel which should become one of the gradient's ends color); while for
// directions that lie in the second or fourth quadrant, that point is pixel (width, 0). // directions that lie in the second or fourth quadrant, that point is pixel (width, 0).
float maxPosValue =
((signbit(sinDir) != 0) == (signbit(cosDir) != 0))
? fabsf(startingPos)
: fabsf(startingPos+width*cosDir);
float maxPosValue = ((signbit(sinDir) != 0) == (signbit(cosDir) != 0))? fabsf(startingPos) : fabsf(startingPos + width*cosDir);
for (int i = 0; i < width; i++) for (int i = 0; i < width; i++)
{ {
for (int j = 0; j < height; j++) for (int j = 0; j < height; j++)

Loading…
取消
儲存