added DrawCallback

This commit is contained in:
Julianiolo 2021-07-11 22:12:27 +02:00
parent ae230dae46
commit 274228f1e6
2 changed files with 15 additions and 1 deletions

View File

@ -387,6 +387,7 @@ typedef struct CoreData {
char **dropFilesPath; // Store dropped files paths as strings
int dropFilesCount; // Count dropped files strings
windowReSizeDrawCallB resizeDrawCallB;
} Window;
#if defined(PLATFORM_ANDROID)
struct {
@ -591,7 +592,7 @@ extern void UnloadFontDefault(void); // [Module: text] Unloads default fo
static void InitTimer(void); // Initialize timer (hi-resolution if available)
static bool InitGraphicsDevice(int width, int height); // Initialize graphics device
static void SetupFramebuffer(int width, int height); // Setup main framebuffer
static void SetupViewport(int width, int height); // Set viewport for a provided width and height
void SetupViewport(int width, int height); // Set viewport for a provided width and height
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
static void ErrorCallback(int error, const char *description); // GLFW3 Error Callback, runs on GLFW3 error
@ -697,6 +698,8 @@ void InitWindow(int width, int height, const char *title)
CORE.Input.Mouse.cursor = MOUSE_CURSOR_ARROW;
CORE.Input.Gamepad.lastButtonPressed = -1;
CORE.Window.resizeDrawCallB = NULL;
#if defined(PLATFORM_ANDROID)
CORE.Window.screen.width = width;
CORE.Window.screen.height = height;
@ -4835,6 +4838,13 @@ static void WindowSizeCallback(GLFWwindow *window, int width, int height)
CORE.Window.screen.height = height;
// NOTE: Postprocessing texture is not scaled to new size
if (CORE.Window.resizeDrawCallB != NULL) {
CORE.Window.resizeDrawCallB();
}
}
void SetWindowResizeDrawCallback(windowReSizeDrawCallB func) {
CORE.Window.resizeDrawCallB = func;
}
// GLFW3 WindowIconify Callback, runs when window is minimized/restored

View File

@ -493,6 +493,8 @@ typedef enum {
FLAG_INTERLACED_HINT = 0x00010000 // Set to try enabling interlaced video format (for V3D)
} ConfigFlags;
typedef void(*windowReSizeDrawCallB)(void);
// Trace log level
// NOTE: Organized by priority level
typedef enum {
@ -934,6 +936,8 @@ RLAPI Vector2 GetWindowScaleDPI(void); // Get window
RLAPI const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the primary monitor
RLAPI void SetClipboardText(const char *text); // Set clipboard text content
RLAPI const char *GetClipboardText(void); // Get clipboard text content
RLAPI void SetupViewport(int width, int height);
RLAPI void SetWindowResizeDrawCallback(windowReSizeDrawCallB func)
// Custom frame control functions
// NOTE: Those functions are intended for advance users that want full control over the frame processing