9 Commits

Author SHA1 Message Date
Ray
7cbadefd06 Remove some spacing on module data 2026-11-24 21:09:37 +01:00
Ray
9fcb245f28 Clipboard image enabled by default 2026-11-24 21:09:03 +01:00
dd8e7491e2 [rmodels] Fix memory leak in LoadModelAnimations() (#6449) 2026-11-24 15:14:10 +01:00
fa14dc7792 [Examples] Updated text_animations shaking delta generation (#6448) 2026-11-24 12:08:39 +01:00
88b10152e9 rlparser: update raylib_api.* by CI 2026-11-24 11:07:33 +00:00
Ray
867376c6cb ADDED: SetClipboardImage() -WIP- 2026-11-24 12:07:10 +01:00
Ray
b7011ad4d4 Update Makefile.Android 2026-11-24 12:01:18 +01:00
b4a4f9d360 [rtextures] Round instead of truncate in ColorFromHSV() (#6445) 2026-11-24 10:23:09 +01:00
4880766618 [rshapes] Fix half-pixel offsets in DrawRectangleLines() (#6430)
* [rshapes] Fix half-pixel offsets in DrawRectangleLines

* Calculate half-pixel offsets using 2x2 inverse matrix
2026-11-23 20:03:46 +01:00
24 changed files with 913 additions and 722 deletions

View File

@ -26,15 +26,16 @@ PLATFORM ?= PLATFORM_ANDROID
RAYLIB_PATH ?= ..\..
# Define Android architecture (armeabi-v7a, arm64-v8a, x86, x86-64) and API version
# Starting in 2019 using ARM64 is mandatory for published apps,
# Starting on August 2020, minimum required target API is Android 10 (API level 29)
# NOTE: Starting in 2019 using ARM64 is mandatory for published apps
# NOTE: Starting on August 2020, minimum required target API is Android 10 (API level 29)
# NOTE: Android 13 (API level 33), released on August 2022 should be a safe bet
ANDROID_ARCH ?= ARM64
ANDROID_API_VERSION = 29
ANDROID_API_VERSION = 33
# Android required path variables
# NOTE: Starting with Android NDK r21, no more toolchain generation is required, NDK is the toolchain on itself
ifeq ($(OS),Windows_NT)
ANDROID_NDK = C:/android-ndk
ANDROID_NDK = C:/android-ndk-r30
ANDROID_TOOLCHAIN = $(ANDROID_NDK)/toolchains/llvm/prebuilt/windows-x86_64
else
ANDROID_NDK ?= /usr/lib/android/ndk
@ -55,10 +56,10 @@ ifeq ($(ANDROID_ARCH),x86_64)
endif
# Required path variables
# NOTE: JAVA_HOME must be set to JDK (using OpenJDK 13)
JAVA_HOME ?= C:/open-jdk
# NOTE: JAVA_HOME must be set to JDK (using OpenJDK 27.0.1.1)
JAVA_HOME ?= C:/open-jdk-27.0.1.1
ANDROID_HOME ?= C:/android-sdk
ANDROID_BUILD_TOOLS ?= $(ANDROID_HOME)/build-tools/29.0.3
ANDROID_BUILD_TOOLS ?= $(ANDROID_HOME)/build-tools/36.0.0
ANDROID_PLATFORM_TOOLS = $(ANDROID_HOME)/platform-tools
# Android project configuration variables
@ -137,7 +138,9 @@ CFLAGS += -ffunction-sections -funwind-tables -fstack-protector-strong -fPIC
# Compiler options for the linker
CFLAGS += -Wall -Wa,--noexecstack -Wformat -Werror=format-security -no-canonical-prefixes
# Preprocessor macro definitions
CFLAGS += -DANDROID -DPLATFORM_ANDROID -D__ANDROID_API__=$(ANDROID_API_VERSION)
CFLAGS += -DANDROID -DPLATFORM_ANDROID
# NOTE: API level is already implicit on compiler call, no need for redefinition
#-D__ANDROID_API__=$(ANDROID_API_VERSION)
# Paths containing required header files
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(NATIVE_APP_GLUE_PATH)

View File

@ -52,6 +52,7 @@ int main(void)
int frameCount = 0;
Vector2 glyphPosition[MAX_TEXT_LENGTH] = { 0 };
Vector2 glyphDelta[MAX_TEXT_LENGTH] = { 0 };
unsigned char glyphAlpha[MAX_TEXT_LENGTH] = { 0 };
SetTargetFPS(60);
@ -66,8 +67,8 @@ int main(void)
if (IsKeyPressed(KEY_S)) text.delta = Clamp(text.delta - 2.0f, 10.0f, 60.0f);
else if (IsKeyPressed(KEY_W)) text.delta = Clamp(text.delta + 2.0f, 10.0f, 60.0f);
if (IsKeyPressed(KEY_A)) text.duration = (int) Clamp((float) text.duration - 5.0f, 20.0f, 120.0f);
else if (IsKeyPressed(KEY_D)) text.duration = (int) Clamp((float) text.duration + 5.0f, 20.0f, 120.0f);
if (IsKeyPressed(KEY_A)) text.duration = (int) Clamp((float) text.duration - 5.0f, 10.0f, 120.0f);
else if (IsKeyPressed(KEY_D)) text.duration = (int) Clamp((float) text.duration + 5.0f, 10.0f, 120.0f);
if (IsKeyPressed(KEY_Z)) text.offset = Clamp(text.offset - 1.0f, 0.0f, 15.0f);
else if (IsKeyPressed(KEY_X)) text.offset = Clamp(text.offset + 1.0f, 0.0f, 15.0f);
if (IsKeyPressed(KEY_Q)) currentAnimation = currentAnimation? currentAnimation - 1 : animationsSize - 1;
@ -107,18 +108,21 @@ int main(void)
for (unsigned int i = 0; i < TextLength(text.str); i++)
{
float time = (int) (frameCount + i*text.offset)%(int)text.duration;
float deltaX = (float) GetRandomValue(-text.delta/10, text.delta/10);
float deltaY = (float) GetRandomValue(-text.delta/10, text.delta/10);
if (time <= 1.0f) // Actives once every `text.duration` frames
{
glyphDelta[i].x = (float) GetRandomValue(-text.delta/10, text.delta/10);
glyphDelta[i].y = (float) GetRandomValue(-text.delta/10, text.delta/10);
}
if (time < (text.duration/2))
{
glyphPosition[i].x = EaseLinearNone(time, glyphPosition[i].x, deltaX, text.duration/2);
glyphPosition[i].y = EaseLinearNone(time, text.position.y, deltaY, text.duration/2);
glyphPosition[i].x = EaseLinearNone(time, glyphPosition[i].x, glyphDelta[i].x, text.duration/2);
glyphPosition[i].y = EaseLinearNone(time, text.position.y, glyphDelta[i].y, text.duration/2);
}
else
{
glyphPosition[i].x = EaseLinearNone(time - text.duration/2, glyphPosition[i].x + deltaX, -deltaX, text.duration/2);
glyphPosition[i].y = EaseLinearNone(time - text.duration/2, text.position.y + deltaY, -deltaY, text.duration/2);
glyphPosition[i].x = EaseLinearNone(time - text.duration/2, glyphPosition[i].x + glyphDelta[i].x, -glyphDelta[i].x, text.duration/2);
glyphPosition[i].y = EaseLinearNone(time - text.duration/2, text.position.y + glyphDelta[i].y, -glyphDelta[i].y, text.duration/2);
}
}
} break;

View File

@ -113,16 +113,6 @@
// Enabling this flag allows manual control of the frame processes, use at your own risk
#define SUPPORT_CUSTOM_FRAME_CONTROL 0 // Disabled by default
#endif
#ifndef SUPPORT_CLIPBOARD_IMAGE
// Support for clipboard image loading
// NOTE: Only working on SDL3, GLFW (Windows) and RGFW (Windows)
// WARNING: It requires support for some additional flags:
// - SUPPORT_MODULE_RTEXTURES
// - SUPPORT_FILEFORMAT_BMP (Windows clipboard)
// - SUPPORT_FILEFORMAT_PNG (Wayland clipboard)
// - SUPPORT_FILEFORMAT_JPG
#define SUPPORT_CLIPBOARD_IMAGE 1
#endif
// rcore: Configuration values
// NOTE: Below values are already defined inside [rcore.c] so there is no need to be

View File

@ -706,12 +706,22 @@ const char *GetClipboardText(void)
return buffer;
}
// Set clipboard image content
bool SetClipboardImage(Image image)
{
bool result = false;
TRACELOG(LOG_WARNING, "SetClipboardImage() not implemented on target platform");
return result;
}
// Get clipboard image
Image GetClipboardImage(void)
{
Image image = { 0 };
TRACELOG(LOG_WARNING, "GetClipboardImage() not implemented on target platform");
TRACELOG(LOG_WARNING, "Clipboard image retrieving not implemented");
return image;
}

View File

@ -59,6 +59,7 @@
typedef struct HWND__ *HWND;
#endif
#define WIN32_CLIPBOARD_IMPLEMENTATION
#include "../external/win32_clipboard.h" // Clipboard image copy-paste
#define GLFW_EXPOSE_NATIVE_WIN32
@ -796,8 +797,7 @@ void *GetWindowHandle(void)
#if defined(_WIN32)
handle = glfwGetWin32Window(platform.handle); // Type: HWND
#endif
#if defined(__linux__)
#elif defined(__linux__)
#if defined(_GLFW_WAYLAND)
#if defined(_GLFW_X11)
int platformID = glfwGetPlatform();
@ -818,8 +818,7 @@ void *GetWindowHandle(void)
platform.windowHandleX11 = glfwGetX11Window(platform.handle);
handle = &platform.windowHandleX11;
#endif
#endif
#if defined(__APPLE__)
#elif defined(__APPLE__)
handle = (void *)glfwGetCocoaWindow(platform.handle); // Type: NSWindow*
#endif
@ -1081,20 +1080,40 @@ void SetClipboardText(const char *text)
}
// Get clipboard text content
// NOTE: returned string is allocated and freed by GLFW
// NOTE: Returned string is allocated and freed by GLFW
const char *GetClipboardText(void)
{
return glfwGetClipboardString(platform.handle);
}
// Set clipboard image content
bool SetClipboardImage(Image image)
{
bool result = false;
#if defined(_WIN32)
#elif defined(__linux__)
#elif defined(__APPLE__)
#endif
return result;
}
// Get clipboard image
Image GetClipboardImage(void)
{
Image image = { 0 };
#if SUPPORT_CLIPBOARD_IMAGE && SUPPORT_MODULE_RTEXTURES
#if defined(_WIN32)
#if !SUPPORT_MODULE_RTEXTURES
TRACELOG(LOG_WARNING, "Clipboard image requires SUPPORT_MODULE_RTEXTURES to work");
return image;
#endif
#if defined(_WIN32)
unsigned int dataSize = 0;
void *bmpData = NULL;
int width = 0;
@ -1106,13 +1125,10 @@ Image GetClipboardImage(void)
else
{
image = LoadImageFromMemory(".bmp", (const unsigned char *)bmpData, (int)dataSize);
RL_FREE(bmpData);
}
#elif defined(__linux__) && defined(_GLFW_X11)
// REF: https://github.com/ColleagueRiley/Clipboard-Copy-Paste/blob/main/x11.c
// REF: https://github.com/ColleagueRiley/Clipboard-Copy-Paste/blob/main/x11.
static Atom clipboard = 0;
static Atom targetType = 0;
static Atom property = 0;
@ -1150,13 +1166,9 @@ Image GetClipboardImage(void)
image = LoadImageFromMemory(".png", data, (int)nitems);
XFree(data);
}
#else
TRACELOG(LOG_WARNING, "GetClipboardImage() not implemented on target platform");
#endif // _WIN32
#else
TRACELOG(LOG_WARNING, "Clipboard image: SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_MODULE_RTEXTURES to work properly");
#endif // SUPPORT_CLIPBOARD_IMAGE
TRACELOG(LOG_WARNING, "Clipboard image not implemented on target platform");
#endif
return image;
}
@ -1245,11 +1257,9 @@ void OpenURL(const char *url)
char *cmd = (char *)RL_CALLOC(strlen(url) + 16, sizeof(char));
#if defined(_WIN32)
sprintf(cmd, "explorer \"%s\"", url);
#endif
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
sprintf(cmd, "xdg-open '%s'", url); // Alternatives: firefox, x-www-browser
#endif
#if defined(__APPLE__)
#elif defined(__APPLE__)
sprintf(cmd, "open '%s'", url);
#endif
int result = system(cmd);
@ -2277,8 +2287,4 @@ static void JoystickCallback(int jid, int event)
}
}
#ifdef _WIN32
# define WIN32_CLIPBOARD_IMPLEMENTATION
# include "../external/win32_clipboard.h"
#endif
// EOF

