[rcore][RGFW] Add new backend option: PLATFORM_WEB_RGFW and update RGFW (#4480)

* add PLATFORM_WEB_RGFW

* fix some bugs

* fix web_rgfw gamepad

* send fake screensize

* fix gamepad bugs (linux) | add L3 + R3 (gamepad)

* fix?

* update RGFW (again)

* update raylib (merge)

* fix xinput stuff

* delete makefile added by mistake

* update RGFW

* update RGFW (rename joystick to gamepad to avoid misunderstandings

* update RGFW (fix X11 bug)

* update RGFW

* use RL_MALLOC for RGFW

* update RGFW (fixes xdnd bug)

* fix some formating
This commit is contained in:
Colleague Riley
2024-12-18 03:03:42 -08:00
committed by GitHub
parent de6c09ee7a
commit 58004723d8
6 changed files with 1049 additions and 959 deletions

View File

@@ -12,6 +12,13 @@
* - Windows (Win32, Win64)
* - Linux (X11/Wayland desktop mode)
* - Others (not tested)
* > PLATFORM_DESKTOP_RGFW (RGFW backend):
* - Windows (Win32, Win64)
* - Linux (X11/Wayland desktop mode)
* - macOS/OSX (x64, arm64)
* - Others (not tested)
* > PLATFORM_WEB_RGFW:
* - HTML5 (WebAssembly)
* > PLATFORM_WEB:
* - HTML5 (WebAssembly)
* > PLATFORM_DRM:
@@ -85,12 +92,12 @@
//----------------------------------------------------------------------------------
// Feature Test Macros required for this module
//----------------------------------------------------------------------------------
#if (defined(__linux__) || defined(PLATFORM_WEB)) && (_XOPEN_SOURCE < 500)
#if (defined(__linux__) || defined(PLATFORM_WEB) || defined(PLATFORM_WEB_RGFW)) && (_XOPEN_SOURCE < 500)
#undef _XOPEN_SOURCE
#define _XOPEN_SOURCE 500 // Required for: readlink if compiled with c99 without gnu ext.
#endif
#if (defined(__linux__) || defined(PLATFORM_WEB)) && (_POSIX_C_SOURCE < 199309L)
#if (defined(__linux__) || defined(PLATFORM_WEB) || defined(PLATFORM_WEB_RGFW)) && (_POSIX_C_SOURCE < 199309L)
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 199309L // Required for: CLOCK_MONOTONIC if compiled with c99 without gnu ext.
#endif
@@ -540,7 +547,7 @@ const char *TextFormat(const char *text, ...); // Formatting of tex
#include "platforms/rcore_desktop_glfw.c"
#elif defined(PLATFORM_DESKTOP_SDL)
#include "platforms/rcore_desktop_sdl.c"
#elif defined(PLATFORM_DESKTOP_RGFW)
#elif (defined(PLATFORM_DESKTOP_RGFW) || defined(PLATFORM_WEB_RGFW))
#include "platforms/rcore_desktop_rgfw.c"
#elif defined(PLATFORM_WEB)
#include "platforms/rcore_web.c"
@@ -611,6 +618,8 @@ void InitWindow(int width, int height, const char *title)
TRACELOG(LOG_INFO, "Platform backend: DESKTOP (SDL)");
#elif defined(PLATFORM_DESKTOP_RGFW)
TRACELOG(LOG_INFO, "Platform backend: DESKTOP (RGFW)");
#elif defined(PLATFORM_WEB_RGFW)
TRACELOG(LOG_INFO, "Platform backend: WEB (RGFW) (HTML5)");
#elif defined(PLATFORM_WEB)
TRACELOG(LOG_INFO, "Platform backend: WEB (HTML5)");
#elif defined(PLATFORM_DRM)
@@ -3573,7 +3582,7 @@ void SetupViewport(int width, int height)
// NOTE: Global variables CORE.Window.render.width/CORE.Window.render.height and CORE.Window.renderOffset.x/CORE.Window.renderOffset.y can be modified
void SetupFramebuffer(int width, int height)
{
// Calculate CORE.Window.render.width and CORE.Window.render.height, we have the display size (input params) and the desired screen size (global var)
// Calculate CORE.Window.render.width and CORE.Window.render.height, we have the display size (input params) and the desired screen size (global var)
if ((CORE.Window.screen.width > CORE.Window.display.width) || (CORE.Window.screen.height > CORE.Window.display.height))
{
TRACELOG(LOG_WARNING, "DISPLAY: Downscaling required: Screen size (%ix%i) is bigger than display size (%ix%i)", CORE.Window.screen.width, CORE.Window.screen.height, CORE.Window.display.width, CORE.Window.display.height);