mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-25 10:22:33 -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_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
|
||||
// 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);
|
||||
glfwSetWindowSize(CORE.Window.handle, width, height);
|
||||
glfwGetVideoMode(monitor);
|
||||
glfwGetVideoModes(monitors[monitor], &count);
|
||||
glfwShowWindow(CORE.Window.handle);
|
||||
glfwHideWindow(CORE.Window.handle);
|
||||
glfwGetWin32Window(CORE.Window.handle);
|
||||
glfwGetX11Window(window);
|
||||
glfwGetCocoaWindow(window);
|
||||
glfwMaximizeWindow(CORE.Window.handle);
|
||||
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
|
||||
glfwGetProcAddress();
|
||||
glfwGetClipboardString(CORE.Window.handle);
|
||||
glfwSetClipboardString(CORE.Window.handle, text);
|
||||
glfwGetTime();
|
||||
glfwSetCursor(CORE.Window.handle, NULL);
|
||||
glfwCreateStandardCursor(0x00036000 + cursor);
|
||||
|
||||
// GLFW: Callbacks (Window/Input events)
|
||||
glfwSetErrorCallback(ErrorCallback);
|
||||
@ -67,6 +77,7 @@ glfwSetScrollCallback(CORE.Window.handle, ScrollCallback);
|
||||
glfwSetKeyCallback(CORE.Window.handle, KeyCallback);
|
||||
glfwSetCharCallback(CORE.Window.handle, CharCallback);
|
||||
glfwSetDropCallback(CORE.Window.handle, WindowDropCallback);
|
||||
glfwSetJoystickCallback(NULL);
|
||||
|
||||
// GLFW: Input management
|
||||
// NOTE: Most inputs (keyboard/mouse) are managed through callbacks
|
||||
@ -75,4 +86,5 @@ glfwGetJoystickName(gamepad);
|
||||
glfwGetGamepadState(i, &state);
|
||||
glfwSetInputMode(CORE.Window.handle, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||
glfwSetCursorPos(CORE.Window.handle, CORE.Input.Mouse.position.x, CORE.Input.Mouse.position.y);
|
||||
glfwUpdateGamepadMappings(mappings);
|
||||
```
|
||||
Reference in New Issue
Block a user