View File

@ -168,6 +168,17 @@ extern "C" {
#undef Size
#endif
#if defined(_WIN32)
#define WIN32_CLIPBOARD_IMPLEMENTATION
#define WINUSER_ALREADY_INCLUDED
#define WINBASE_ALREADY_INCLUDED
#define WINGDI_ALREADY_INCLUDED
#include "../external/win32_clipboard.h"
#elif defined(__linux__) && defined(DRGFW_X11)
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#endif
#include <stdbool.h>
//----------------------------------------------------------------------------------
@ -1307,27 +1318,17 @@ const char *GetClipboardText(void)
return RGFW_readClipboard(NULL);
}
#if SUPPORT_CLIPBOARD_IMAGE
#if defined(_WIN32)
#define WIN32_CLIPBOARD_IMPLEMENTATION
#define WINUSER_ALREADY_INCLUDED
#define WINBASE_ALREADY_INCLUDED
#define WINGDI_ALREADY_INCLUDED
#include "../external/win32_clipboard.h"
#elif defined(__linux__) && defined(DRGFW_X11)
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#endif
#endif
// Get clipboard image
Image GetClipboardImage(void)
{
Image image = { 0 };
#if SUPPORT_CLIPBOARD_IMAGE && SUPPORT_MODULE_RTEXTURES
#if defined(_WIN32)
#if !SUPPORT_MODULE_RTEXTURES
TRACELOG(LOG_WARNING, "Clipboard image requires SUPPORT_MODULE_RTEXTURES to work");
return image;
#endif
#if defined(_WIN32)
unsigned int dataSize = 0;
void *fileData = NULL;
@ -1339,12 +1340,9 @@ Image GetClipboardImage(void)
else
{
image = LoadImageFromMemory(".bmp", (const unsigned char *)fileData, (int)dataSize);
RL_FREE(fileData);
}
#elif defined(__linux__) && defined(DRGFW_X11)
// REF: https://github.com/ColleagueRiley/Clipboard-Copy-Paste/blob/main/x11.c
Display *dpy = XOpenDisplay(NULL);
if (!dpy) return image;
@ -1390,11 +1388,8 @@ Image GetClipboardImage(void)
XDestroyWindow(dpy, win);
XCloseDisplay(dpy);
#else
TRACELOG(LOG_WARNING, "Clipboard image: PLATFORM_DESKTOP_RGFW doesn't implement GetClipboardImage() for this OS");
#endif // _WIN32
#else
TRACELOG(LOG_WARNING, "Clipboard image: SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_MODULE_RTEXTURES to work properly");
#endif // SUPPORT_CLIPBOARD_IMAGE
TRACELOG(LOG_WARNING, "Clipboard image not implemented on target platform");
#endif
return image;
}
@ -2042,8 +2037,8 @@ static KeyboardKey ConvertScancodeToKey(u32 keycode)
return (KeyboardKey)RGFW_keyConvertTable[keycode];
}
// assign mouse to touches
// 0-TOUCH_ACTION_UP, 1-TOUCH_ACTION_DOWN, 2-TOUCH_ACTION_MOVE
// Assign mouse input events to touches
// NOTE: 0-TOUCH_ACTION_UP, 1-TOUCH_ACTION_DOWN, 2-TOUCH_ACTION_MOVE
void RemapMouseToTouch(int touchAction)
{
#if SUPPORT_GESTURES_SYSTEM

View File

@ -1200,27 +1200,37 @@ const char *GetClipboardText(void)
return buffer;
}
// Set clipboard image content
bool SetClipboardImage(Image image)
{
bool result = false;
// TODO: bool SDL_SetClipboardData(SDL_ClipboardDataCallback callback, SDL_ClipboardCleanupCallback cleanup, void *userdata, const char *const *mime_types, size_t num_mime_types);
return result;
}
// Get clipboard image
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");
TRACELOG(LOG_WARNING, "Clipboard image requires SUPPORT_MODULE_RTEXTURES to work");
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");
TRACELOG(LOG_WARNING, "Clipboard image requires SUPPORT_FILEFORMAT_BMP 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");
TRACELOG(LOG_WARNING, "Clipboard image might require SUPPORT_FILEFORMAT_PNG or SUPPORT_FILEFORMAT_JPG");
#endif
// Let's hope compiler put these arrays in static memory
const char *imageFormats[] = {
"image/bmp",
@ -1228,6 +1238,7 @@ Image GetClipboardImage(void)
"image/jpg",
"image/tiff",
};
const char *imageExtensions[] = {
".bmp",
".png",
@ -1236,7 +1247,7 @@ Image GetClipboardImage(void)
};
size_t dataSize = 0;
void *fileData = NULL;
void *fileData = NULL;
for (int i = 0; i < SDL_arraysize(imageFormats); i++)
{
@ -1245,19 +1256,17 @@ Image GetClipboardImage(void)
if (fileData)
{
image = LoadImageFromMemory(imageExtensions[i], fileData, (int)dataSize);
SDL_free(fileData);
if (IsImageValid(image))
{
TRACELOG(LOG_INFO, "Clipboard: Got image from clipboard successfully: %s", imageExtensions[i]);
TRACELOG(LOG_INFO, "Clipboard image retrieved successfully (%s image data)", imageExtensions[i]);
return image;
}
}
}
if (!IsImageValid(image)) TRACELOG(LOG_WARNING, "Clipboard: Couldn't get clipboard data. ERROR: %s", SDL_GetError());
#endif // SUPPORT_CLIPBOARD_IMAGE
if (!IsImageValid(image)) TRACELOG(LOG_WARNING, "Clipboard image data can not be retrieved, ERROR: %s", SDL_GetError());
return image;
}

