Remove trailing spaces

This commit is contained in:
Ray 2026-01-01 16:33:34 +01:00
parent eb4ad50d99
commit 909f040dc5
15 changed files with 108 additions and 108 deletions

View File

@ -360,7 +360,7 @@ void RestoreWindow(void)
void SetWindowState(unsigned int flags)
{
if (!CORE.Window.ready) TRACELOG(LOG_WARNING, "WINDOW: SetWindowState does nothing before window initialization, Use \"SetConfigFlags\" instead");
// State change: FLAG_WINDOW_ALWAYS_RUN
if (FLAG_IS_SET(flags, FLAG_WINDOW_ALWAYS_RUN)) FLAG_SET(CORE.Window.flags, FLAG_WINDOW_ALWAYS_RUN);
}

View File

@ -188,7 +188,7 @@ void ToggleFullscreen(void)
GLFWmonitor **monitors = glfwGetMonitors(&monitorCount);
GLFWmonitor *monitor = (monitorIndex < monitorCount)? monitors[monitorIndex] : NULL;
if (monitor != NULL)
if (monitor != NULL)
{
// Get current monitor video mode
const GLFWvidmode *mode = glfwGetVideoMode(monitors[monitorIndex]);
@ -233,7 +233,7 @@ void ToggleFullscreen(void)
#endif
// WARNING: This function launches FramebufferSizeCallback()
glfwSetWindowMonitor(platform.handle, NULL, CORE.Window.position.x, CORE.Window.position.y,
glfwSetWindowMonitor(platform.handle, NULL, CORE.Window.position.x, CORE.Window.position.y,
CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE);
#if defined(_GLFW_X11) || defined(_GLFW_WAYLAND)
@ -283,7 +283,7 @@ void ToggleBorderlessWindowed(void)
CORE.Window.screen.height = mode->height;
// Set screen position and size
glfwSetWindowMonitor(platform.handle, monitors[monitor], CORE.Window.position.x, CORE.Window.position.y,
glfwSetWindowMonitor(platform.handle, monitors[monitor], CORE.Window.position.x, CORE.Window.position.y,
CORE.Window.screen.width, CORE.Window.screen.height, mode->refreshRate);
// Refocus window
@ -312,7 +312,7 @@ void ToggleBorderlessWindowed(void)
#endif
// Return to previous screen size and position
glfwSetWindowMonitor(platform.handle, NULL, CORE.Window.position.x, CORE.Window.position.y,
glfwSetWindowMonitor(platform.handle, NULL, CORE.Window.position.x, CORE.Window.position.y,
CORE.Window.screen.width, CORE.Window.screen.height, mode->refreshRate);
// Refocus window
@ -908,7 +908,7 @@ Vector2 GetMonitorPosition(int monitor)
if ((monitor >= 0) && (monitor < monitorCount))
{
int x = 0;
int x = 0;
int y = 0;
glfwGetMonitorPos(monitors[monitor], &x, &y);
@ -1026,7 +1026,7 @@ Vector2 GetWindowPosition(void)
Vector2 GetWindowScaleDPI(void)
{
Vector2 scale = { 1.0f, 1.0f };
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI) && !FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE))
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI) && !FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE))
glfwGetWindowContentScale(platform.handle, &scale.x, &scale.y);
return scale;
}
@ -1275,7 +1275,7 @@ void PollInputEvents(void)
state.axes[GAMEPAD_AXIS_LEFT_TRIGGER] = -1.0f;
state.axes[GAMEPAD_AXIS_RIGHT_TRIGGER] = -1.0f;
}
const unsigned char *buttons = state.buttons;
for (int k = 0; (buttons != NULL) && (k < MAX_GAMEPAD_BUTTONS); k++)
@ -1345,7 +1345,7 @@ void PollInputEvents(void)
CORE.Window.resizedLastFrame = false;
if ((CORE.Window.eventWaiting) ||
if ((CORE.Window.eventWaiting) ||
(FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED) && !FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_ALWAYS_RUN)))
{
glfwWaitEvents(); // Wait for in input events before continue (drawing is paused)
@ -1455,7 +1455,7 @@ int InitPlatform(void)
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_FALSE);
#endif
// Resize window content area based on the monitor content scale
// NOTE: This hint only has an effect on platforms where screen coordinates and
// NOTE: This hint only has an effect on platforms where screen coordinates and
// pixels always map 1:1 such as Windows and X11
// On platforms like macOS the resolution of the framebuffer is changed independently of the window size
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
@ -1463,7 +1463,7 @@ int InitPlatform(void)
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_TRUE);
#endif
}
else
else
{
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_FALSE);
#if defined(__APPLE__)

