mirror of
https://github.com/raysan5/raylib.git
synced 2026-03-10 02:55:41 +00:00
Merge branch 'master' of https://github.com/raysan5/raylib
This commit is contained in:
@@ -85,11 +85,11 @@
|
||||
// However, it can also reduce overall system performance, because the thread scheduler switches tasks more often
|
||||
#define SUPPORT_WINMM_HIGHRES_TIMER 1
|
||||
#endif
|
||||
#if !defined(SUPPORT_BUSY_WAIT_LOOP) && !SUPPORT_PARTIALBUSY_WAIT_LOOP
|
||||
#if !SUPPORT_BUSY_WAIT_LOOP && !SUPPORT_PARTIALBUSY_WAIT_LOOP
|
||||
// Use busy wait loop for timing sync, if not defined, a high-resolution timer is set up and used
|
||||
#define SUPPORT_BUSY_WAIT_LOOP 0 // Disabled by default
|
||||
#endif
|
||||
#if !defined(SUPPORT_PARTIALBUSY_WAIT_LOOP) && !SUPPORT_BUSY_WAIT_LOOP
|
||||
#if !SUPPORT_PARTIALBUSY_WAIT_LOOP && !SUPPORT_BUSY_WAIT_LOOP
|
||||
// Use a partial-busy wait loop, in this case frame sleeps for most of the time,
|
||||
// but then runs a busy loop at the end for accuracy
|
||||
#define SUPPORT_PARTIALBUSY_WAIT_LOOP 1
|
||||
|
||||
@@ -1049,7 +1049,10 @@ Image GetClipboardImage(void)
|
||||
Image image = { 0 };
|
||||
|
||||
#if SUPPORT_CLIPBOARD_IMAGE
|
||||
#if SUPPORT_MODULE_RTEXTURES
|
||||
#if defined(_WIN32)
|
||||
|
||||
#if SUPPORT_FILEFORMAT_BMP
|
||||
unsigned long long int dataSize = 0;
|
||||
void *bmpData = NULL;
|
||||
int width = 0;
|
||||
@@ -1059,10 +1062,16 @@ Image GetClipboardImage(void)
|
||||
|
||||
if (bmpData == NULL) TRACELOG(LOG_WARNING, "Clipboard image: Couldn't get clipboard data.");
|
||||
else image = LoadImageFromMemory(".bmp", (const unsigned char *)bmpData, (int)dataSize);
|
||||
#else
|
||||
TRACELOG(LOG_WARNING, "WARNING: Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_FILEFORMAT_BMP, specially on Windows");
|
||||
#endif // SUPPORT_FILEFORMAT_BMP
|
||||
#else
|
||||
TRACELOG(LOG_WARNING, "GetClipboardImage() not implemented on target platform");
|
||||
#endif
|
||||
#endif
|
||||
#endif // defined(_WIN32)
|
||||
#else // !SUPPORT_MODULE_RTEXTURES
|
||||
TRACELOG(LOG_WARNING, "Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_MODULE_RTEXTURES to work properly");
|
||||
#endif // SUPPORT_MODULE_RTEXTURES
|
||||
#endif // SUPPORT_CLIPBOARD_IMAGE
|
||||
|
||||
return image;
|
||||
}
|
||||
@@ -2049,7 +2058,7 @@ static void MouseButtonCallback(GLFWwindow *window, int button, int action, int
|
||||
CORE.Input.Mouse.currentButtonState[button] = action;
|
||||
CORE.Input.Touch.currentTouchState[button] = action;
|
||||
|
||||
#if SUPPORT_GESTURES_SYSTEM && defined(SUPPORT_MOUSE_GESTURES)
|
||||
#if SUPPORT_GESTURES_SYSTEM && SUPPORT_MOUSE_GESTURES
|
||||
// Process mouse events as touches to be able to use mouse-gestures
|
||||
GestureEvent gestureEvent = { 0 };
|
||||
|
||||
@@ -2084,7 +2093,7 @@ static void MouseCursorPosCallback(GLFWwindow *window, double x, double y)
|
||||
CORE.Input.Mouse.currentPosition.y = (float)y;
|
||||
CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition;
|
||||
|
||||
#if SUPPORT_GESTURES_SYSTEM && defined(SUPPORT_MOUSE_GESTURES)
|
||||
#if SUPPORT_GESTURES_SYSTEM && SUPPORT_MOUSE_GESTURES
|
||||
// Process mouse events as touches to be able to use mouse-gestures
|
||||
GestureEvent gestureEvent = { 0 };
|
||||
|
||||
|
||||
@@ -992,7 +992,7 @@ const char *GetClipboardText(void)
|
||||
return RGFW_readClipboard(NULL);
|
||||
}
|
||||
|
||||
#if defined(SUPPORT_CLIPBOARD_IMAGE)
|
||||
#if SUPPORT_CLIPBOARD_IMAGE
|
||||
#if defined(_WIN32)
|
||||
#define WIN32_CLIPBOARD_IMPLEMENTATION
|
||||
#define WINUSER_ALREADY_INCLUDED
|
||||
@@ -1006,8 +1006,11 @@ const char *GetClipboardText(void)
|
||||
Image GetClipboardImage(void)
|
||||
{
|
||||
Image image = { 0 };
|
||||
#if defined(SUPPORT_CLIPBOARD_IMAGE)
|
||||
#if SUPPORT_CLIPBOARD_IMAGE
|
||||
#if SUPPORT_MODULE_RTEXTURES
|
||||
#if defined(_WIN32)
|
||||
|
||||
#if SUPPORT_FILEFORMAT_BMP
|
||||
unsigned long long int dataSize = 0; // moved into _WIN32 scope until other platforms gain support
|
||||
void *fileData = NULL; // moved into _WIN32 scope until other platforms gain support
|
||||
|
||||
@@ -1017,9 +1020,15 @@ Image GetClipboardImage(void)
|
||||
|
||||
if (fileData == NULL) TRACELOG(LOG_WARNING, "Clipboard image: Couldn't get clipboard data");
|
||||
else image = LoadImageFromMemory(".bmp", (const unsigned char *)fileData, dataSize);
|
||||
#else
|
||||
TRACELOG(LOG_WARNING, "WARNING: Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_FILEFORMAT_BMP, specially on Windows");
|
||||
#endif // SUPPORT_FILEFORMAT_BMP
|
||||
#else
|
||||
TRACELOG(LOG_WARNING, "Clipboard image: PLATFORM_DESKTOP_RGFW doesn't implement GetClipboardImage() for this OS");
|
||||
#endif
|
||||
#endif // defined(_WIN32)
|
||||
#else // !SUPPORT_MODULE_RTEXTURES
|
||||
TRACELOG(LOG_WARNING, "Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_MODULE_RTEXTURES to work properly");
|
||||
#endif // SUPPORT_MODULE_RTEXTURES
|
||||
#endif // SUPPORT_CLIPBOARD_IMAGE
|
||||
|
||||
return image;
|
||||
@@ -1142,7 +1151,7 @@ const char *GetKeyName(int key)
|
||||
// Register all input events
|
||||
void PollInputEvents(void)
|
||||
{
|
||||
#if defined(SUPPORT_GESTURES_SYSTEM)
|
||||
#if SUPPORT_GESTURES_SYSTEM
|
||||
// NOTE: Gestures update must be called every frame to reset gestures correctly
|
||||
// because ProcessGestureEvent() is just called on an event, not every frame
|
||||
UpdateGestures();
|
||||
@@ -1408,7 +1417,7 @@ void PollInputEvents(void)
|
||||
default: break;
|
||||
}
|
||||
|
||||
#if defined(SUPPORT_GESTURES_SYSTEM)
|
||||
#if SUPPORT_GESTURES_SYSTEM
|
||||
if (touchAction > -1)
|
||||
{
|
||||
// Process mouse events as touches to be able to use mouse-gestures
|
||||
|
||||
@@ -1163,6 +1163,22 @@ Image GetClipboardImage(void)
|
||||
Image image = { 0 };
|
||||
|
||||
#if SUPPORT_CLIPBOARD_IMAGE
|
||||
#if !SUPPORT_MODULE_RTEXTURES
|
||||
TRACELOG(LOG_WARNING, "Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_MODULE_RTEXTURES to work properly");
|
||||
return image;
|
||||
#endif
|
||||
|
||||
// It's nice to have support Bitmap on Linux as well, but not as necessary as Windows
|
||||
#if !SUPPORT_FILEFORMAT_BMP && defined(_WIN32)
|
||||
TRACELOG(LOG_WARNING, "WARNING: Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_FILEFORMAT_BMP, specially on Windows");
|
||||
return image;
|
||||
#endif
|
||||
|
||||
// From what I've tested applications on Wayland saves images on clipboard as PNG
|
||||
#if (!SUPPORT_FILEFORMAT_PNG || !SUPPORT_FILEFORMAT_JPG) && !defined(_WIN32)
|
||||
TRACELOG(LOG_WARNING, "WARNING: Getting image from the clipboard might not work without SUPPORT_FILEFORMAT_PNG or SUPPORT_FILEFORMAT_JPG");
|
||||
return image;
|
||||
#endif
|
||||
// Let's hope compiler put these arrays in static memory
|
||||
const char *imageFormats[] = {
|
||||
"image/bmp",
|
||||
@@ -1197,7 +1213,7 @@ Image GetClipboardImage(void)
|
||||
}
|
||||
|
||||
if (!IsImageValid(image)) TRACELOG(LOG_WARNING, "Clipboard: Couldn't get clipboard data. ERROR: %s", SDL_GetError());
|
||||
#endif
|
||||
#endif // SUPPORT_CLIPBOARD_IMAGE
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ const char *GetKeyName(int key)
|
||||
// Register all input events
|
||||
void PollInputEvents(void)
|
||||
{
|
||||
#if defined(SUPPORT_GESTURES_SYSTEM)
|
||||
#if SUPPORT_GESTURES_SYSTEM
|
||||
// NOTE: Gestures update must be called every frame to reset gestures correctly
|
||||
// because ProcessGestureEvent() is just called on an event, not every frame
|
||||
UpdateGestures();
|
||||
|
||||
@@ -1564,7 +1564,7 @@ static void MouseButtonCallback(GLFWwindow *window, int button, int action, int
|
||||
CORE.Input.Mouse.currentButtonState[button] = action;
|
||||
CORE.Input.Touch.currentTouchState[button] = action;
|
||||
|
||||
#if SUPPORT_GESTURES_SYSTEM && defined(SUPPORT_MOUSE_GESTURES)
|
||||
#if SUPPORT_GESTURES_SYSTEM && SUPPORT_MOUSE_GESTURES
|
||||
// Process mouse events as touches to be able to use mouse-gestures
|
||||
GestureEvent gestureEvent = { 0 };
|
||||
|
||||
@@ -1605,7 +1605,7 @@ static void MouseMoveCallback(GLFWwindow *window, double x, double y)
|
||||
CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition;
|
||||
}
|
||||
|
||||
#if SUPPORT_GESTURES_SYSTEM && defined(SUPPORT_MOUSE_GESTURES)
|
||||
#if SUPPORT_GESTURES_SYSTEM && SUPPORT_MOUSE_GESTURES
|
||||
// Process mouse events as touches to be able to use mouse-gestures
|
||||
GestureEvent gestureEvent = { 0 };
|
||||
|
||||
|
||||
@@ -1457,7 +1457,7 @@ static EM_BOOL EmscriptenMouseCallback(int eventType, const EmscriptenMouseEvent
|
||||
default: break;
|
||||
}
|
||||
|
||||
#if SUPPORT_GESTURES_SYSTEM && defined(SUPPORT_MOUSE_GESTURES)
|
||||
#if SUPPORT_GESTURES_SYSTEM && SUPPORT_MOUSE_GESTURES
|
||||
// Process mouse events as touches to be able to use mouse-gestures
|
||||
GestureEvent gestureEvent = { 0 };
|
||||
|
||||
@@ -1529,7 +1529,7 @@ static EM_BOOL EmscriptenMouseMoveCallback(int eventType, const EmscriptenMouseE
|
||||
CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition;
|
||||
}
|
||||
|
||||
#if SUPPORT_GESTURES_SYSTEM && defined(SUPPORT_MOUSE_GESTURES)
|
||||
#if SUPPORT_GESTURES_SYSTEM && SUPPORT_MOUSE_GESTURES
|
||||
// Process mouse events as touches to be able to use mouse-gestures
|
||||
GestureEvent gestureEvent = { 0 };
|
||||
|
||||
|
||||
@@ -2708,7 +2708,7 @@ RMAPI void MatrixDecompose(Matrix mat, Vector3 *translation, Quaternion *rotatio
|
||||
stabilizer = fmaxf(stabilizer, fabsf(matColumns[i].x));
|
||||
stabilizer = fmaxf(stabilizer, fabsf(matColumns[i].y));
|
||||
stabilizer = fmaxf(stabilizer, fabsf(matColumns[i].z));
|
||||
};
|
||||
}
|
||||
matColumns[0] = Vector3Scale(matColumns[0], 1.0f / stabilizer);
|
||||
matColumns[1] = Vector3Scale(matColumns[1], 1.0f / stabilizer);
|
||||
matColumns[2] = Vector3Scale(matColumns[2], 1.0f / stabilizer);
|
||||
|
||||
16
src/rcore.c
16
src/rcore.c
@@ -529,22 +529,6 @@ const char *TextFormat(const char *text, ...); // Formatting of text with variab
|
||||
#define PLATFORM_DESKTOP_GLFW
|
||||
#endif
|
||||
|
||||
// Using '#pragma message' because '#warning' is not adopted by MSVC
|
||||
#if SUPPORT_CLIPBOARD_IMAGE
|
||||
#if !SUPPORT_MODULE_RTEXTURES
|
||||
#pragma message ("WARNING: Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_MODULE_RTEXTURES to work properly")
|
||||
#endif
|
||||
|
||||
// It's nice to have support Bitmap on Linux as well, but not as necessary as Windows
|
||||
#if !SUPPORT_FILEFORMAT_BMP && defined(_WIN32)
|
||||
#pragma message ("WARNING: Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_FILEFORMAT_BMP, specially on Windows")
|
||||
#endif
|
||||
|
||||
// From what I've tested applications on Wayland saves images on clipboard as PNG
|
||||
#if (!SUPPORT_FILEFORMAT_PNG || !SUPPORT_FILEFORMAT_JPG) && !defined(_WIN32)
|
||||
#pragma message ("WARNING: Getting image from the clipboard might not work without SUPPORT_FILEFORMAT_PNG or SUPPORT_FILEFORMAT_JPG")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Include platform-specific submodules
|
||||
#if defined(PLATFORM_DESKTOP_GLFW)
|
||||
|
||||
@@ -150,11 +150,11 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (defined(SUPPORT_FILEFORMAT_DDS) || \
|
||||
defined(SUPPORT_FILEFORMAT_PKM) || \
|
||||
defined(SUPPORT_FILEFORMAT_KTX) || \
|
||||
defined(SUPPORT_FILEFORMAT_PVR) || \
|
||||
defined(SUPPORT_FILEFORMAT_ASTC))
|
||||
#if (SUPPORT_FILEFORMAT_DDS || \
|
||||
SUPPORT_FILEFORMAT_PKM || \
|
||||
SUPPORT_FILEFORMAT_KTX || \
|
||||
SUPPORT_FILEFORMAT_PVR || \
|
||||
SUPPORT_FILEFORMAT_ASTC)
|
||||
|
||||
#if defined(__GNUC__) // GCC and Clang
|
||||
#pragma GCC diagnostic push
|
||||
|
||||
Reference in New Issue
Block a user