View File

@ -91,6 +91,12 @@ typedef enum MONITOR_DPI_TYPE {
#include <GL/gl.h>
#endif
#define WIN32_CLIPBOARD_IMPLEMENTATION
#define WINUSER_ALREADY_INCLUDED
#define WINBASE_ALREADY_INCLUDED
#define WINGDI_ALREADY_INCLUDED
#include "../external/win32_clipboard.h"
//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------
@ -1417,20 +1423,71 @@ const char *GetClipboardText(void)
return platform.clipboardText;
}
#if SUPPORT_CLIPBOARD_IMAGE && SUPPORT_MODULE_RTEXTURES
#define WIN32_CLIPBOARD_IMPLEMENTATION
#define WINUSER_ALREADY_INCLUDED
#define WINBASE_ALREADY_INCLUDED
#define WINGDI_ALREADY_INCLUDED
#include "../external/win32_clipboard.h"
#endif
// Set clipboard image content
bool SetClipboardImage(Image image)
{
bool result = false;
BOOL opened = OpenClipboard(NULL);
if (opened)
{
EmptyClipboard();
Image imCopy = { 0 };
bool useCopy = false;
if (image.format != PIXELFORMAT_UNCOMPRESSED_R8G8B8A8)
{
// Make sure data is RGBA 32bit
imCopy = ImageCopy(image);
ImageFormat(&imCopy, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8);
useCopy = true;
}
// Calculate bitmap information size.
BITMAPINFOHEADER header = { 0 };
header.biSize = sizeof(BITMAPINFOHEADER);
header.biWidth = image.width;
header.biHeight = -image.height; // Top-down bitmap
header.biPlanes = 1;
header.biBitCount = 32;
header.biCompression = BI_RGB;
header.biSizeImage = image.width*image.height*4;
SIZE_T size = sizeof(header) + header.biSizeImage;
HGLOBAL memory = GlobalAlloc(GMEM_MOVEABLE, size);
if (memory)
{
BYTE *data = (BYTE *)GlobalLock(memory);
memcpy(data, &header, sizeof(header));
memcpy(data + sizeof(header), useCopy? imCopy.data : image.data, header.biSizeImage);
GlobalUnlock(memory);
HANDLE clipset = SetClipboardData(CF_DIB, memory);
if (clipset == NULL) GlobalFree(memory);
}
if (useCopy) UnloadImage(imCopy);
CloseClipboard();
}
return result;
}
// Get clipboard image
Image GetClipboardImage(void)
{
Image image = { 0 };
#if !SUPPORT_MODULE_RTEXTURES
TRACELOG(LOG_WARNING, "Clipboard image requires SUPPORT_MODULE_RTEXTURES to work");
return image;
#endif
#if SUPPORT_CLIPBOARD_IMAGE && SUPPORT_MODULE_RTEXTURES
unsigned int dataSize = 0;
void *fileData = NULL;
int width = 0;
@ -1441,12 +1498,10 @@ Image GetClipboardImage(void)
if (fileData == NULL) TRACELOG(LOG_WARNING, "Clipboard image: Couldn't get clipboard data.");
else
{
// TODO: Support additional image file-formats
image = LoadImageFromMemory(".bmp", (const unsigned char*)fileData, (int)dataSize);
RL_FREE(fileData);
}
#else
TRACELOG(LOG_WARNING, "Clipboard image: SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_MODULE_RTEXTURES to work properly");
#endif // SUPPORT_CLIPBOARD_IMAGE
return image;
}
@ -1777,7 +1832,11 @@ HGLRC InitOpenGL(HWND hwnd, HDC hdc)
HGLRC tempContext = wglCreateContext(dummyHDC);
//if (!tempContext) { TRACELOG(LOG_ERROR, "%s failed, error=%lu", "wglCreateContext", GetLastError()); return -1; }
BOOL result = wglMakeCurrent(dummyHDC, tempContext);
//if (!result) { TRACELOG(LOG_ERROR, "%s failed, error=%lu", "wglMakeCurrent", GetLastError()); return -1; }
if (!result)
{
TRACELOG(LOG_ERROR, "GL: Context failed to be set as current, error code: %lu", GetLastError());
return NULL;
}
// Load WGL extension entry points
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");