View File

@ -330,7 +330,7 @@ void ToggleFullscreen(void)
void ToggleBorderlessWindowed(void)
{
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE)) ToggleFullscreen();
if (FLAG_IS_SET(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE))
{
CORE.Window.previousPosition = CORE.Window.position;

View File

@ -1425,8 +1425,8 @@ void PollInputEvents(void)
#if defined(USING_VERSION_SDL3)
// const char *data; // The text for SDL_EVENT_DROP_TEXT and the file name for SDL_EVENT_DROP_FILE, NULL for other events
// Event memory is now managed by SDL, so you should not free the data in SDL_EVENT_DROP_FILE,
// and if you want to hold onto the text in SDL_EVENT_TEXT_EDITING and SDL_EVENT_TEXT_INPUT events,
// Event memory is now managed by SDL, so you should not free the data in SDL_EVENT_DROP_FILE,
// and if you want to hold onto the text in SDL_EVENT_TEXT_EDITING and SDL_EVENT_TEXT_INPUT events,
// you should make a copy of it. SDL_TEXTINPUTEVENT_TEXT_SIZE is no longer necessary and has been removed
strncpy(CORE.Window.dropFilepaths[CORE.Window.dropFileCount], event.drop.data, MAX_FILEPATH_LENGTH - 1);
#else
@ -1487,7 +1487,7 @@ void PollInputEvents(void)
CORE.Window.resizedLastFrame = true;
#ifndef USING_VERSION_SDL3
// Manually detect if the window was maximized (due to SDL2 restore being unreliable on some platforms)
// Manually detect if the window was maximized (due to SDL2 restore being unreliable on some platforms)
// to remove the FLAG_WINDOW_MAXIMIZED accordingly
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED))
{

View File

@ -263,7 +263,7 @@ static bool DecoratedFromStyle(DWORD style)
static DWORD MakeWindowStyle(unsigned flags)
{
// Flag is not needed because there are no child windows,
// but supposedly it improves efficiency, plus, windows adds this
// but supposedly it improves efficiency, plus, windows adds this
// flag automatically anyway so it keeps flags in sync with the OS
DWORD style = WS_CLIPSIBLINGS;
@ -1880,19 +1880,19 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
// Get current dpi scale factor
float scalex = HIWORD(wParam)/96.0f;
float scaley = LOWORD(wParam)/96.0f;
RECT *suggestedRect = (RECT *)lparam;
// Never set the window size to anything other than the suggested rect here
// Doing so can cause a window to stutter between monitors when transitioning between them
int result = (int)SetWindowPos(hwnd, NULL,
int result = (int)SetWindowPos(hwnd, NULL,
suggestedRect->left, suggestedRect->top,
suggestedRect->right - suggestedRect->left,
suggestedRect->bottom - suggestedRect->top,
suggestedRect->right - suggestedRect->left,
suggestedRect->bottom - suggestedRect->top,
SWP_NOZORDER | SWP_NOACTIVATE);
if (result == 0) TRACELOG(LOG_ERROR, "Failed to set window position [ERROR: %lu]", GetLastError());
// TODO: Update screen data, render size, screen scaling, viewport...
} break;

View File

@ -1606,10 +1606,10 @@ int InitPlatform(void)
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED)) MinimizeWindow();
// If graphic device is no properly initialized, we end program
if (!CORE.Window.ready)
{
TRACELOG(LOG_FATAL, "PLATFORM: Failed to initialize graphic device");
return -1;
if (!CORE.Window.ready)
{
TRACELOG(LOG_FATAL, "PLATFORM: Failed to initialize graphic device");
return -1;
}
else SetWindowPosition(GetMonitorWidth(GetCurrentMonitor())/2 - CORE.Window.screen.width/2, GetMonitorHeight(GetCurrentMonitor())/2 - CORE.Window.screen.height/2);
@ -1933,7 +1933,7 @@ static void InitEvdevInput(void)
platform.touchPosition[i].y = -1;
platform.touchId[i] = -1;
}
// Initialize touch slot
platform.touchSlot = 0;
@ -2116,13 +2116,13 @@ static void ConfigureEvdevDevice(char *device)
if (prioritize)
{
deviceKindStr = isTouch? "touchscreen" : "mouse";
if (platform.mouseFd != -1)
if (platform.mouseFd != -1)
{
TRACELOG(LOG_INFO, "INPUT: Overwriting previous input device with new %s", deviceKindStr);
close(platform.mouseFd);
}
platform.mouseFd = fd;
platform.mouseIsTouch = isTouch;
@ -2134,7 +2134,7 @@ static void ConfigureEvdevDevice(char *device)
platform.absRange.y = absinfo[ABS_Y].info.minimum;
platform.absRange.height = absinfo[ABS_Y].info.maximum - absinfo[ABS_Y].info.minimum;
}
TRACELOG(LOG_INFO, "INPUT: Initialized input device %s as %s", device, deviceKindStr);
}
else
@ -2357,9 +2357,9 @@ static void PollMouseEvents(void)
if (event.code == ABS_X)
{
CORE.Input.Mouse.currentPosition.x = (event.value - platform.absRange.x)*CORE.Window.screen.width/platform.absRange.width; // Scale according to absRange
// Update single touch position only if it's active and no MT events are being used
if (platform.touchActive[0] && !isMultitouch)
if (platform.touchActive[0] && !isMultitouch)
{
platform.touchPosition[0].x = (event.value - platform.absRange.x)*CORE.Window.screen.width/platform.absRange.width;
if (touchAction == -1) touchAction = 2; // TOUCH_ACTION_MOVE
@ -2369,9 +2369,9 @@ static void PollMouseEvents(void)
if (event.code == ABS_Y)
{
CORE.Input.Mouse.currentPosition.y = (event.value - platform.absRange.y)*CORE.Window.screen.height/platform.absRange.height; // Scale according to absRange
// Update single touch position only if it's active and no MT events are being used
if (platform.touchActive[0] && !isMultitouch)
if (platform.touchActive[0] && !isMultitouch)
{
platform.touchPosition[0].y = (event.value - platform.absRange.y)*CORE.Window.screen.height/platform.absRange.height;
if (touchAction == -1) touchAction = 2; // TOUCH_ACTION_MOVE
@ -2379,9 +2379,9 @@ static void PollMouseEvents(void)
}
// Multitouch movement
if (event.code == ABS_MT_SLOT)
if (event.code == ABS_MT_SLOT)
{
platform.touchSlot = event.value;
platform.touchSlot = event.value;
isMultitouch = true;
}
@ -2391,7 +2391,7 @@ static void PollMouseEvents(void)
if (platform.touchSlot < MAX_TOUCH_POINTS)
{
platform.touchPosition[platform.touchSlot].x = (event.value - platform.absRange.x)*CORE.Window.screen.width/platform.absRange.width;
// If this slot is active, it's a move. If not, we are just updating the buffer for when it becomes active.
// Only set to MOVE if we haven't already detected a DOWN or UP event this frame
if (platform.touchActive[platform.touchSlot] && touchAction == -1) touchAction = 2; // TOUCH_ACTION_MOVE
@ -2403,7 +2403,7 @@ static void PollMouseEvents(void)
if (platform.touchSlot < MAX_TOUCH_POINTS)
{
platform.touchPosition[platform.touchSlot].y = (event.value - platform.absRange.y)*CORE.Window.screen.height/platform.absRange.height;
// If this slot is active, it's a move. If not, we are just updating the buffer for when it becomes active.
// Only set to MOVE if we haven't already detected a DOWN or UP event this frame
if (platform.touchActive[platform.touchSlot] && touchAction == -1) touchAction = 2; // TOUCH_ACTION_MOVE
@ -2419,7 +2419,7 @@ static void PollMouseEvents(void)
platform.touchActive[platform.touchSlot] = true;
platform.touchId[platform.touchSlot] = event.value; // Use Tracking ID for unique IDs
touchAction = 1; // TOUCH_ACTION_DOWN
}
else
@ -2429,7 +2429,7 @@ static void PollMouseEvents(void)
platform.touchPosition[platform.touchSlot].x = -1;
platform.touchPosition[platform.touchSlot].y = -1;
platform.touchId[platform.touchSlot] = -1;
// Force UP action if we haven't already set a DOWN action
// (DOWN takes priority over UP if both happen in one frame, though rare)
if (touchAction != 1) touchAction = 0; // TOUCH_ACTION_UP
@ -2486,7 +2486,7 @@ static void PollMouseEvents(void)
if (event.value > 0)
{
bool activateSlot0 = false;
if (event.code == BTN_LEFT) activateSlot0 = true; // Mouse click always activates
else if (event.code == BTN_TOUCH)
{
@ -2534,11 +2534,11 @@ static void PollMouseEvents(void)
if (!CORE.Input.Mouse.cursorLocked)
{
if (CORE.Input.Mouse.currentPosition.x < 0) CORE.Input.Mouse.currentPosition.x = 0;
if (CORE.Input.Mouse.currentPosition.x > CORE.Window.screen.width/CORE.Input.Mouse.scale.x)
if (CORE.Input.Mouse.currentPosition.x > CORE.Window.screen.width/CORE.Input.Mouse.scale.x)
CORE.Input.Mouse.currentPosition.x = CORE.Window.screen.width/CORE.Input.Mouse.scale.x;
if (CORE.Input.Mouse.currentPosition.y < 0) CORE.Input.Mouse.currentPosition.y = 0;
if (CORE.Input.Mouse.currentPosition.y > CORE.Window.screen.height/CORE.Input.Mouse.scale.y)
if (CORE.Input.Mouse.currentPosition.y > CORE.Window.screen.height/CORE.Input.Mouse.scale.y)
CORE.Input.Mouse.currentPosition.y = CORE.Window.screen.height/CORE.Input.Mouse.scale.y;
}
@ -2553,9 +2553,9 @@ static void PollMouseEvents(void)
k++;
}
}
CORE.Input.Touch.pointCount = k;
// Clear remaining slots
for (int i = k; i < MAX_TOUCH_POINTS; i++)
{

View File

@ -472,7 +472,7 @@ void PollInputEvents(void)
}
// TODO: Poll input events for current platform
// Check for key pressed to exit
if (kbhit())
{
@ -513,7 +513,7 @@ int InitPlatform(void)
TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
TRACELOG(LOG_INFO, " > Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
TRACELOG(LOG_INFO, " > Viewport offsets: %i, %i", CORE.Window.renderOffset.x, CORE.Window.renderOffset.y);
CORE.Window.ready = true;
// TODO: Load OpenGL extensions

View File

@ -76,10 +76,10 @@ typedef struct {
bool ourFullscreen; // Internal var to filter our handling of fullscreen vs the user handling of fullscreen
int unmaximizedWidth; // Internal var to store the unmaximized window (canvas) width
int unmaximizedHeight; // Internal var to store the unmaximized window (canvas) height
char canvasId[64]; // Keep current canvas id where wasm app is running
// NOTE: Useful when trying to run multiple wasms in different canvases in same webpage
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
unsigned int *pixels; // Pointer to pixel data buffer (RGBA 32bit format)
#endif
@ -885,7 +885,7 @@ void SwapScreenBuffer(void)
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
// Update framebuffer
rlCopyFramebuffer(0, 0, CORE.Window.render.width, CORE.Window.render.height, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, platform.pixels);
// Copy framebuffer data into canvas
EM_ASM({
const width = $0;
@ -1128,7 +1128,7 @@ void PollInputEvents(void)
int InitPlatform(void)
{
SetCanvasIdJs(platform.canvasId, 64); // Get the current canvas id
glfwSetErrorCallback(ErrorCallback);
// Initialize GLFW internal global state
@ -1200,8 +1200,8 @@ int InitPlatform(void)
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); // Choose OpenGL minor version (just hint)
// Profiles Hint, only OpenGL 3.3 and above
// Possible values: GLFW_OPENGL_CORE_PROFILE, GLFW_OPENGL_ANY_PROFILE, GLFW_OPENGL_COMPAT_PROFILE
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_FALSE); // Forward Compatibility Hint: Only 3.3 and above!
// glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE); // Request OpenGL DEBUG context
}
@ -1236,7 +1236,7 @@ int InitPlatform(void)
// Init fullscreen toggle required var:
platform.ourFullscreen = false;
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
// Avoid creating a WebGL canvas, avoid calling glfwCreateWindow()
emscripten_set_canvas_element_size(platform.canvasId, CORE.Window.screen.width, CORE.Window.screen.height);
@ -1244,7 +1244,7 @@ int InitPlatform(void)
const canvas = document.getElementById("canvas");
Module.canvas = canvas;
});
// Load memory framebuffer with desired screen size
// NOTE: Despite using a software framebuffer for blitting, GLFW still creates a WebGL canvas,
// but it is not being used, on SwapScreenBuffer() the pure software renderer is used

View File

@ -636,25 +636,25 @@ void SetWindowSize(int width, int height)
// - CSS canvas size: Web layout size, logical pixels
// - Canvas contained framebuffer resolution
// * Browser monitor, device pixel ratio (HighDPI)
double canvasCssWidth = 0.0;
double canvasCssWidth = 0.0;
double canvasCssHeight = 0.0;
emscripten_get_element_css_size(platform.canvasId, &canvasCssWidth, &canvasCssHeight);
// NOTE: emscripten_get_canvas_element_size() returns canvas framebuffer size, not CSS canvas size
// Get device pixel ratio
// TODO: Should DPI be considered at this point?
double dpr = emscripten_get_device_pixel_ratio();
// Set canvas framebuffer size
emscripten_set_canvas_element_size(platform.canvasId, width*dpr, height*dpr);
// Set canvas CSS size
// TODO: Consider canvas CSS style if already scaled 100%
EM_ASM({ Module.canvas.style.width = $0; }, width*dpr);
EM_ASM({ Module.canvas.style.height = $0; }, height*dpr);
SetupViewport(width*dpr, height*dpr); // Reset viewport and projection matrix for new size
}
@ -704,7 +704,7 @@ Vector2 GetMonitorPosition(int monitor)
// Get selected monitor width (currently used by monitor)
int GetMonitorWidth(int monitor)
{
// Get the width of the user's entire screen in CSS logical pixels,
// Get the width of the user's entire screen in CSS logical pixels,
// no physical pixels, it would require multiplying by device pixel ratio
// NOTE: Returned value is limited to the current monitor where the browser window is located
int width = 0;
@ -715,7 +715,7 @@ int GetMonitorWidth(int monitor)
// Get selected monitor height (currently used by monitor)
int GetMonitorHeight(int monitor)
{
// Get the height of the user's entire screen in CSS logical pixels,
// Get the height of the user's entire screen in CSS logical pixels,
// no physical pixels, it would require multiplying by device pixel ratio
// NOTE: Returned value is limited to the current monitor where the browser window is located
int height = 0;
@ -865,7 +865,7 @@ void SwapScreenBuffer(void)
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
// Update framebuffer
rlCopyFramebuffer(0, 0, CORE.Window.render.width, CORE.Window.render.height, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, platform.pixels);
// Copy framebuffer data into canvas
EM_ASM({
const width = $0;
@ -904,7 +904,7 @@ double GetTime(void)
time = (double)(nanoSeconds - CORE.Time.base)*1e-9; // Elapsed time since InitTimer()
*/
time = emscripten_get_now()*1000.0;
return time;
}
@ -1137,7 +1137,7 @@ int InitPlatform(void)
const canvas = document.getElementById(platform.canvasId);
Module.canvas = canvas;
});
// Load memory framebuffer with desired screen size
platform.pixels = (unsigned int *)RL_CALLOC(CORE.Window.screen.width*CORE.Window.screen.height, sizeof(unsigned int));
}
@ -1145,7 +1145,7 @@ int InitPlatform(void)
{
attribs.majorVersion = 1; // WebGL 1.0 requested
attribs.minorVersion = 0;
// Create WebGL context
platform.glContext = emscripten_webgl_create_context(platform.canvasId, &attribs);
if (platform.glContext == 0) return 0;
@ -1156,7 +1156,7 @@ int InitPlatform(void)
{
attribs.majorVersion = 2; // WebGL 2.0 requested
attribs.minorVersion = 0;
// Create WebGL context
platform.glContext = emscripten_webgl_create_context(platform.canvasId, &attribs);
if (platform.glContext == 0) return 0;
@ -1216,7 +1216,7 @@ int InitPlatform(void)
emscripten_set_keypress_callback(platform.canvasId, NULL, 1, EmscriptenKeyboardCallback);
emscripten_set_keydown_callback(platform.canvasId, NULL, 1, EmscriptenKeyboardCallback);
emscripten_set_keyup_callback(platform.canvasId, NULL, 1, EmscriptenKeyboardCallback);
emscripten_set_click_callback(platform.canvasId, NULL, 1, EmscriptenMouseCallback);
//emscripten_set_dblclick_callback(platform.canvasId, NULL, 1, EmscriptenMouseCallback);
emscripten_set_mousedown_callback(platform.canvasId, NULL, 1, EmscriptenMouseCallback);
@ -1225,15 +1225,15 @@ int InitPlatform(void)
emscripten_set_mousemove_callback(platform.canvasId, NULL, 1, EmscriptenMouseMoveCallback);
emscripten_set_wheel_callback(platform.canvasId, NULL, 1, EmscriptenMouseWheelCallback);
emscripten_set_pointerlockchange_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, NULL, 1, EmscriptenPointerlockCallback);
emscripten_set_touchstart_callback(platform.canvasId, NULL, 1, EmscriptenTouchCallback);
emscripten_set_touchend_callback(platform.canvasId, NULL, 1, EmscriptenTouchCallback);
emscripten_set_touchmove_callback(platform.canvasId, NULL, 1, EmscriptenTouchCallback);
emscripten_set_touchcancel_callback(platform.canvasId, NULL, 1, EmscriptenTouchCallback);
emscripten_set_gamepadconnected_callback(NULL, 1, EmscriptenGamepadCallback);
emscripten_set_gamepaddisconnected_callback(NULL, 1, EmscriptenGamepadCallback);
// Trigger resize callback to force initial size
EmscriptenResizeCallback(EMSCRIPTEN_EVENT_RESIZE, NULL, NULL);
//----------------------------------------------------------------------------
@ -1256,7 +1256,7 @@ int InitPlatform(void)
// Close platform
// NOTE: Platform closing is managed by browser, so,
// this function is actually not required, but still
// implementing some logic behaviour
// implementing some logic behaviour
void ClosePlatform(void)
{
if (platform.pixels != NULL) RL_FREE(platform.pixels);
@ -1319,14 +1319,14 @@ static EM_BOOL EmscriptenResizeCallback(int eventType, const EmscriptenUiEvent *
static EM_BOOL EmscriptenFocusCallback(int eventType, const EmscriptenFocusEvent *focusEvent, void *userData)
{
EM_BOOL consumed = 1;
switch (eventType)
{
case EMSCRIPTEN_EVENT_BLUR: FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED); break; // The canvas lost focus
case EMSCRIPTEN_EVENT_FOCUS: FLAG_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED); break;
default: consumed = 0; break;
}
return consumed;
}
@ -1335,7 +1335,7 @@ static EM_BOOL EmscriptenVisibilityChangeCallback(int eventType, const Emscripte
{
if (visibilityChangeEvent->hidden) FLAG_SET(CORE.Window.flags, FLAG_WINDOW_HIDDEN); // The window was hidden
else FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_HIDDEN); // The window was restored
return 1; // The event was consumed by the callback handler
}
@ -1405,7 +1405,7 @@ static EM_BOOL EmscriptenKeyboardCallback(int eventType, const EmscriptenKeyboar
} break;
default: break;
}
// TODO: Add char codes
//unsigned int charCode
// Check if there is space available in the queue for characters to be added
@ -1457,7 +1457,7 @@ static EM_BOOL EmscriptenMouseCallback(int eventType, const EmscriptenMouseEvent
} break;
default: break;
}
#if defined(SUPPORT_GESTURES_SYSTEM) && defined(SUPPORT_MOUSE_GESTURES)
// Process mouse events as touches to be able to use mouse-gestures
GestureEvent gestureEvent = { 0 };
@ -1508,7 +1508,7 @@ static EM_BOOL EmscriptenMouseMoveCallback(int eventType, const EmscriptenMouseE
double cssHeight = 0.0;
emscripten_get_element_css_size(platform.canvasId, &cssWidth, &cssHeight);
int fbWidth = 0;
int fbWidth = 0;
int fbHeight = 0;
emscripten_get_canvas_element_size(platform.canvasId, &fbWidth, &fbHeight);
@ -1518,15 +1518,15 @@ static EM_BOOL EmscriptenMouseMoveCallback(int eventType, const EmscriptenMouseE
int mouseX = (int)(mouseCssX*scaleX);
int mouseY = (int)(mouseCssY*scaleY);
CORE.Input.Mouse.currentPosition.x = mouseX;//(float)mouseEvent->canvasX;
CORE.Input.Mouse.currentPosition.y = mouseY;//(float)mouseEvent->canvasY;
// Shorter alternative:
//double dpr = emscripten_get_device_pixel_ratio();
//int mouseX = (int)(e->canvasX*dpr);
//int mouseY = (int)(e->canvasY*dpr);
CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition;
}
@ -1564,7 +1564,7 @@ static EM_BOOL EmscriptenMouseWheelCallback(int eventType, const EmscriptenWheel
CORE.Input.Mouse.currentWheelMove.x = (float)wheelEvent->deltaX;
CORE.Input.Mouse.currentWheelMove.y = (float)wheelEvent->deltaY;
}
return 1; // The event was consumed by the callback handler
}

View File

@ -2743,9 +2743,9 @@ static const char *GetFileExtension(const char *fileName)
static const char *strprbrk(const char *text, const char *charset)
{
const char *latestMatch = NULL;
for (; (text != NULL) && (text = strpbrk(text, charset)); latestMatch = text++) { }
return latestMatch;
}

View File

@ -320,7 +320,7 @@ typedef struct CoreData {
char currentKeyState[MAX_KEYBOARD_KEYS]; // Registers current frame key state
char previousKeyState[MAX_KEYBOARD_KEYS]; // Registers previous frame key state
// NOTE: Since key press logic involves comparing previous vs currrent key state,
// NOTE: Since key press logic involves comparing previous vs currrent key state,
// key repeats needs to be handled specially
char keyRepeatInFrame[MAX_KEYBOARD_KEYS]; // Registers key repeats for current frame
@ -817,7 +817,7 @@ int GetScreenHeight(void)
int GetRenderWidth(void)
{
int width = 0;
if (CORE.Window.usingFbo) return CORE.Window.currentFbo.width;
else width = CORE.Window.render.width;
@ -1735,7 +1735,7 @@ int GetRandomValue(int min, int max)
{
TRACELOG(LOG_WARNING, "Invalid GetRandomValue() arguments, range should not be higher than %i", RAND_MAX);
}
// NOTE: This one-line approach produces a non-uniform distribution,
// as stated by Donald Knuth in the book The Art of Programming, so
// using below approach for more uniform results
@ -2257,7 +2257,7 @@ const char *GetApplicationDirectory(void)
#if defined(_WIN32)
int len = 0;
#if defined(UNICODE)
unsigned short widePath[MAX_PATH];
len = GetModuleFileNameW(NULL, (wchar_t *)widePath, MAX_PATH);
@ -2265,7 +2265,7 @@ const char *GetApplicationDirectory(void)
#else
len = GetModuleFileNameA(NULL, appDir, MAX_PATH);
#endif
if (len > 0)
{
for (int i = len; i >= 0; --i)
@ -2282,7 +2282,7 @@ const char *GetApplicationDirectory(void)
appDir[0] = '.';
appDir[1] = '\\';
}
#elif defined(__linux__)
unsigned int size = sizeof(appDir);
@ -2304,7 +2304,7 @@ const char *GetApplicationDirectory(void)
appDir[0] = '.';
appDir[1] = '/';
}
#elif defined(__APPLE__)
uint32_t size = sizeof(appDir);
@ -2326,7 +2326,7 @@ const char *GetApplicationDirectory(void)
appDir[0] = '.';
appDir[1] = '/';
}
#elif defined(__FreeBSD__)
size_t size = sizeof(appDir);
@ -2697,7 +2697,7 @@ unsigned char *DecodeDataBase64(const char *text, int *outputSize)
['0'] = 52, ['1'] = 53, ['2'] = 54, ['3'] = 55, ['4'] = 56, ['5'] = 57, ['6'] = 58, ['7'] = 59,
['8'] = 60, ['9'] = 61, ['+'] = 62, ['/'] = 63
};
*outputSize = 0;
if (text == NULL) return NULL;
@ -4241,7 +4241,7 @@ const char *TextFormat(const char *text, ...)
char *currentBuffer = buffers[index];
memset(currentBuffer, 0, MAX_TEXT_BUFFER_LENGTH); // Clear buffer before using
if (text != NULL)
{
va_list args;

View File

@ -3391,7 +3391,7 @@ unsigned int rlLoadTexture(const void *data, int width, int height, int format,
// Activate trilinear filtering if mipmaps are available
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
// Define the maximum number of mipmap levels to be used, 0 is base texture size
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mipmapCount - 1);

View File

@ -132,7 +132,7 @@
#ifndef MAX_MESH_VERTEX_BUFFERS
#define MAX_MESH_VERTEX_BUFFERS 9 // Maximum vertex buffers (VBO) per mesh
#endif
#ifndef MAX_FILEPATH_LENGTH
#ifndef MAX_FILEPATH_LENGTH
#define MAX_FILEPATH_LENGTH 4096 // Maximum length for filepaths (Linux PATH_MAX default value)
#endif
@ -4153,7 +4153,7 @@ RayCollision GetRayCollisionMesh(Ray ray, Mesh mesh, Matrix transform)
// Test against all triangles in mesh
for (int i = 0; i < triangleCount; i++)
{
Vector3 a = { 0 };
Vector3 a = { 0 };
Vector3 b = { 0 };
Vector3 c = { 0 };
Vector3 *vertdata = (Vector3 *)mesh.vertices;

View File

@ -700,9 +700,9 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz
switch (type)
{
case FONT_DEFAULT:
case FONT_BITMAP:
case FONT_BITMAP:
{
glyphs[k].image.data = stbtt_GetCodepointBitmap(&fontInfo, scaleFactor, scaleFactor, cp,
glyphs[k].image.data = stbtt_GetCodepointBitmap(&fontInfo, scaleFactor, scaleFactor, cp,
&cpWidth, &cpHeight, &glyphs[k].offsetX, &glyphs[k].offsetY);
} break;
case FONT_SDF:
@ -1518,7 +1518,7 @@ const char *TextFormat(const char *text, ...)
char *currentBuffer = buffers[index];
memset(currentBuffer, 0, MAX_TEXT_BUFFER_LENGTH); // Clear buffer before using
if (text != NULL)
{
va_list args;
@ -1756,7 +1756,7 @@ char *TextReplace(const char *text, const char *search, const char *replacement)
//tempLen -= lastReplacePos;
//temp = strncpy(temp, replacement, tempLen - 1) + replaceLen;
//tempLen -= replaceLen;
text += lastReplacePos + searchLen; // Move to next "end of replace"
}
@ -2059,7 +2059,7 @@ char *TextToCamel(const char *text)
char *LoadUTF8(const int *codepoints, int length)
{
char *text = NULL;
if ((codepoints != NULL) && (length > 0))
{
// We allocate enough memory to fit all possible codepoints
@ -2096,7 +2096,7 @@ int *LoadCodepoints(const char *text, int *count)
{
int *codepoints = NULL;
int codepointCount = 0;
if (text != NULL)
{
int textLength = TextLength(text);
@ -2209,7 +2209,7 @@ int GetCodepoint(const char *text, int *codepointSize)
0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
*/
int codepoint = 0x3f; // Codepoint (defaults to '?')
*codepointSize = 1;
if (text == NULL) return codepoint;
@ -2504,7 +2504,7 @@ static Font LoadBMFont(const char *fileName)
int charId = 0;
int charX = 0;
int charY = 0;
int charWidth = 0;
int charWidth = 0;
int charHeight = 0;
int charOffsetX = 0;
int charOffsetY = 0;

View File

@ -1125,7 +1125,7 @@ Image GenImageCellular(int width, int height, int tileSize)
Image GenImageText(int width, int height, const char *text)
{
Image image = { 0 };
int imageSize = width*height;
image.width = width;
image.height = height;
@ -1487,7 +1487,7 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
Image imText = { 0 };
#if defined(SUPPORT_MODULE_RTEXT)
if (text == NULL) return imText;
int textLength = (int)strlen(text); // Get length of text in bytes
int textOffsetX = 0; // Image drawing position X
int textOffsetY = 0; // Offset between lines (on linebreak '\n')