Browse Source

update raylib (merge)

pull/4480/head
ColleagueRiley 8 months ago
parent
commit
e6d7d0cf23
3 changed files with 46 additions and 32 deletions
  1. +8
    -0
      Makefile
  2. +7
    -4
      src/external/RGFW.h
  3. +31
    -28
      src/platforms/rcore_desktop_rgfw.c

+ 8
- 0
Makefile View File

@ -0,0 +1,8 @@
EXAMPLE = core/core_input_gamepad
PLATFORM = PLATOFRM_WEB_RGFW OS=linux
all:
rm -f examples/$(EXAMPLE).exe examples/$(EXAMPLE).html examples/$(EXAMPLE).wasm examples/$(EXAMPLE).js src/rcore.o
cd src && make PLATFORM=$(PLATFORM)
cd examples && make $(EXAMPLE) PLATFORM=$(PLATFORM)

+ 7
- 4
src/external/RGFW.h View File

@ -5209,11 +5209,15 @@ static HMODULE wglinstance = NULL;
if (RGFW_XInput_dll) {
XInputGetStateSRC = (PFN_XInputGetState)(void*)GetProcAddress(RGFW_XInput_dll, "XInputGetState");
if (XInputGetStateSRC == NULL)
printf("Failed to load XInputGetState");
XInputGetKeystrokeSRC = (PFN_XInputGetKeystroke)(void*)GetProcAddress(RGFW_XInput_dll, "XInputGetKeystroke");
}
}
if (XInputGetStateSRC == NULL)
printf("RGFW ERR: Failed to load XInputGetState\n");
if (XInputGetKeystrokeSRC == NULL)
printf("RGFW ERR: Failed to load XInputGetKeystroke\n");
}
#endif
@ -5656,7 +5660,6 @@ RGFW_UNUSED(win); /*!< if buffer rendering is not being used */
static i32 RGFW_checkXInput(RGFW_window* win, RGFW_Event* e) {
RGFW_UNUSED(win)
size_t i;
for (i = 0; i < 4; i++) {
XINPUT_KEYSTROKE keystroke;

+ 31
- 28
src/platforms/rcore_desktop_rgfw.c View File

@ -253,7 +253,7 @@ bool WindowShouldClose(void)
// Toggle fullscreen mode
void ToggleFullscreen(void)
{
{
RGFW_window_maximize(platform.window);
ToggleBorderlessWindowed();
}
@ -594,7 +594,7 @@ Vector2 GetMonitorPosition(int monitor)
{
RGFW_monitor *mons = RGFW_getMonitors();
return (Vector2){p">(float)mons[monitor].rect.x, (float)mons[monitor].rect.y};
return (Vector2){mons[monitor].rect.x, mons[monitor].rect.y};
}
// Get selected monitor width (currently used by monitor)
@ -618,7 +618,7 @@ int GetMonitorPhysicalWidth(int monitor)
{
RGFW_monitor* mons = RGFW_getMonitors();
return p">(int)mons[monitor].physW;
return mons[monitor].physW;
}
// Get selected monitor physical height in millimetres
@ -626,7 +626,7 @@ int GetMonitorPhysicalHeight(int monitor)
{
RGFW_monitor *mons = RGFW_getMonitors();
return p">(int)mons[monitor].physH;
return mons[monitor].physH;
}
// Get selected monitor refresh rate
@ -647,7 +647,7 @@ const char *GetMonitorName(int monitor)
// Get window position XY on monitor
Vector2 GetWindowPosition(void)
{
return (Vector2){ p">(float)platform.window->r.x, (float)platform.window->r.y };
return (Vector2){ platform.window->r.x, platform.window->r.y };
}
// Get window scale DPI factor for current monitor
@ -661,7 +661,7 @@ Vector2 GetWindowScaleDPI(void)
// Set clipboard text content
void SetClipboardText(const char *text)
{
RGFW_writeClipboard(text, p">(u32)strlen(text));
RGFW_writeClipboard(text, strlen(text));
}
// Get clipboard text content
@ -671,39 +671,42 @@ const char *GetClipboardText(void)
return RGFW_readClipboard(NULL);
}
#if defined(SUPPORT_CLIPBOARD_IMAGE)
#if defined(_WIN32)
#define WIN32_CLIPBOARD_IMPLEMENTATION
#define WINUSER_ALREADY_INCLUDED
#define WINBASE_ALREADY_INCLUDED
#define WINGDI_ALREADY_INCLUDED
#include "../external/win32_clipboard.h"
#ifdef _WIN32
# define WIN32_CLIPBOARD_IMPLEMENTATION
# define WINUSER_ALREADY_INCLUDED
# define WINBASE_ALREADY_INCLUDED
# define WINGDI_ALREADY_INCLUDED
# include "../external/win32_clipboard.h"
#endif
#endif // SUPPORT_CLIPBOARD_IMAGE
// Get clipboard image
Image GetClipboardImage(void)
{
Image image = { 0 };
#if defined(SUPPORT_CLIPBOARD_IMAGE)
#if defined(_WIN32)
Image image = {0};
unsigned long long int dataSize = 0;
void *fileData = NULL;
int width = 0;
int height = 0;
void* fileData = NULL;
#ifdef _WIN32
int width, height;
fileData = (void*)Win32GetClipboardImageData(&width, &height, &dataSize);
if (fileData == NULL) TRACELOG(LOG_WARNING, "Clipboard image: Couldn't get clipboard data.");
else image = LoadImageFromMemory(".bmp", fileData, (int)dataSize);
#else
TRACELOG(LOG_WARNING, "GetClipboardImage() not implemented on target platform");
TRACELOG(LOG_WARNING, "Clipboard image: PLATFORM_DESKTOP_RGFW doesn't implement `GetClipboardImage` for this OS");
#endif
#endif // SUPPORT_CLIPBOARD_IMAGE
if (fileData == NULL)
{
TRACELOG(LOG_WARNING, "Clipboard image: Couldn't get clipboard data.");
}
else
{
image = LoadImageFromMemory(".bmp", fileData, dataSize);
}
return image;
}
#endif // SUPPORT_CLIPBOARD_IMAGE
// Show mouse cursor
void ShowCursor(void)
@ -976,7 +979,7 @@ void PollInputEvents(void)
case RGFW_quit: CORE.Window.shouldClose = true; break;
case RGFW_dnd: // Dropped file
{
for (n">u32 i = 0; i < event->droppedFilesCount; i++)
for (kt">int i = 0; i < event->droppedFilesCount; i++)
{
if (CORE.Window.dropFileCount == 0)
{
@ -1060,7 +1063,7 @@ void PollInputEvents(void)
if ((event->button == RGFW_mouseScrollUp) || (event->button == RGFW_mouseScrollDown))
{
CORE.Input.Mouse.currentWheelMove.y = p">(float)event->scroll;
CORE.Input.Mouse.currentWheelMove.y = event->scroll;
break;
}
@ -1078,7 +1081,7 @@ void PollInputEvents(void)
{
if ((event->button == RGFW_mouseScrollUp) || (event->button == RGFW_mouseScrollDown))
{
CORE.Input.Mouse.currentWheelMove.y = p">(float)event->scroll;
CORE.Input.Mouse.currentWheelMove.y = event->scroll;
break;
}

Loading…
Cancel
Save