View File

@ -555,12 +555,22 @@ const char *GetClipboardText(void)
return NULL;
}
// Set clipboard image content
bool SetClipboardImage(Image image)
{
bool result = false;
TRACELOG(LOG_WARNING, "SetClipboardImage() not implemented on target platform");
return result;
}
// Get clipboard image
Image GetClipboardImage(void)
{
Image image = { 0 };
TRACELOG(LOG_WARNING, "GetClipboardImage() not implemented on target platform");
TRACELOG(LOG_WARNING, "Clipboard image retrieving not implemented");
return image;
}

View File

@ -308,12 +308,22 @@ const char *GetClipboardText(void)
return NULL;
}
// Set clipboard image content
bool SetClipboardImage(Image image)
{
bool result = false;
TRACELOG(LOG_WARNING, "SetClipboardImage() not implemented on target platform");
return result;
}
// Get clipboard image
Image GetClipboardImage(void)
{
Image image = { 0 };
TRACELOG(LOG_WARNING, "GetClipboardImage() not implemented on target platform");
TRACELOG(LOG_WARNING, "Clipboard image retrieving not implemented");
return image;
}

View File

@ -287,12 +287,22 @@ const char *GetClipboardText(void)
return NULL;
}
// Set clipboard image content
bool SetClipboardImage(Image image)
{
bool result = false;
TRACELOG(LOG_WARNING, "SetClipboardImage() not implemented on target platform");
return result;
}
// Get clipboard image
Image GetClipboardImage(void)
{
Image image = { 0 };
TRACELOG(LOG_WARNING, "GetClipboardImage() not implemented on target platform");
TRACELOG(LOG_WARNING, "Clipboard image retrieving not implemented");
return image;
}

