Update RGFW (#4176)
* update RGFW * fix bug with GetCurrentMonitor * update RGFW * update RGFW * clean up merge
This commit is contained in:
parent
047a4da696
commit
f1f08861a1
2 changed files with 2201 additions and 1241 deletions
3393
src/external/RGFW.h
vendored
3393
src/external/RGFW.h
vendored
File diff suppressed because it is too large
Load diff
|
@ -46,7 +46,7 @@
|
|||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#ifdef GRAPHICS_API_OPENGL_ES2
|
||||
#if defined(GRAPHICS_API_OPENGL_ES2)
|
||||
#define RGFW_OPENGL_ES2
|
||||
#endif
|
||||
|
||||
|
@ -182,7 +182,7 @@ static const unsigned short keyMappingRGFW[] = {
|
|||
[RGFW_u] = KEY_U,
|
||||
[RGFW_v] = KEY_V,
|
||||
[RGFW_w] = KEY_W,
|
||||
[RGFW_x] KEY_X,
|
||||
[RGFW_x] = KEY_X,
|
||||
[RGFW_y] = KEY_Y,
|
||||
[RGFW_z] = KEY_Z,
|
||||
[RGFW_Bracket] = KEY_LEFT_BRACKET,
|
||||
|
@ -483,14 +483,14 @@ void SetWindowIcons(Image *images, int count)
|
|||
// Set title for window
|
||||
void SetWindowTitle(const char *title)
|
||||
{
|
||||
RGFW_window_setName(platform.window, title);
|
||||
RGFW_window_setName(platform.window, (char*)title);
|
||||
CORE.Window.title = title;
|
||||
}
|
||||
|
||||
// Set window position on screen (windowed mode)
|
||||
void SetWindowPosition(int x, int y)
|
||||
{
|
||||
RGFW_window_move(platform.window, RGFW_VECTOR(x, y));
|
||||
RGFW_window_move(platform.window, RGFW_POINT(x, y));
|
||||
}
|
||||
|
||||
// Set monitor for the current window
|
||||
|
@ -536,7 +536,9 @@ void SetWindowFocused(void)
|
|||
// Get native window handle
|
||||
void *GetWindowHandle(void)
|
||||
{
|
||||
#ifndef RGFW_WINDOWS
|
||||
#ifdef RGFW_WEBASM
|
||||
return (void*)platform.window->src.ctx;
|
||||
#elif !defined(RGFW_WINDOWS)
|
||||
return (void *)platform.window->src.window;
|
||||
#else
|
||||
return platform.window->src.hwnd;
|
||||
|
@ -643,7 +645,7 @@ Vector2 GetWindowScaleDPI(void)
|
|||
{
|
||||
RGFW_monitor monitor = RGFW_window_getMonitor(platform.window);
|
||||
|
||||
return (Vector2){((u32)monitor.scaleX)*platform.window->r.w, ((u32) monitor.scaleX)*platform.window->r.h};
|
||||
return (Vector2){monitor.scaleX, monitor.scaleX};
|
||||
}
|
||||
|
||||
// Set clipboard text content
|
||||
|
@ -689,9 +691,8 @@ void EnableCursor(void)
|
|||
void DisableCursor(void)
|
||||
{
|
||||
RGFW_disableCursor = true;
|
||||
|
||||
// Set cursor position in the middle
|
||||
SetMousePosition(CORE.Window.screen.width/2, CORE.Window.screen.height/2);
|
||||
|
||||
RGFW_window_mouseHold(platform.window, RGFW_AREA(CORE.Window.screen.width / 2, CORE.Window.screen.height / 2));
|
||||
|
||||
HideCursor();
|
||||
}
|
||||
|
@ -745,7 +746,7 @@ int SetGamepadMappings(const char *mappings)
|
|||
// Set mouse position XY
|
||||
void SetMousePosition(int x, int y)
|
||||
{
|
||||
RGFW_window_moveMouse(platform.window, RGFW_VECTOR(x, y));
|
||||
RGFW_window_moveMouse(platform.window, RGFW_POINT(x, y));
|
||||
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
||||
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
|
||||
}
|
||||
|
@ -875,10 +876,10 @@ void PollInputEvents(void)
|
|||
//-----------------------------------------------------------------------------
|
||||
CORE.Window.resizedLastFrame = false;
|
||||
|
||||
#define RGFW_HOLD_MOUSE (1L<<2)
|
||||
|
||||
#if defined(RGFW_X11) //|| defined(RGFW_MACOS)
|
||||
if (platform.window->src.winArgs & RGFW_HOLD_MOUSE)
|
||||
#define RGFW_HOLD_MOUSE (1L<<2)
|
||||
#if defined(RGFW_X11) //|| defined(RGFW_MACOS)
|
||||
if (platform.window->_winArgs & RGFW_HOLD_MOUSE)
|
||||
{
|
||||
CORE.Input.Mouse.previousPosition = (Vector2){ 0.0f, 0.0f };
|
||||
CORE.Input.Mouse.currentPosition = (Vector2){ 0.0f, 0.0f };
|
||||
|
@ -1031,17 +1032,17 @@ void PollInputEvents(void)
|
|||
} break;
|
||||
case RGFW_mousePosChanged:
|
||||
{
|
||||
if (platform.window->src.winArgs & RGFW_HOLD_MOUSE)
|
||||
if (platform.window->_winArgs & RGFW_HOLD_MOUSE)
|
||||
{
|
||||
CORE.Input.Mouse.previousPosition = (Vector2){ 0.0f, 0.0f };
|
||||
|
||||
if ((event->point.x - (platform.window->r.w/2))*2)
|
||||
if (event->point.x)
|
||||
CORE.Input.Mouse.previousPosition.x = CORE.Input.Mouse.currentPosition.x;
|
||||
if ((event->point.y - (platform.window->r.h/2))*2)
|
||||
if (event->point.y)
|
||||
CORE.Input.Mouse.previousPosition.y = CORE.Input.Mouse.currentPosition.y;
|
||||
|
||||
CORE.Input.Mouse.currentPosition.x = (event->point.x - (platform.window->r.w/2))*2;
|
||||
CORE.Input.Mouse.currentPosition.y = (event->point.y - (platform.window->r.h/2))*2;
|
||||
CORE.Input.Mouse.currentPosition.x = (float)event->point.x;
|
||||
CORE.Input.Mouse.currentPosition.y = (float)event->point.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1205,8 +1206,6 @@ void PollInputEvents(void)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (RGFW_disableCursor && platform.window->event.inFocus) RGFW_window_mouseHold(platform.window, RGFW_AREA(0, 0));
|
||||
//-----------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
|
@ -1258,6 +1257,16 @@ int InitPlatform(void)
|
|||
|
||||
platform.window = RGFW_createWindow(CORE.Window.title, RGFW_RECT(0, 0, CORE.Window.screen.width, CORE.Window.screen.height), flags);
|
||||
|
||||
RGFW_area screenSize = RGFW_getScreenSize();
|
||||
CORE.Window.display.width = screenSize.w;
|
||||
CORE.Window.display.height = screenSize.h;
|
||||
/*
|
||||
I think this is needed by Raylib now ?
|
||||
If so, rcore_destkop_sdl should be updated too
|
||||
*/
|
||||
SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height);
|
||||
|
||||
|
||||
if (CORE.Window.flags & FLAG_VSYNC_HINT) RGFW_window_swapInterval(platform.window, 1);
|
||||
|
||||
RGFW_window_makeCurrent(platform.window);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue