mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-02 04:09:18 -05:00
Updated functions to match what's used in Raylib 4.0.
@ -10,7 +10,7 @@ GLFW is *not* used on the following platforms, where custom implementations are
|
|||||||
- `PLATFORM_ANDROID`: Uses the `native_app_glue` Android NDK module.
|
- `PLATFORM_ANDROID`: Uses the `native_app_glue` Android NDK module.
|
||||||
- `PLATFORM_RPI`: (native, no desktop) Uses `EGL`, `evdev` and standard system libraries directly.
|
- `PLATFORM_RPI`: (native, no desktop) Uses `EGL`, `evdev` and standard system libraries directly.
|
||||||
|
|
||||||
If you are interested in replacing GLFW with a custom, platform-specific implementation, the functions currently used by raylib (as of raylib 3.7) are detailed below:
|
If you are interested in replacing GLFW with a custom, platform-specific implementation, the functions currently used by raylib (as of raylib 4.0) are detailed below:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
// GLFW: Device init/close
|
// GLFW: Device init/close
|
||||||
@ -43,17 +43,27 @@ glfwSetWindowMonitor(CORE.Window.handle, monitors[monitor], 0, 0, mode->width, m
|
|||||||
glfwSetWindowSizeLimits(CORE.Window.handle, width, height, mode->width, mode->height);
|
glfwSetWindowSizeLimits(CORE.Window.handle, width, height, mode->width, mode->height);
|
||||||
glfwSetWindowSize(CORE.Window.handle, width, height);
|
glfwSetWindowSize(CORE.Window.handle, width, height);
|
||||||
glfwGetVideoMode(monitor);
|
glfwGetVideoMode(monitor);
|
||||||
|
glfwGetVideoModes(monitors[monitor], &count);
|
||||||
glfwShowWindow(CORE.Window.handle);
|
glfwShowWindow(CORE.Window.handle);
|
||||||
glfwHideWindow(CORE.Window.handle);
|
glfwHideWindow(CORE.Window.handle);
|
||||||
glfwGetWin32Window(CORE.Window.handle);
|
glfwGetWin32Window(CORE.Window.handle);
|
||||||
glfwGetX11Window(window);
|
glfwMaximizeWindow(CORE.Window.handle);
|
||||||
glfwGetCocoaWindow(window);
|
glfwIconifyWindow(CORE.Window.handle);
|
||||||
|
glfwRestoreWindow(CORE.Window.handle);
|
||||||
|
glfwSetWindowIcon(CORE.Window.handle, 1, icon);
|
||||||
|
glfwGetWindowMonitor(CORE.Window.handle);
|
||||||
|
glfwGetMonitorWorkarea(monitor, &mx, &my, &width, &height);
|
||||||
|
glfwGetMonitorPos(monitors[monitor], &x, &y);
|
||||||
|
glfwGetMonitorContentScale(monitors[i], &xdpi, &ydpi);
|
||||||
|
glfwGetWindowContentScale(CORE.Window.handle, &xScale, &yScale);
|
||||||
|
|
||||||
// GLFW: Misc functionality
|
// GLFW: Misc functionality
|
||||||
glfwGetProcAddress();
|
glfwGetProcAddress();
|
||||||
glfwGetClipboardString(CORE.Window.handle);
|
glfwGetClipboardString(CORE.Window.handle);
|
||||||
glfwSetClipboardString(CORE.Window.handle, text);
|
glfwSetClipboardString(CORE.Window.handle, text);
|
||||||
glfwGetTime();
|
glfwGetTime();
|
||||||
|
glfwSetCursor(CORE.Window.handle, NULL);
|
||||||
|
glfwCreateStandardCursor(0x00036000 + cursor);
|
||||||
|
|
||||||
// GLFW: Callbacks (Window/Input events)
|
// GLFW: Callbacks (Window/Input events)
|
||||||
glfwSetErrorCallback(ErrorCallback);
|
glfwSetErrorCallback(ErrorCallback);
|
||||||
@ -67,6 +77,7 @@ glfwSetScrollCallback(CORE.Window.handle, ScrollCallback);
|
|||||||
glfwSetKeyCallback(CORE.Window.handle, KeyCallback);
|
glfwSetKeyCallback(CORE.Window.handle, KeyCallback);
|
||||||
glfwSetCharCallback(CORE.Window.handle, CharCallback);
|
glfwSetCharCallback(CORE.Window.handle, CharCallback);
|
||||||
glfwSetDropCallback(CORE.Window.handle, WindowDropCallback);
|
glfwSetDropCallback(CORE.Window.handle, WindowDropCallback);
|
||||||
|
glfwSetJoystickCallback(NULL);
|
||||||
|
|
||||||
// GLFW: Input management
|
// GLFW: Input management
|
||||||
// NOTE: Most inputs (keyboard/mouse) are managed through callbacks
|
// NOTE: Most inputs (keyboard/mouse) are managed through callbacks
|
||||||
@ -75,4 +86,5 @@ glfwGetJoystickName(gamepad);
|
|||||||
glfwGetGamepadState(i, &state);
|
glfwGetGamepadState(i, &state);
|
||||||
glfwSetInputMode(CORE.Window.handle, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
glfwSetInputMode(CORE.Window.handle, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||||
glfwSetCursorPos(CORE.Window.handle, CORE.Input.Mouse.position.x, CORE.Input.Mouse.position.y);
|
glfwSetCursorPos(CORE.Window.handle, CORE.Input.Mouse.position.x, CORE.Input.Mouse.position.y);
|
||||||
|
glfwUpdateGamepadMappings(mappings);
|
||||||
```
|
```
|
||||||
Reference in New Issue
Block a user