View File

@ -883,17 +883,34 @@ EM_JS(unsigned char *, GetLastPastedImage, (int *width, int *height), {
const char *GetClipboardText(void)
{
RequestClipboardData();
return GetLastPastedText();
}
// Set clipboard image content
bool SetClipboardImage(Image image)
{
bool result = false;
TRACELOG(LOG_WARNING, "SetClipboardImage() not implemented on target platform");
return result;
}
// Get clipboard image
Image GetClipboardImage(void)
{
Image image = { 0 };
int width = 0;
int height = 0;
#if !SUPPORT_MODULE_RTEXTURES
TRACELOG(LOG_WARNING, "Clipboard image requires SUPPORT_MODULE_RTEXTURES to work");
return image;
#endif
RequestClipboardData();
int width = 0;
int height = 0;
unsigned char *data = GetLastPastedImage(&width, &height);
if (data != NULL)
@ -1691,7 +1708,6 @@ static void MouseButtonCallback(GLFWwindow *window, int button, int action, int
// Gesture data is sent to gestures-system for processing
// Prevent calling ProcessGestureEvent() when Emscripten is present and there's a touch gesture, so EmscriptenTouchCallback() can handle it itself
if (GetMouseX() != 0 || GetMouseY() != 0) ProcessGestureEvent(gestureEvent);
#endif
}

View File

@ -864,12 +864,15 @@ EM_ASYNC_JS(void, RequestClipboardData, (void), {
EM_JS(char *, GetLastPastedText, (void), {
var str = window._lastClipboardString || "";
var length = lengthBytesUTF8(str) + 1;
if (length > 1)
{
var ptr = _malloc(length);
stringToUTF8(str, ptr, length);
return ptr;
}
return 0;
});
@ -885,7 +888,7 @@ EM_JS(unsigned char *, GetLastPastedImage, (int *width, int *height), {
// Set the width and height via the pointers passed from C
// HEAP32 handles the 4-byte integers
if (width) setValue(width, window._lastImgWidth, 'i32');
if (width) setValue(width, window._lastImgWidth, 'i32');
if (height) setValue(height, window._lastImgHeight, 'i32');
// Clear the JS buffer so there is no need to fetch the same image twice
@ -907,14 +910,30 @@ const char *GetClipboardText(void)
return GetLastPastedText();
}
// Set clipboard image content
bool SetClipboardImage(Image image)
{
bool result = false;
TRACELOG(LOG_WARNING, "SetClipboardImage() not implemented on target platform");
return result;
}
// Get clipboard image
Image GetClipboardImage(void)
{
Image image = { 0 };
#if !SUPPORT_MODULE_RTEXTURES
TRACELOG(LOG_WARNING, "Clipboard image requires SUPPORT_MODULE_RTEXTURES to work");
return image;
#endif
RequestClipboardData();
int width = 0;
int height = 0;
RequestClipboardData();
unsigned char *data = GetLastPastedImage(&width, &height);
if (data != NULL)

View File

@ -1031,6 +1031,7 @@ RLAPI Vector2 GetWindowScaleDPI(void); // Get window
RLAPI const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the specified monitor
RLAPI void SetClipboardText(const char *text); // Set clipboard text content
RLAPI const char *GetClipboardText(void); // Get clipboard text content
RLAPI bool SetClipboardImage(Image image); // Set clipboard image content
RLAPI Image GetClipboardImage(void); // Get clipboard image content
RLAPI void EnableEventWaiting(void); // Enable waiting for events on EndDrawing(), no automatic event polling
RLAPI void DisableEventWaiting(void); // Disable waiting for events on EndDrawing(), automatic events polling

View File

@ -322,11 +322,9 @@ typedef struct CoreData {
char **dropFilepaths; // Store dropped files paths pointers (provided by GLFW)
unsigned int dropFileCount; // Count dropped files strings
} Window;
struct {
const char *basePath; // Base path for data storage
} Storage;
struct {
struct {
@ -343,7 +341,6 @@ typedef struct CoreData {
int charPressedQueue[MAX_CHAR_PRESSED_QUEUE]; // Input characters queue (unicode)
int charPressedQueueCount; // Input characters queue count
} Keyboard;
struct {
Vector2 offset; // Mouse offset
@ -361,7 +358,6 @@ typedef struct CoreData {
char previousButtonState[MAX_MOUSE_BUTTONS]; // Registers previous mouse button state
Vector2 currentWheelMove; // Registers current mouse wheel variation
Vector2 previousWheelMove; // Registers previous mouse wheel variation
} Mouse;
struct {
int pointCount; // Number of touch points active
@ -370,7 +366,6 @@ typedef struct CoreData {
Vector2 previousPosition[MAX_TOUCH_POINTS]; // Previous touch position on screen
char currentTouchState[MAX_TOUCH_POINTS]; // Registers current touch state
char previousTouchState[MAX_TOUCH_POINTS]; // Registers previous touch state
} Touch;
struct {
int lastButtonPressed; // Register last gamepad button pressed
@ -380,9 +375,7 @@ typedef struct CoreData {
char currentButtonState[MAX_GAMEPADS][MAX_GAMEPAD_BUTTONS]; // Current gamepad buttons state
char previousButtonState[MAX_GAMEPADS][MAX_GAMEPAD_BUTTONS]; // Previous gamepad buttons state
float axisState[MAX_GAMEPADS][MAX_GAMEPAD_AXES]; // Gamepad axes state
} Gamepad;
} Input;
struct {
double current; // Current time measure (seconds)
@ -393,7 +386,6 @@ typedef struct CoreData {
double target; // Desired time for one frame, if 0 not applied (seconds)
unsigned long long base; // Base time measure for hi-res timer (ticks or nanoseconds)
unsigned int frameCounter; // Frame counter (frames)
} Time;
} CoreData;
@ -524,7 +516,7 @@ const char *TextFormat(const char *text, ...); // Formatting of text with variab
#include "platforms/rcore_desktop_glfw.c"
#elif defined(PLATFORM_DESKTOP_SDL)
#include "platforms/rcore_desktop_sdl.c"
#elif (defined(PLATFORM_DESKTOP_RGFW) || defined(PLATFORM_WEB_RGFW))
#elif defined(PLATFORM_DESKTOP_RGFW) || defined(PLATFORM_WEB_RGFW)
#include "platforms/rcore_desktop_rgfw.c"
#elif defined(PLATFORM_DESKTOP_WIN32)
#include "platforms/rcore_desktop_win32.c"
@ -579,8 +571,17 @@ const char *TextFormat(const char *text, ...); // Formatting of text with variab
//Vector2 GetMonitorPosition(int monitor)
//const char *GetMonitorName(int monitor)
// Clipboard interaction support
// NOTE: Only working on SDL3, GLFW (Windows) and RGFW (Windows)
// WARNING: It requires support for some additional flags:
// - SUPPORT_MODULE_RTEXTURES
// - SUPPORT_FILEFORMAT_BMP (Windows clipboard)
// - SUPPORT_FILEFORMAT_PNG (Wayland clipboard)
// - SUPPORT_FILEFORMAT_JPG
//void SetClipboardText(const char *text)
//const char *GetClipboardText(void)
//bool SetClipboardImage(Image image)
//Image GetClipboardImage(void)
//void ShowCursor(void)
//void HideCursor(void)
@ -909,7 +910,7 @@ void EndDrawing(void)
double waitTime = CORE.Time.current - CORE.Time.previous;
CORE.Time.previous = CORE.Time.current;
CORE.Time.frame += waitTime; // Total frame time: update + draw + wait
CORE.Time.frame += waitTime; // Total frame time: update + draw + wait
}
PollInputEvents(); // Poll user events (before next frame update)
@ -1675,8 +1676,7 @@ void WaitTime(double seconds)
// System halt functions
#if defined(_WIN32)
Sleep((unsigned long)(sleepSeconds*1000.0));
#endif
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__EMSCRIPTEN__)
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__EMSCRIPTEN__)
struct timespec req = { 0 };
time_t sec = sleepSeconds;
long nsec = (sleepSeconds - sec)*1000000000L;
@ -1685,8 +1685,7 @@ void WaitTime(double seconds)
// NOTE: Use nanosleep() on Unix platforms... usleep() it's deprecated
while (nanosleep(&req, &req) == -1) continue;
#endif
#if defined(__APPLE__)
#elif defined(__APPLE__)
usleep(sleepSeconds*1000000.0);
#endif
@ -2424,6 +2423,7 @@ bool IsFileExtension(const char *fileName, const char *ext)
bool IsFileHidden(const char *filePath)
{
bool result = false;
#if defined(_WIN32)
unsigned long attribs = GetFileAttributesA(filePath);
@ -2435,6 +2435,7 @@ bool IsFileHidden(const char *filePath)
if ((basePath[0] == '.') && (strcmp(basePath, ".") != 0) && (strcmp(basePath, "..") != 0)) result = true;
#endif
return result;
}
@ -2692,9 +2693,7 @@ const char *GetApplicationDirectory(void)
appDir[0] = '.';
appDir[1] = '\\';
}
#elif defined(__linux__)
unsigned int size = sizeof(appDir);
ssize_t len = readlink("/proc/self/exe", appDir, size);
@ -2714,9 +2713,7 @@ const char *GetApplicationDirectory(void)
appDir[0] = '.';
appDir[1] = '/';
}
#elif defined(__APPLE__)
uint32_t size = sizeof(appDir);
if (_NSGetExecutablePath(appDir, &size) == 0)
@ -2736,9 +2733,7 @@ const char *GetApplicationDirectory(void)
appDir[0] = '.';
appDir[1] = '/';
}
#elif defined(__FreeBSD__)
size_t size = sizeof(appDir);
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
@ -2759,9 +2754,7 @@ const char *GetApplicationDirectory(void)
appDir[0] = '.';
appDir[1] = '/';
}
#elif defined(__wasm__)
appDir[0] = '/';
#endif

View File

@ -1079,7 +1079,6 @@ typedef struct rlglData {
int framebufferWidth; // Current framebuffer width
int framebufferHeight; // Current framebuffer height
} State; // Renderer state
struct {
bool vao; // VAO support (OpenGL ES2 could not support VAO extension) (GL_ARB_vertex_array_object)
@ -1101,7 +1100,6 @@ typedef struct rlglData {
float maxAnisotropyLevel; // Maximum anisotropy level supported (minimum is 2.0f)
int maxDepthBits; // Maximum bits for depth component
} ExtSupported; // Extensions supported flags
} rlglData;

View File

@ -6808,10 +6808,9 @@ static ModelAnimation *LoadModelAnimationsGLTF(const char *fileName, int *animCo
{
TRACELOG(LOG_WARNING, "MODEL: [%s] Expected one unique skin to load animation data from, but found %i", fileName, data->skins_count);
}
cgltf_free(data);
}
cgltf_free(data);
UnloadFileData(fileData);
return animations;

View File

@ -745,9 +745,20 @@ void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3,
// but it solves another issue: https://github.com/raysan5/raylib/issues/3884
void DrawRectangleLines(int posX, int posY, int width, int height, Color color)
{
Matrix mat = rlGetMatrixTransform();
float xOffset = 0.5f/mat.m0;
float yOffset = 0.5f/mat.m5;
Matrix t = rlGetMatrixTransform();
Matrix m = rlGetMatrixModelview();
// Compute upper-left 2x2 of M*T
float ax = m.m0*t.m0 + m.m4*t.m1;
float ay = m.m1*t.m0 + m.m5*t.m1;
float bx = m.m0*t.m4 + m.m4*t.m5;
float by = m.m1*t.m4 + m.m5*t.m5;
// Use the 2x2 inverse of M*T to convert 0.5 px screen-space to world units
// Using max(|bx|, |by|) and max(|ax|, |ay|) matches OpenGL's diamond-exit rule
float invDet = 0.5f/fabsf(ax*by - ay*bx);
float xOffset = ((fabsf(bx) > fabsf(by))? fabsf(bx) : fabsf(by))*invDet;
float yOffset = ((fabsf(ax) > fabsf(ay))? fabsf(ax) : fabsf(ay))*invDet;
rlBegin(RL_LINES);
rlColor4ub(color.r, color.g, color.b, color.a);
@ -1142,17 +1153,32 @@ void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, Col
P5 ------------------ P4
*/
Matrix t = rlGetMatrixTransform();
Matrix m = rlGetMatrixModelview();
// Compute upper-left 2x2 of M*T
float ax = m.m0*t.m0 + m.m4*t.m1;
float ay = m.m1*t.m0 + m.m5*t.m1;
float bx = m.m0*t.m4 + m.m4*t.m5;
float by = m.m1*t.m4 + m.m5*t.m5;
// Use the 2x2 inverse of M*T to convert 0.5 px screen-space to world units
// Using max(|bx|, |by|) and max(|ax|, |ay|) matches OpenGL's diamond-exit rule
float invDet = 0.5f/fabsf(ax*by - ay*bx);
float xOffset = ((fabsf(bx) > fabsf(by))? fabsf(bx) : fabsf(by))*invDet;
float yOffset = ((fabsf(ax) > fabsf(ay))? fabsf(ax) : fabsf(ay))*invDet;
// The x-coordinates used for the outline
float x0 = rec.x + radius + 0.5f;
float x1 = (rec.x + rec.width) - radius - 0.5f;
float x2 = (rec.x + rec.width) - 0.5f;
float x3 = rec.x + 0.5f;
float x0 = rec.x + radius + xOffset;
float x1 = (rec.x + rec.width) - radius - xOffset;
float x2 = (rec.x + rec.width) - xOffset;
float x3 = rec.x + xOffset;
// The y-coordinates used for the outline
float y0 = rec.y + 0.5f;
float y1 = rec.y + radius + 0.5f;
float y2 = (rec.y + rec.height) - radius - 0.5f;
float y3 = (rec.y + rec.height) - 0.5f;
float y0 = rec.y + yOffset;
float y1 = rec.y + radius + yOffset;
float y2 = (rec.y + rec.height) - radius - yOffset;
float y3 = (rec.y + rec.height) - yOffset;
Vector2 points[8] = {
{ x0, y0 }, // P0

View File

@ -5331,7 +5331,7 @@ Color ColorFromHSV(float hue, float saturation, float value)
k = (t < k)? t : k;
k = (k < 1)? k : 1;
k = (k > 0)? k : 0;
color.r = (unsigned char)((value - value*saturation*k)*255.0f);
color.r = (unsigned char)((value - value*saturation*k)*255.0f + 0.5f);
// Green channel
k = fmodf((3.0f + hue/60.0f), 6);
@ -5339,7 +5339,7 @@ Color ColorFromHSV(float hue, float saturation, float value)
k = (t < k)? t : k;
k = (k < 1)? k : 1;
k = (k > 0)? k : 0;
color.g = (unsigned char)((value - value*saturation*k)*255.0f);
color.g = (unsigned char)((value - value*saturation*k)*255.0f + 0.5f);
// Blue channel
k = fmodf((1.0f + hue/60.0f), 6);
@ -5347,7 +5347,7 @@ Color ColorFromHSV(float hue, float saturation, float value)
k = (t < k)? t : k;
k = (k < 1)? k : 1;
k = (k > 0)? k : 0;
color.b = (unsigned char)((value - value*saturation*k)*255.0f);
color.b = (unsigned char)((value - value*saturation*k)*255.0f + 0.5f);
return color;
}

View File

@ -3550,6 +3550,17 @@
"description": "Get clipboard text content",
"returnType": "const char *"
},
{
"name": "SetClipboardImage",
"description": "Set clipboard image content",
"returnType": "bool",
"params": [
{
"type": "Image",
"name": "image"
}
]
},
{
"name": "GetClipboardImage",
"description": "Get clipboard image content",

View File

@ -3427,6 +3427,14 @@ return {
description = "Get clipboard text content",
returnType = "const char *"
},
{
name = "SetClipboardImage",
description = "Set clipboard image content",
returnType = "bool",
params = {
{type = "Image", name = "image"}
}
},
{
name = "GetClipboardImage",
description = "Get clipboard image content",

View File

@ -2453,6 +2453,12 @@
(description "Get clipboard text content")
(return-type "const char *"))
((name "SetClipboardImage")
(description "Set clipboard image content")
(return-type "bool")
(params
((type "Image") (name "image"))))
((name "GetClipboardImage")
(description "Get clipboard image content")
(return-type "Image"))

File diff suppressed because it is too large Load Diff

View File

@ -681,7 +681,7 @@
<Param type="unsigned int" name="frames" desc="" />
</Callback>
</Callbacks>
<Functions count="619">
<Functions count="620">
<Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">
<Param type="int" name="width" desc="" />
<Param type="int" name="height" desc="" />
@ -802,6 +802,9 @@
</Function>
<Function name="GetClipboardText" retType="const char *" paramCount="0" desc="Get clipboard text content">
</Function>
<Function name="SetClipboardImage" retType="bool" paramCount="1" desc="Set clipboard image content">
<Param type="Image" name="image" desc="" />
</Function>
<Function name="GetClipboardImage" retType="Image" paramCount="0" desc="Get clipboard image content">
</Function>
<Function name="EnableEventWaiting" retType="void" paramCount="0" desc="Enable waiting for events on EndDrawing(), no automatic event polling">