|
@ -54,7 +54,7 @@ |
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
|
|
|
#if defined(PLATFORM_WEB_RGFW)
|
|
|
#if defined(PLATFORM_WEB_RGFW)
|
|
|
#define RGFW_NO_GL_HEADER
|
|
|
|
|
|
|
|
|
#define RGFW_NO_GL_HEADER
|
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
|
|
|
#if defined(GRAPHICS_API_OPENGL_ES2) && !defined(PLATFORM_WEB_RGFW)
|
|
|
#if defined(GRAPHICS_API_OPENGL_ES2) && !defined(PLATFORM_WEB_RGFW)
|
|
@ -128,7 +128,7 @@ typedef struct { |
|
|
//----------------------------------------------------------------------------------
|
|
|
//----------------------------------------------------------------------------------
|
|
|
extern CoreData CORE; // Global CORE state context
|
|
|
extern CoreData CORE; // Global CORE state context
|
|
|
|
|
|
|
|
|
static PlatformData platform = { nb">NULL }; // Platform specific
|
|
|
|
|
|
|
|
|
static PlatformData platform = { mi">0 }; // Platform specific
|
|
|
|
|
|
|
|
|
static bool RGFW_disableCursor = false; |
|
|
static bool RGFW_disableCursor = false; |
|
|
|
|
|
|
|
@ -264,7 +264,7 @@ bool WindowShouldClose(void) |
|
|
|
|
|
|
|
|
// Toggle fullscreen mode
|
|
|
// Toggle fullscreen mode
|
|
|
void ToggleFullscreen(void) |
|
|
void ToggleFullscreen(void) |
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
if (!CORE.Window.fullscreen) |
|
|
if (!CORE.Window.fullscreen) |
|
|
{ |
|
|
{ |
|
|
// Store previous window position (in case we exit fullscreen)
|
|
|
// Store previous window position (in case we exit fullscreen)
|
|
@ -282,12 +282,12 @@ void ToggleFullscreen(void) |
|
|
{ |
|
|
{ |
|
|
CORE.Window.fullscreen = false; |
|
|
CORE.Window.fullscreen = false; |
|
|
CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE; |
|
|
CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE; |
|
|
|
|
|
|
|
|
if (platform.mon.mode.area.w) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (platform.mon.mode.area.w) |
|
|
{ |
|
|
{ |
|
|
RGFW_monitor monitor = RGFW_window_getMonitor(platform.window); |
|
|
RGFW_monitor monitor = RGFW_window_getMonitor(platform.window); |
|
|
RGFW_monitor_requestMode(monitor, platform.mon.mode, RGFW_monitorScale); |
|
|
RGFW_monitor_requestMode(monitor, platform.mon.mode, RGFW_monitorScale); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
platform.mon.mode.area.w = 0; |
|
|
platform.mon.mode.area.w = 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -306,7 +306,7 @@ void ToggleFullscreen(void) |
|
|
// Toggle borderless windowed mode
|
|
|
// Toggle borderless windowed mode
|
|
|
void ToggleBorderlessWindowed(void) |
|
|
void ToggleBorderlessWindowed(void) |
|
|
{ |
|
|
{ |
|
|
if (CORE.Window.fullscreen) |
|
|
|
|
|
|
|
|
if (CORE.Window.fullscreen) |
|
|
{ |
|
|
{ |
|
|
CORE.Window.previousPosition = CORE.Window.position; |
|
|
CORE.Window.previousPosition = CORE.Window.position; |
|
|
CORE.Window.previousScreen = CORE.Window.screen; |
|
|
CORE.Window.previousScreen = CORE.Window.screen; |
|
@ -315,7 +315,9 @@ void ToggleBorderlessWindowed(void) |
|
|
|
|
|
|
|
|
RGFW_monitor mon = RGFW_window_getMonitor(platform.window); |
|
|
RGFW_monitor mon = RGFW_window_getMonitor(platform.window); |
|
|
RGFW_window_resize(platform.window, mon.mode.area); |
|
|
RGFW_window_resize(platform.window, mon.mode.area); |
|
|
} else { |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
RGFW_window_setBorder(platform.window, 1); |
|
|
RGFW_window_setBorder(platform.window, 1); |
|
|
|
|
|
|
|
|
CORE.Window.position = CORE.Window.previousPosition; |
|
|
CORE.Window.position = CORE.Window.previousPosition; |
|
@ -339,9 +341,8 @@ void MinimizeWindow(void) |
|
|
|
|
|
|
|
|
// Set window state: not minimized/maximized
|
|
|
// Set window state: not minimized/maximized
|
|
|
void RestoreWindow(void) |
|
|
void RestoreWindow(void) |
|
|
{ |
|
|
|
|
|
if (!(CORE.Window.flags & FLAG_WINDOW_UNFOCUSED)) |
|
|
|
|
|
RGFW_window_focus(platform.window); |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if (!(CORE.Window.flags & FLAG_WINDOW_UNFOCUSED)) RGFW_window_focus(platform.window); |
|
|
|
|
|
|
|
|
RGFW_window_restore(platform.window); |
|
|
RGFW_window_restore(platform.window); |
|
|
} |
|
|
} |
|
@ -357,8 +358,7 @@ void SetWindowState(unsigned int flags) |
|
|
} |
|
|
} |
|
|
if (flags & FLAG_FULLSCREEN_MODE) |
|
|
if (flags & FLAG_FULLSCREEN_MODE) |
|
|
{ |
|
|
{ |
|
|
if (!CORE.Window.fullscreen) |
|
|
|
|
|
ToggleFullscreen(); |
|
|
|
|
|
|
|
|
if (!CORE.Window.fullscreen) ToggleFullscreen(); |
|
|
} |
|
|
} |
|
|
if (flags & FLAG_WINDOW_RESIZABLE) |
|
|
if (flags & FLAG_WINDOW_RESIZABLE) |
|
|
{ |
|
|
{ |
|
@ -432,8 +432,7 @@ void ClearWindowState(unsigned int flags) |
|
|
} |
|
|
} |
|
|
if (flags & FLAG_FULLSCREEN_MODE) |
|
|
if (flags & FLAG_FULLSCREEN_MODE) |
|
|
{ |
|
|
{ |
|
|
if (CORE.Window.fullscreen) |
|
|
|
|
|
ToggleFullscreen(); |
|
|
|
|
|
|
|
|
if (CORE.Window.fullscreen) ToggleFullscreen(); |
|
|
} |
|
|
} |
|
|
if (flags & FLAG_WINDOW_RESIZABLE) |
|
|
if (flags & FLAG_WINDOW_RESIZABLE) |
|
|
{ |
|
|
{ |
|
@ -446,21 +445,20 @@ void ClearWindowState(unsigned int flags) |
|
|
} |
|
|
} |
|
|
if (flags & FLAG_WINDOW_HIDDEN) |
|
|
if (flags & FLAG_WINDOW_HIDDEN) |
|
|
{ |
|
|
{ |
|
|
if (!(CORE.Window.flags & FLAG_WINDOW_UNFOCUSED)) |
|
|
|
|
|
RGFW_window_focus(platform.window); |
|
|
|
|
|
|
|
|
if (!(CORE.Window.flags & FLAG_WINDOW_UNFOCUSED)) RGFW_window_focus(platform.window); |
|
|
|
|
|
|
|
|
RGFW_window_show(platform.window); |
|
|
RGFW_window_show(platform.window); |
|
|
} |
|
|
} |
|
|
if (flags & FLAG_WINDOW_MINIMIZED) |
|
|
if (flags & FLAG_WINDOW_MINIMIZED) |
|
|
{ |
|
|
{ |
|
|
if (!(CORE.Window.flags & FLAG_WINDOW_UNFOCUSED)) |
|
|
|
|
|
RGFW_window_focus(platform.window); |
|
|
|
|
|
|
|
|
if (!(CORE.Window.flags & FLAG_WINDOW_UNFOCUSED)) RGFW_window_focus(platform.window); |
|
|
|
|
|
|
|
|
RGFW_window_restore(platform.window); |
|
|
RGFW_window_restore(platform.window); |
|
|
} |
|
|
} |
|
|
if (flags & FLAG_WINDOW_MAXIMIZED) |
|
|
if (flags & FLAG_WINDOW_MAXIMIZED) |
|
|
{ |
|
|
{ |
|
|
if (!(CORE.Window.flags & FLAG_WINDOW_UNFOCUSED)) |
|
|
|
|
|
RGFW_window_focus(platform.window); |
|
|
|
|
|
|
|
|
if (!(CORE.Window.flags & FLAG_WINDOW_UNFOCUSED)) RGFW_window_focus(platform.window); |
|
|
|
|
|
|
|
|
RGFW_window_restore(platform.window); |
|
|
RGFW_window_restore(platform.window); |
|
|
} |
|
|
} |
|
|
if (flags & FLAG_WINDOW_UNFOCUSED) |
|
|
if (flags & FLAG_WINDOW_UNFOCUSED) |
|
@ -490,8 +488,7 @@ void ClearWindowState(unsigned int flags) |
|
|
} |
|
|
} |
|
|
if (flags & FLAG_BORDERLESS_WINDOWED_MODE) |
|
|
if (flags & FLAG_BORDERLESS_WINDOWED_MODE) |
|
|
{ |
|
|
{ |
|
|
if (CORE.Window.fullscreen) |
|
|
|
|
|
ToggleBorderlessWindowed(); |
|
|
|
|
|
|
|
|
if (CORE.Window.fullscreen) ToggleBorderlessWindowed(); |
|
|
} |
|
|
} |
|
|
if (flags & FLAG_MSAA_4X_HINT) |
|
|
if (flags & FLAG_MSAA_4X_HINT) |
|
|
{ |
|
|
{ |
|
@ -505,7 +502,8 @@ void ClearWindowState(unsigned int flags) |
|
|
|
|
|
|
|
|
int RGFW_formatToChannels(int format) |
|
|
int RGFW_formatToChannels(int format) |
|
|
{ |
|
|
{ |
|
|
switch (format) { |
|
|
|
|
|
|
|
|
switch (format) |
|
|
|
|
|
{ |
|
|
case PIXELFORMAT_UNCOMPRESSED_GRAYSCALE: |
|
|
case PIXELFORMAT_UNCOMPRESSED_GRAYSCALE: |
|
|
case PIXELFORMAT_UNCOMPRESSED_R16: // 16 bpp (1 channel - half float)
|
|
|
case PIXELFORMAT_UNCOMPRESSED_R16: // 16 bpp (1 channel - half float)
|
|
|
case PIXELFORMAT_UNCOMPRESSED_R32: // 32 bpp (1 channel - float)
|
|
|
case PIXELFORMAT_UNCOMPRESSED_R32: // 32 bpp (1 channel - float)
|
|
@ -547,32 +545,29 @@ void SetWindowIcon(Image image) |
|
|
// Set icon for window
|
|
|
// Set icon for window
|
|
|
void SetWindowIcons(Image *images, int count) |
|
|
void SetWindowIcons(Image *images, int count) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
if ((images == NULL) || (count <= 0)) |
|
|
if ((images == NULL) || (count <= 0)) |
|
|
{ |
|
|
{ |
|
|
RGFW_window_setIcon(platform.window, NULL, RGFW_AREA(0, 0), 0); |
|
|
RGFW_window_setIcon(platform.window, NULL, RGFW_AREA(0, 0), 0); |
|
|
} { |
|
|
|
|
|
Image* bigIcon = NULL; |
|
|
|
|
|
Image* smallIcon = NULL; |
|
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < count; i++) { |
|
|
|
|
|
if (bigIcon == NULL || (images[i].width > bigIcon->width && images[i].height > bigIcon->height)) |
|
|
|
|
|
bigIcon = &images[i]; |
|
|
|
|
|
if (smallIcon == NULL || (images[i].width < smallIcon->width && images[i].height > smallIcon->height)) |
|
|
|
|
|
smallIcon = &images[i]; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
Image *bigIcon = NULL; |
|
|
|
|
|
Image *smallIcon = NULL; |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < count; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
if ((bigIcon == NULL) || ((images[i].width > bigIcon->width) && (images[i].height > bigIcon->height))) bigIcon = &images[i]; |
|
|
|
|
|
if ((smallIcon == NULL) || ((images[i].width < smallIcon->width) && (images[i].height > smallIcon->height))) smallIcon = &images[i]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (smallIcon != NULL) |
|
|
|
|
|
RGFW_window_setIconEx(platform.window, smallIcon->data, RGFW_AREA(smallIcon->width, smallIcon->height), RGFW_formatToChannels(smallIcon->format), RGFW_iconWindow); |
|
|
|
|
|
if (bigIcon != NULL) |
|
|
|
|
|
RGFW_window_setIconEx(platform.window, bigIcon->data, RGFW_AREA(bigIcon->width, bigIcon->height), RGFW_formatToChannels(bigIcon->format), RGFW_iconTaskbar); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (smallIcon != NULL) RGFW_window_setIconEx(platform.window, smallIcon->data, RGFW_AREA(smallIcon->width, smallIcon->height), RGFW_formatToChannels(smallIcon->format), RGFW_iconWindow); |
|
|
|
|
|
if (bigIcon != NULL) RGFW_window_setIconEx(platform.window, bigIcon->data, RGFW_AREA(bigIcon->width, bigIcon->height), RGFW_formatToChannels(bigIcon->format), RGFW_iconTaskbar); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 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; |
|
|
} |
|
|
} |
|
@ -659,11 +654,12 @@ int GetMonitorCount(void) |
|
|
|
|
|
|
|
|
// Get current monitor where window is placed
|
|
|
// Get current monitor where window is placed
|
|
|
int GetCurrentMonitor(void) |
|
|
int GetCurrentMonitor(void) |
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
RGFW_monitor *mons = RGFW_getMonitors(); |
|
|
RGFW_monitor *mons = RGFW_getMonitors(); |
|
|
RGFW_monitor mon; |
|
|
|
|
|
|
|
|
RGFW_monitor mon = { 0 }; |
|
|
|
|
|
|
|
|
if (platform.window) mon = RGFW_window_getMonitor(platform.window); |
|
|
if (platform.window) mon = RGFW_window_getMonitor(platform.window); |
|
|
else mon = RGFW_getPrimaryMonitor(); |
|
|
|
|
|
|
|
|
else mon = RGFW_getPrimaryMonitor(); |
|
|
|
|
|
|
|
|
for (int i = 0; i < 6; i++) |
|
|
for (int i = 0; i < 6; i++) |
|
|
{ |
|
|
{ |
|
@ -739,11 +735,12 @@ Vector2 GetWindowPosition(void) |
|
|
// Get window scale DPI factor for current monitor
|
|
|
// Get window scale DPI factor for current monitor
|
|
|
Vector2 GetWindowScaleDPI(void) |
|
|
Vector2 GetWindowScaleDPI(void) |
|
|
{ |
|
|
{ |
|
|
RGFW_monitor monitor; |
|
|
|
|
|
|
|
|
RGFW_monitor monitor = { 0 }; |
|
|
|
|
|
|
|
|
if (platform.window) monitor = RGFW_window_getMonitor(platform.window); |
|
|
if (platform.window) monitor = RGFW_window_getMonitor(platform.window); |
|
|
else monitor = RGFW_getPrimaryMonitor(); |
|
|
|
|
|
|
|
|
else monitor = RGFW_getPrimaryMonitor(); |
|
|
|
|
|
|
|
|
return (Vector2){monitor.scaleX, monitor.scaleX}; |
|
|
|
|
|
|
|
|
return (Vector2){ monitor.scaleX, monitor.scaleX }; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Set clipboard text content
|
|
|
// Set clipboard text content
|
|
@ -759,7 +756,6 @@ const char *GetClipboardText(void) |
|
|
return RGFW_readClipboard(NULL); |
|
|
return RGFW_readClipboard(NULL); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(SUPPORT_CLIPBOARD_IMAGE)
|
|
|
#if defined(SUPPORT_CLIPBOARD_IMAGE)
|
|
|
#if defined(_WIN32)
|
|
|
#if defined(_WIN32)
|
|
|
#define WIN32_CLIPBOARD_IMPLEMENTATION
|
|
|
#define WIN32_CLIPBOARD_IMPLEMENTATION
|
|
@ -782,7 +778,7 @@ Image GetClipboardImage(void) |
|
|
int width = 0; |
|
|
int width = 0; |
|
|
int height = 0; |
|
|
int height = 0; |
|
|
fileData = (void *)Win32GetClipboardImageData(&width, &height, &dataSize); |
|
|
fileData = (void *)Win32GetClipboardImageData(&width, &height, &dataSize); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (fileData == NULL) TRACELOG(LOG_WARNING, "Clipboard image: Couldn't get clipboard data"); |
|
|
if (fileData == NULL) TRACELOG(LOG_WARNING, "Clipboard image: Couldn't get clipboard data"); |
|
|
else image = LoadImageFromMemory(".bmp", fileData, dataSize); |
|
|
else image = LoadImageFromMemory(".bmp", fileData, dataSize); |
|
|
#else
|
|
|
#else
|
|
@ -893,6 +889,7 @@ void SetMouseCursor(int cursor) |
|
|
const char *GetKeyName(int key) |
|
|
const char *GetKeyName(int key) |
|
|
{ |
|
|
{ |
|
|
TRACELOG(LOG_WARNING, "GetKeyName() unsupported on target platform"); |
|
|
TRACELOG(LOG_WARNING, "GetKeyName() unsupported on target platform"); |
|
|
|
|
|
|
|
|
return ""; |
|
|
return ""; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -996,14 +993,14 @@ void PollInputEvents(void) |
|
|
{ |
|
|
{ |
|
|
RGFW_event *event = &platform.window->event; |
|
|
RGFW_event *event = &platform.window->event; |
|
|
// All input events can be processed after polling
|
|
|
// All input events can be processed after polling
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (event->type) |
|
|
switch (event->type) |
|
|
{ |
|
|
{ |
|
|
case RGFW_mouseEnter: CORE.Input.Mouse.cursorOnScreen = true; break; |
|
|
case RGFW_mouseEnter: CORE.Input.Mouse.cursorOnScreen = true; break; |
|
|
case RGFW_mouseLeave: CORE.Input.Mouse.cursorOnScreen = false; break; |
|
|
case RGFW_mouseLeave: CORE.Input.Mouse.cursorOnScreen = false; break; |
|
|
case RGFW_quit: |
|
|
|
|
|
|
|
|
case RGFW_quit: |
|
|
event->type = 0; |
|
|
event->type = 0; |
|
|
CORE.Window.shouldClose = true; |
|
|
|
|
|
|
|
|
CORE.Window.shouldClose = true; |
|
|
return; |
|
|
return; |
|
|
case RGFW_DND: // Dropped file
|
|
|
case RGFW_DND: // Dropped file
|
|
|
{ |
|
|
{ |
|
@ -1043,17 +1040,20 @@ void PollInputEvents(void) |
|
|
CORE.Window.resizedLastFrame = true; |
|
|
CORE.Window.resizedLastFrame = true; |
|
|
} break; |
|
|
} break; |
|
|
case RGFW_windowMaximized: |
|
|
case RGFW_windowMaximized: |
|
|
|
|
|
{ |
|
|
CORE.Window.flags |= FLAG_WINDOW_MAXIMIZED; // The window was maximized
|
|
|
CORE.Window.flags |= FLAG_WINDOW_MAXIMIZED; // The window was maximized
|
|
|
break; |
|
|
|
|
|
|
|
|
} break; |
|
|
case RGFW_windowMinimized: |
|
|
case RGFW_windowMinimized: |
|
|
|
|
|
{ |
|
|
CORE.Window.flags |= FLAG_WINDOW_MINIMIZED; // The window was iconified
|
|
|
CORE.Window.flags |= FLAG_WINDOW_MINIMIZED; // The window was iconified
|
|
|
break; |
|
|
|
|
|
|
|
|
} break; |
|
|
case RGFW_windowRestored: |
|
|
case RGFW_windowRestored: |
|
|
if (RGFW_window_isMaximized(platform.window)) |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if (RGFW_window_isMaximized(platform.window)) |
|
|
CORE.Window.flags &= ~FLAG_WINDOW_MAXIMIZED; // The window was restored
|
|
|
CORE.Window.flags &= ~FLAG_WINDOW_MAXIMIZED; // The window was restored
|
|
|
if (RGFW_window_isMinimized(platform.window)) |
|
|
|
|
|
|
|
|
if (RGFW_window_isMinimized(platform.window)) |
|
|
CORE.Window.flags &= ~FLAG_WINDOW_MINIMIZED; // The window was restored
|
|
|
CORE.Window.flags &= ~FLAG_WINDOW_MINIMIZED; // The window was restored
|
|
|
break; |
|
|
|
|
|
|
|
|
} break; |
|
|
case RGFW_windowMoved: |
|
|
case RGFW_windowMoved: |
|
|
{ |
|
|
{ |
|
|
CORE.Window.position.x = platform.window->r.x; |
|
|
CORE.Window.position.x = platform.window->r.x; |
|
@ -1104,12 +1104,13 @@ void PollInputEvents(void) |
|
|
{ |
|
|
{ |
|
|
CORE.Input.Mouse.currentWheelMove.y = event->scroll; |
|
|
CORE.Input.Mouse.currentWheelMove.y = event->scroll; |
|
|
break; |
|
|
break; |
|
|
} else CORE.Input.Mouse.currentWheelMove.y = 0; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else CORE.Input.Mouse.currentWheelMove.y = 0; |
|
|
|
|
|
|
|
|
int btn = event->button; |
|
|
int btn = event->button; |
|
|
if (btn == RGFW_mouseLeft) btn = 1; |
|
|
if (btn == RGFW_mouseLeft) btn = 1; |
|
|
else if (btn == RGFW_mouseRight) btn = 2; |
|
|
else if (btn == RGFW_mouseRight) btn = 2; |
|
|
else if (btn == RGFW_mouseMiddle) btn = 3; |
|
|
|
|
|
|
|
|
else if (btn == RGFW_mouseMiddle) btn = 3; |
|
|
|
|
|
|
|
|
CORE.Input.Mouse.currentButtonState[btn - 1] = 1; |
|
|
CORE.Input.Mouse.currentButtonState[btn - 1] = 1; |
|
|
CORE.Input.Touch.currentTouchState[btn - 1] = 1; |
|
|
CORE.Input.Touch.currentTouchState[btn - 1] = 1; |
|
@ -1122,7 +1123,8 @@ void PollInputEvents(void) |
|
|
{ |
|
|
{ |
|
|
CORE.Input.Mouse.currentWheelMove.y = event->scroll; |
|
|
CORE.Input.Mouse.currentWheelMove.y = event->scroll; |
|
|
break; |
|
|
break; |
|
|
} else CORE.Input.Mouse.currentWheelMove.y = 0; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else CORE.Input.Mouse.currentWheelMove.y = 0; |
|
|
|
|
|
|
|
|
int btn = event->button; |
|
|
int btn = event->button; |
|
|
if (btn == RGFW_mouseLeft) btn = 1; |
|
|
if (btn == RGFW_mouseLeft) btn = 1; |
|
@ -1152,16 +1154,18 @@ void PollInputEvents(void) |
|
|
touchAction = 2; |
|
|
touchAction = 2; |
|
|
} break; |
|
|
} break; |
|
|
case RGFW_gamepadConnected: |
|
|
case RGFW_gamepadConnected: |
|
|
|
|
|
{ |
|
|
CORE.Input.Gamepad.ready[platform.window->event.gamepad] = true; |
|
|
CORE.Input.Gamepad.ready[platform.window->event.gamepad] = true; |
|
|
CORE.Input.Gamepad.axisCount[platform.window->event.gamepad] = platform.window->event.axisesCount; |
|
|
CORE.Input.Gamepad.axisCount[platform.window->event.gamepad] = platform.window->event.axisesCount; |
|
|
CORE.Input.Gamepad.axisState[platform.window->event.gamepad][GAMEPAD_AXIS_LEFT_TRIGGER] = -1.0f; |
|
|
CORE.Input.Gamepad.axisState[platform.window->event.gamepad][GAMEPAD_AXIS_LEFT_TRIGGER] = -1.0f; |
|
|
CORE.Input.Gamepad.axisState[platform.window->event.gamepad][GAMEPAD_AXIS_RIGHT_TRIGGER] = -1.0f; |
|
|
CORE.Input.Gamepad.axisState[platform.window->event.gamepad][GAMEPAD_AXIS_RIGHT_TRIGGER] = -1.0f; |
|
|
|
|
|
|
|
|
strcpy(CORE.Input.Gamepad.name[platform.window->event.gamepad], RGFW_getGamepadName(platform.window, platform.window->event.gamepad)); |
|
|
strcpy(CORE.Input.Gamepad.name[platform.window->event.gamepad], RGFW_getGamepadName(platform.window, platform.window->event.gamepad)); |
|
|
break; |
|
|
|
|
|
|
|
|
} break; |
|
|
case RGFW_gamepadDisconnected: |
|
|
case RGFW_gamepadDisconnected: |
|
|
|
|
|
{ |
|
|
CORE.Input.Gamepad.ready[platform.window->event.gamepad] = false; |
|
|
CORE.Input.Gamepad.ready[platform.window->event.gamepad] = false; |
|
|
break; |
|
|
|
|
|
|
|
|
} break; |
|
|
case RGFW_gamepadButtonPressed: |
|
|
case RGFW_gamepadButtonPressed: |
|
|
{ |
|
|
{ |
|
|
int button = RGFW_gpConvTable[event->button]; |
|
|
int button = RGFW_gpConvTable[event->button]; |
|
@ -1182,9 +1186,9 @@ void PollInputEvents(void) |
|
|
case RGFW_gamepadAxisMove: |
|
|
case RGFW_gamepadAxisMove: |
|
|
{ |
|
|
{ |
|
|
int axis = -1; |
|
|
int axis = -1; |
|
|
|
|
|
|
|
|
float value = 0; |
|
|
float value = 0; |
|
|
switch(event->whichAxis) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch(event->whichAxis) |
|
|
{ |
|
|
{ |
|
|
case 0: |
|
|
case 0: |
|
|
{ |
|
|
{ |
|
@ -1197,9 +1201,10 @@ void PollInputEvents(void) |
|
|
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_RIGHT_Y] = event->axis[1].y / 100.0f; |
|
|
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_RIGHT_Y] = event->axis[1].y / 100.0f; |
|
|
} break; |
|
|
} break; |
|
|
case 2: axis = GAMEPAD_AXIS_LEFT_TRIGGER; |
|
|
case 2: axis = GAMEPAD_AXIS_LEFT_TRIGGER; |
|
|
case 3: |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
case 3: |
|
|
|
|
|
{ |
|
|
if (axis == -1) axis = GAMEPAD_AXIS_RIGHT_TRIGGER; |
|
|
if (axis == -1) axis = GAMEPAD_AXIS_RIGHT_TRIGGER; |
|
|
|
|
|
|
|
|
int button = (axis == GAMEPAD_AXIS_LEFT_TRIGGER)? GAMEPAD_BUTTON_LEFT_TRIGGER_2 : GAMEPAD_BUTTON_RIGHT_TRIGGER_2; |
|
|
int button = (axis == GAMEPAD_AXIS_LEFT_TRIGGER)? GAMEPAD_BUTTON_LEFT_TRIGGER_2 : GAMEPAD_BUTTON_RIGHT_TRIGGER_2; |
|
|
int pressed = (value > 0.1f); |
|
|
int pressed = (value > 0.1f); |
|
|
CORE.Input.Gamepad.currentButtonState[event->gamepad][button] = pressed; |
|
|
CORE.Input.Gamepad.currentButtonState[event->gamepad][button] = pressed; |
|
@ -1264,7 +1269,7 @@ int InitPlatform(void) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ((CORE.Window.flags & FLAG_BORDERLESS_WINDOWED_MODE) > 0) |
|
|
if ((CORE.Window.flags & FLAG_BORDERLESS_WINDOWED_MODE) > 0) |
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
CORE.Window.fullscreen = true; |
|
|
CORE.Window.fullscreen = true; |
|
|
flags |= RGFW_windowedFullscreen; |
|
|
flags |= RGFW_windowedFullscreen; |
|
|
} |
|
|
} |
|
@ -1276,21 +1281,20 @@ int InitPlatform(void) |
|
|
if ((CORE.Window.flags & FLAG_WINDOW_HIDDEN) > 0) flags |= RGFW_windowHide; |
|
|
if ((CORE.Window.flags & FLAG_WINDOW_HIDDEN) > 0) flags |= RGFW_windowHide; |
|
|
if ((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) > 0) flags |= RGFW_windowMaximize; |
|
|
if ((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) > 0) flags |= RGFW_windowMaximize; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// NOTE: Some OpenGL context attributes must be set before window creation
|
|
|
// NOTE: Some OpenGL context attributes must be set before window creation
|
|
|
// Check selection OpenGL version
|
|
|
// Check selection OpenGL version
|
|
|
if (rlGetVersion() == RL_OPENGL_21) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if (rlGetVersion() == RL_OPENGL_21) |
|
|
|
|
|
{ |
|
|
RGFW_setGLHint(RGFW_glMajor, 2); |
|
|
RGFW_setGLHint(RGFW_glMajor, 2); |
|
|
RGFW_setGLHint(RGFW_glMinor, 1); |
|
|
RGFW_setGLHint(RGFW_glMinor, 1); |
|
|
} |
|
|
|
|
|
else if (rlGetVersion() == RL_OPENGL_33) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else if (rlGetVersion() == RL_OPENGL_33) |
|
|
|
|
|
{ |
|
|
RGFW_setGLHint(RGFW_glMajor, 3); |
|
|
RGFW_setGLHint(RGFW_glMajor, 3); |
|
|
RGFW_setGLHint(RGFW_glMinor, 3); |
|
|
RGFW_setGLHint(RGFW_glMinor, 3); |
|
|
} |
|
|
|
|
|
else if (rlGetVersion() == RL_OPENGL_43) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else if (rlGetVersion() == RL_OPENGL_43) |
|
|
|
|
|
{ |
|
|
RGFW_setGLHint(RGFW_glMajor, 4); |
|
|
RGFW_setGLHint(RGFW_glMajor, 4); |
|
|
RGFW_setGLHint(RGFW_glMinor, 3); |
|
|
RGFW_setGLHint(RGFW_glMinor, 3); |
|
|
} |
|
|
} |
|
@ -1310,7 +1314,7 @@ int InitPlatform(void) |
|
|
CORE.Window.display.width = CORE.Window.screen.width; |
|
|
CORE.Window.display.width = CORE.Window.screen.width; |
|
|
CORE.Window.display.height = CORE.Window.screen.height; |
|
|
CORE.Window.display.height = CORE.Window.screen.height; |
|
|
#endif
|
|
|
#endif
|
|
|
// TODO: Is this needed by raylib now?
|
|
|
|
|
|
|
|
|
// TODO: Is this needed by raylib now?
|
|
|
// If so, rcore_desktop_sdl should be updated too
|
|
|
// If so, rcore_desktop_sdl should be updated too
|
|
|
//SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height);
|
|
|
//SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height);
|
|
|
|
|
|
|
|
@ -1365,10 +1369,8 @@ int InitPlatform(void) |
|
|
//----------------------------------------------------------------------------
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
#if defined(RGFW_WAYLAND)
|
|
|
#if defined(RGFW_WAYLAND)
|
|
|
if (RGFW_useWaylandBool) |
|
|
|
|
|
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - Wayland): Initialized successfully"); |
|
|
|
|
|
else |
|
|
|
|
|
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - X11 (fallback)): Initialized successfully"); |
|
|
|
|
|
|
|
|
if (RGFW_useWaylandBool) TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - Wayland): Initialized successfully"); |
|
|
|
|
|
else TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - X11 (fallback)): Initialized successfully"); |
|
|
#elif defined(RGFW_X11)
|
|
|
#elif defined(RGFW_X11)
|
|
|
#if defined(__APPLE__)
|
|
|
#if defined(__APPLE__)
|
|
|
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - X11 (MacOS)): Initialized successfully"); |
|
|
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - X11 (MacOS)): Initialized successfully"); |
|
@ -1396,6 +1398,6 @@ void ClosePlatform(void) |
|
|
static KeyboardKey ConvertScancodeToKey(u32 keycode) |
|
|
static KeyboardKey ConvertScancodeToKey(u32 keycode) |
|
|
{ |
|
|
{ |
|
|
if (keycode > sizeof(keyMappingRGFW)/sizeof(unsigned short)) return 0; |
|
|
if (keycode > sizeof(keyMappingRGFW)/sizeof(unsigned short)) return 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return keyMappingRGFW[keycode]; |
|
|
return keyMappingRGFW[keycode]; |
|
|
} |
|
|
} |