SetWindowSizeCallback: user configurable callback
This commit is contained in:
parent
c078640fa5
commit
fc587f755e
11
src/core.c
11
src/core.c
|
|
@ -373,6 +373,7 @@ typedef struct CoreData {
|
|||
|
||||
char **dropFilesPath; // Store dropped files paths as strings
|
||||
int dropFilesCount; // Count dropped files strings
|
||||
void (*sizeCallback)(int, int); // Additional user configurable window size callback
|
||||
|
||||
} Window;
|
||||
#if defined(PLATFORM_ANDROID)
|
||||
|
|
@ -1050,6 +1051,11 @@ void SetWindowMinSize(int width, int height)
|
|||
#endif
|
||||
}
|
||||
|
||||
// Set window size callback
|
||||
void SetWindowSizeCallback(void (*callback)(int, int)) {
|
||||
CORE.Window.sizeCallback = callback;
|
||||
}
|
||||
|
||||
// Set window dimensions
|
||||
// TODO: Issues on HighDPI scaling
|
||||
void SetWindowSize(int width, int height)
|
||||
|
|
@ -3901,6 +3907,8 @@ static void WindowSizeCallback(GLFWwindow *window, int width, int height)
|
|||
// NOTE: Postprocessing texture is not scaled to new size
|
||||
|
||||
CORE.Window.resized = true;
|
||||
if (CORE.Window.sizeCallback)
|
||||
CORE.Window.sizeCallback(width, height);
|
||||
}
|
||||
|
||||
// GLFW3 WindowIconify Callback, runs when window is minimized/restored
|
||||
|
|
@ -5234,6 +5242,9 @@ void UWPResizeEvent(int width, int height)
|
|||
// NOTE: Postprocessing texture is not scaled to new size
|
||||
|
||||
CORE.Window.resized = true;
|
||||
|
||||
if (CORE.Window.sizeCallback)
|
||||
CORE.Window.sizeCallback(width, height);
|
||||
}
|
||||
|
||||
void UWPActivateGamepadEvent(int gamepad, bool active)
|
||||
|
|
|
|||
|
|
@ -884,6 +884,7 @@ RLAPI void SetWindowPosition(int x, int y); // Set window
|
|||
RLAPI void SetWindowMonitor(int monitor); // Set monitor for the current window (fullscreen mode)
|
||||
RLAPI void SetWindowMinSize(int width, int height); // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
|
||||
RLAPI void SetWindowSize(int width, int height); // Set window dimensions
|
||||
RLAPI void SetWindowSizeCallback(void (*callback)(int, int)); // Set window size callback
|
||||
RLAPI void *GetWindowHandle(void); // Get native window handle
|
||||
RLAPI int GetScreenWidth(void); // Get current screen width
|
||||
RLAPI int GetScreenHeight(void); // Get current screen height
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user