Przeglądaj źródła

Formating tweaks

pull/4554/merge
Ray 1 dzień temu
rodzic
commit
03ff864087
1 zmienionych plików z 26 dodań i 51 usunięć
  1. +26
    -51
      src/platforms/rcore_desktop_rgfw.c

+ 26
- 51
src/platforms/rcore_desktop_rgfw.c Wyświetl plik

@ -168,7 +168,6 @@ static const unsigned short keyMappingRGFW[] = {
[RGFW_SuperL] = KEY_LEFT_SUPER,
#ifndef RGFW_MACOS
[RGFW_ShiftR] = KEY_RIGHT_SHIFT,
[RGFW_AltR] = KEY_RIGHT_ALT,
#endif
[RGFW_Space] = KEY_SPACE,
@ -677,40 +676,37 @@ const char *GetClipboardText(void)
#if defined(SUPPORT_CLIPBOARD_IMAGE)
#ifdef _WIN32
# define WIN32_CLIPBOARD_IMPLEMENTATION
# define WINUSER_ALREADY_INCLUDED
# define WINBASE_ALREADY_INCLUDED
# define WINGDI_ALREADY_INCLUDED
# include "../external/win32_clipboard.h"
#if defined(_WIN32)
#define WIN32_CLIPBOARD_IMPLEMENTATION
#define WINUSER_ALREADY_INCLUDED
#define WINBASE_ALREADY_INCLUDED
#define WINGDI_ALREADY_INCLUDED
#include "../external/win32_clipboard.h"
#endif
#endif
// Get clipboard image
Image GetClipboardImage(void)
{
Image image = {0};
Image image = { 0 };
unsigned long long int dataSize = 0;
void* fileData = NULL;
void *fileData = NULL;
#ifdef _WIN32
int width, height;
fileData = (void*)Win32GetClipboardImageData(&width, &height, &dataSize);
#if defined(SUPPORT_CLIPBOARD_IMAGE)
#if defined(_WIN32)
int width = 0;
int height = 0;
fileData = (void *)Win32GetClipboardImageData(&width, &height, &dataSize);
if (fileData == NULL) TRACELOG(LOG_WARNING, "Clipboard image: Couldn't get clipboard data");
else image = LoadImageFromMemory(".bmp", fileData, dataSize);
#else
TRACELOG(LOG_WARNING, "Clipboard image: PLATFORM_DESKTOP_RGFW doesn't implement `GetClipboardImage` for this OS");
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)
@ -742,9 +738,7 @@ void EnableCursor(void)
void DisableCursor(void)
{
RGFW_disableCursor = true;
RGFW_window_mouseHold(platform.window, RGFW_AREA(0, 0));
HideCursor();
}
@ -875,6 +869,7 @@ char RSGL_keystrToChar(const char *str)
return '\0';
}
// Gamepad buttons conversion table
int RGFW_gpConvTable[18] = {
[RGFW_GP_Y] = GAMEPAD_BUTTON_RIGHT_FACE_UP,
[RGFW_GP_B] = GAMEPAD_BUTTON_RIGHT_FACE_RIGHT,
@ -895,8 +890,6 @@ int RGFW_gpConvTable[18] = {
[RGFW_GP_R3] = GAMEPAD_BUTTON_RIGHT_THUMB,
};
// Register all input events
void PollInputEvents(void)
{
@ -917,7 +910,6 @@ void PollInputEvents(void)
// Register previous mouse position
// Reset last gamepad button/axis registered state
for (int i = 0; (i < 4) && (i < MAX_GAMEPADS); i++)
{
// Check if gamepad is available
@ -1224,35 +1216,20 @@ int InitPlatform(void)
if ((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) > 0) flags |= RGFW_NO_BORDER;
if ((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) == 0) flags |= RGFW_NO_RESIZE;
if ((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) > 0) flags |= RGFW_TRANSPARENT_WINDOW;
if ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0) flags |= RGFW_FULLSCREEN;
// NOTE: Some OpenGL context attributes must be set before window creation
// Check selection OpenGL version
if (rlGetVersion() == RL_OPENGL_21)
{
RGFW_setGLVersion(RGFW_GL_CORE, 2, 1);
}
else if (rlGetVersion() == RL_OPENGL_33)
{
RGFW_setGLVersion(RGFW_GL_CORE, 3, 3);
}
else if (rlGetVersion() == RL_OPENGL_43)
{
RGFW_setGLVersion(RGFW_GL_CORE, 4, 1);
}
if (rlGetVersion() == RL_OPENGL_21) RGFW_setGLVersion(RGFW_GL_CORE, 2, 1);
else if (rlGetVersion() == RL_OPENGL_33) RGFW_setGLVersion(RGFW_GL_CORE, 3, 3);
else if (rlGetVersion() == RL_OPENGL_43) RGFW_setGLVersion(RGFW_GL_CORE, 4, 1);
if (CORE.Window.flags & FLAG_MSAA_4X_HINT)
{
RGFW_setGLSamples(4);
}
if (CORE.Window.flags & FLAG_MSAA_4X_HINT) RGFW_setGLSamples(4);
platform.window = RGFW_createWindow(CORE.Window.title, RGFW_RECT(0, 0, CORE.Window.screen.width, CORE.Window.screen.height), flags);
#ifndef PLATFORM_WEB_RGFW
RGFW_area screenSize = RGFW_getScreenSize();
CORE.Window.display.width = screenSize.w;
@ -1261,10 +1238,8 @@ int InitPlatform(void)
CORE.Window.display.width = CORE.Window.screen.width;
CORE.Window.display.height = CORE.Window.screen.height;
#endif
/*
I think this is needed by Raylib now ?
If so, rcore_destkop_sdl should be updated too
*/
// TODO: Is this needed by raylib now?
// If so, rcore_desktop_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);

Ładowanie…
Anuluj
Zapisz