mirror of https://github.com/raysan5/raylib
update RGFW to RGFW 1.0 (#4144)
* update RGFW * fix bug with GetCurrentMonitor
This commit is contained in:
parent
3abe728712
commit
98662b6a4a
File diff suppressed because it is too large
Load Diff
|
@ -8,19 +8,17 @@
|
||||||
* - MacOS (Cocoa)
|
* - MacOS (Cocoa)
|
||||||
*
|
*
|
||||||
* LIMITATIONS:
|
* LIMITATIONS:
|
||||||
* - Limitation 01
|
* - TODO
|
||||||
* - Limitation 02
|
|
||||||
*
|
*
|
||||||
* POSSIBLE IMPROVEMENTS:
|
* POSSIBLE IMPROVEMENTS:
|
||||||
* - Improvement 01
|
* - TODO
|
||||||
* - Improvement 02
|
|
||||||
*
|
*
|
||||||
* ADDITIONAL NOTES:
|
* ADDITIONAL NOTES:
|
||||||
* - TRACELOG() function is located in raylib [utils] module
|
* - TRACELOG() function is located in raylib [utils] module
|
||||||
*
|
*
|
||||||
* CONFIGURATION:
|
* CONFIGURATION:
|
||||||
* #define RCORE_PLATFORM_CUSTOM_FLAG
|
* #define RCORE_PLATFORM_RGFW
|
||||||
* Custom flag for rcore on target platform -not used-
|
* Custom flag for rcore on target platform RGFW
|
||||||
*
|
*
|
||||||
* DEPENDENCIES:
|
* DEPENDENCIES:
|
||||||
* - RGFW.h (main library): Windowing and inputs management
|
* - RGFW.h (main library): Windowing and inputs management
|
||||||
|
@ -244,7 +242,7 @@ bool WindowShouldClose(void)
|
||||||
|
|
||||||
// Toggle fullscreen mode
|
// Toggle fullscreen mode
|
||||||
void ToggleFullscreen(void)
|
void ToggleFullscreen(void)
|
||||||
{
|
{
|
||||||
RGFW_window_maximize(platform.window);
|
RGFW_window_maximize(platform.window);
|
||||||
ToggleBorderlessWindowed();
|
ToggleBorderlessWindowed();
|
||||||
}
|
}
|
||||||
|
@ -252,10 +250,9 @@ void ToggleFullscreen(void)
|
||||||
// Toggle borderless windowed mode
|
// Toggle borderless windowed mode
|
||||||
void ToggleBorderlessWindowed(void)
|
void ToggleBorderlessWindowed(void)
|
||||||
{
|
{
|
||||||
CORE.Window.flags & FLAG_WINDOW_UNDECORATED;
|
if (platform.window != NULL) {
|
||||||
|
RGFW_window_setBorder(platform.window, CORE.Window.flags & FLAG_WINDOW_UNDECORATED);
|
||||||
if (platform.window != NULL)
|
}
|
||||||
TRACELOG(LOG_WARNING, "ToggleBorderlessWindowed() after window creation not available on target platform");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set window state: maximized, if resizable
|
// Set window state: maximized, if resizable
|
||||||
|
@ -292,6 +289,7 @@ void SetWindowState(unsigned int flags)
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_RESIZABLE)
|
if (flags & FLAG_WINDOW_RESIZABLE)
|
||||||
{
|
{
|
||||||
|
printf("%i %i\n", platform.window->r.w, platform.window->r.h);
|
||||||
RGFW_window_setMaxSize(platform.window, RGFW_AREA(platform.window->r.w, platform.window->r.h));
|
RGFW_window_setMaxSize(platform.window, RGFW_AREA(platform.window->r.w, platform.window->r.h));
|
||||||
RGFW_window_setMinSize(platform.window, RGFW_AREA(platform.window->r.w, platform.window->r.h));
|
RGFW_window_setMinSize(platform.window, RGFW_AREA(platform.window->r.w, platform.window->r.h));
|
||||||
}
|
}
|
||||||
|
@ -313,7 +311,7 @@ void SetWindowState(unsigned int flags)
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_UNFOCUSED)
|
if (flags & FLAG_WINDOW_UNFOCUSED)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState() - FLAG_WINDOW_UNFOCUSED is not supported on PLATFORM_DESKTOP_SDL");
|
TRACELOG(LOG_WARNING, "SetWindowState() - FLAG_WINDOW_UNFOCUSED is not supported on PLATFORM_DESKTOP_RGFW");
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_TOPMOST)
|
if (flags & FLAG_WINDOW_TOPMOST)
|
||||||
{
|
{
|
||||||
|
@ -325,7 +323,7 @@ void SetWindowState(unsigned int flags)
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_TRANSPARENT)
|
if (flags & FLAG_WINDOW_TRANSPARENT)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState() - FLAG_WINDOW_TRANSPARENT is not supported on PLATFORM_DESKTOP_RGFW");
|
TRACELOG(LOG_WARNING, "SetWindowState() - FLAG_WINDOW_TRANSPARENT post window creation post window creation is not supported on PLATFORM_DESKTOP_RGFW");
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_HIGHDPI)
|
if (flags & FLAG_WINDOW_HIGHDPI)
|
||||||
{
|
{
|
||||||
|
@ -333,7 +331,7 @@ void SetWindowState(unsigned int flags)
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_MOUSE_PASSTHROUGH)
|
if (flags & FLAG_WINDOW_MOUSE_PASSTHROUGH)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "SetWindowState() - FLAG_WINDOW_MOUSE_PASSTHROUGH is not supported on PLATFORM_DESKTOP_RGFW");
|
RGFW_window_setMousePassthrough(platform.window, flags & FLAG_WINDOW_MOUSE_PASSTHROUGH);
|
||||||
}
|
}
|
||||||
if (flags & FLAG_BORDERLESS_WINDOWED_MODE)
|
if (flags & FLAG_BORDERLESS_WINDOWED_MODE)
|
||||||
{
|
{
|
||||||
|
@ -408,7 +406,7 @@ void ClearWindowState(unsigned int flags)
|
||||||
}
|
}
|
||||||
if (flags & FLAG_WINDOW_MOUSE_PASSTHROUGH)
|
if (flags & FLAG_WINDOW_MOUSE_PASSTHROUGH)
|
||||||
{
|
{
|
||||||
//SDL_SetWindowGrab(platform.window, SDL_TRUE);
|
RGFW_window_setMousePassthrough(platform.window, flags & FLAG_WINDOW_MOUSE_PASSTHROUGH);
|
||||||
TRACELOG(LOG_WARNING, "ClearWindowState() - FLAG_WINDOW_MOUSE_PASSTHROUGH is not supported on PLATFORM_DESKTOP_RGFW");
|
TRACELOG(LOG_WARNING, "ClearWindowState() - FLAG_WINDOW_MOUSE_PASSTHROUGH is not supported on PLATFORM_DESKTOP_RGFW");
|
||||||
}
|
}
|
||||||
if (flags & FLAG_BORDERLESS_WINDOWED_MODE)
|
if (flags & FLAG_BORDERLESS_WINDOWED_MODE)
|
||||||
|
@ -566,16 +564,16 @@ int GetMonitorCount(void)
|
||||||
// Get number of monitors
|
// Get number of monitors
|
||||||
int GetCurrentMonitor(void)
|
int GetCurrentMonitor(void)
|
||||||
{
|
{
|
||||||
int current = 0;
|
|
||||||
RGFW_monitor *mons = RGFW_getMonitors();
|
RGFW_monitor *mons = RGFW_getMonitors();
|
||||||
RGFW_monitor mon = RGFW_window_getMonitor(platform.window);
|
RGFW_monitor mon = RGFW_window_getMonitor(platform.window);
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
if ((mons[i].rect.x == mon.rect.x) && (mons[i].rect.y == mon.rect.y)) current = i;
|
if ((mons[i].rect.x == mon.rect.x) && (mons[i].rect.y == mon.rect.y))
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
return current;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get selected monitor position
|
// Get selected monitor position
|
||||||
|
@ -760,6 +758,62 @@ void SetMouseCursor(int cursor)
|
||||||
|
|
||||||
static KeyboardKey ConvertScancodeToKey(u32 keycode);
|
static KeyboardKey ConvertScancodeToKey(u32 keycode);
|
||||||
|
|
||||||
|
/*
|
||||||
|
TODO, try to make this better (RSGL uses this method too :I )
|
||||||
|
sourced from RSGL obviously -> ColleagueRiley
|
||||||
|
*/
|
||||||
|
char RSGL_keystrToChar(const char* str) {
|
||||||
|
if (str[1] == 0)
|
||||||
|
return str[0];
|
||||||
|
|
||||||
|
|
||||||
|
static const char* map[] = {
|
||||||
|
"asciitilde", "`",
|
||||||
|
"grave", "~",
|
||||||
|
"exclam", "!",
|
||||||
|
"at", "@",
|
||||||
|
"numbersign", "#",
|
||||||
|
"dollar", "$",
|
||||||
|
"percent", "%%",
|
||||||
|
"asciicircum", "^",
|
||||||
|
"ampersand", "&",
|
||||||
|
"asterisk", "*",
|
||||||
|
"parenleft", "(",
|
||||||
|
"parenright", ")",
|
||||||
|
"underscore", "_",
|
||||||
|
"minus", "-",
|
||||||
|
"plus", "+",
|
||||||
|
"equal", "=",
|
||||||
|
"braceleft", "{",
|
||||||
|
"bracketleft", "[",
|
||||||
|
"bracketright", "]",
|
||||||
|
"braceright", "}",
|
||||||
|
"colon", ":",
|
||||||
|
"semicolon", ";",
|
||||||
|
"quotedbl", "\"",
|
||||||
|
"apostrophe", "'",
|
||||||
|
"bar", "|",
|
||||||
|
"backslash", "\'",
|
||||||
|
"less", "<",
|
||||||
|
"comma", ",",
|
||||||
|
"greater", ">",
|
||||||
|
"period", ".",
|
||||||
|
"question", "?",
|
||||||
|
"slash", "/",
|
||||||
|
"space", " ",
|
||||||
|
"Return", "\n",
|
||||||
|
"Enter", "\n",
|
||||||
|
"enter", "\n",
|
||||||
|
};
|
||||||
|
|
||||||
|
u8 i = 0;
|
||||||
|
for (i = 0; i < (sizeof(map) / sizeof(char*)); i += 2)
|
||||||
|
if (strcmp(map[i], str) == 0)
|
||||||
|
return *map[i + 1];
|
||||||
|
|
||||||
|
return '\0';
|
||||||
|
}
|
||||||
|
|
||||||
// Register all input events
|
// Register all input events
|
||||||
void PollInputEvents(void)
|
void PollInputEvents(void)
|
||||||
{
|
{
|
||||||
|
@ -924,7 +978,7 @@ void PollInputEvents(void)
|
||||||
if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
|
if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
|
||||||
{
|
{
|
||||||
// Add character (codepoint) to the queue
|
// Add character (codepoint) to the queue
|
||||||
CORE.Input.Keyboard.charPressedQueue[CORE.Input.Keyboard.charPressedQueueCount] = RGFW_keystrToChar(event->keyName);
|
CORE.Input.Keyboard.charPressedQueue[CORE.Input.Keyboard.charPressedQueueCount] = RSGL_keystrToChar(event->keyName);
|
||||||
CORE.Input.Keyboard.charPressedQueueCount++;
|
CORE.Input.Keyboard.charPressedQueueCount++;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
Loading…
Reference in New Issue