glfw: only scale screen positions on macOS #29

This commit is contained in:
Bixilon 2023-01-26 21:19:59 +01:00
parent 217e78dd9a
commit f3b11e8ef1
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 169 additions and 152 deletions

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
@ -25,6 +25,8 @@ import org.lwjgl.BufferUtils
import java.nio.ByteBuffer
interface BaseWindow {
val systemScale: Vec2
var size: Vec2i
val sizef: Vec2
get() = Vec2(size)

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
@ -55,8 +55,8 @@ import java.nio.ByteBuffer
class GLFWWindow(
private val context: RenderContext,
private val eventMaster: AbstractEventMaster = context.connection,
private val context: RenderContext,
private val eventMaster: AbstractEventMaster = context.connection,
) : BaseWindow {
private var mousePosition = Vec2d.EMPTY
private var skipNextMouseEvent = true
@ -80,6 +80,29 @@ class GLFWWindow(
field = value
}
override val systemScale: Vec2
get() {
val x = FloatArray(1)
val y = FloatArray(1)
glfwGetWindowContentScale(window, x, y)
return Vec2(x[0], y[0])
}
private fun scalePosition(position: Vec2i): Vec2i {
if (!PlatformInfo.OS.needsWindowScaling) return position
return position / systemScale
}
private fun unscalePosition(position: Vec2i): Vec2i {
if (!PlatformInfo.OS.needsWindowScaling) return position
return position * systemScale
}
private fun unscalePosition(position: Vec2d): Vec2d {
if (!PlatformInfo.OS.needsWindowScaling) return position
return position * systemScale
}
private var _size = Vec2i(DEFAULT_WINDOW_SIZE)
override var size: Vec2i
@ -132,8 +155,7 @@ class GLFWWindow(
if (value) {
glfwSetWindowMonitor(window, monitor, 15, 15, mode.width(), mode.height(), mode.refreshRate())
} else {
val scale = getWindowScale()
val size = Vec2i(DEFAULT_WINDOW_SIZE.x / scale.x, DEFAULT_WINDOW_SIZE.y / scale.y)
val size = scalePosition(Vec2i(DEFAULT_WINDOW_SIZE.x, DEFAULT_WINDOW_SIZE.y))
glfwSetWindowMonitor(window, 0, (mode.width() - size.x) / 2, (mode.height() - size.y) / 2, size.x, size.y, GLFW_DONT_CARE)
}
@ -205,8 +227,7 @@ class GLFWWindow(
glfwMakeContextCurrent(window)
super.init(profile)
val scale = getWindowScale()
val size = Vec2i(DEFAULT_WINDOW_SIZE.x / scale.x, DEFAULT_WINDOW_SIZE.y / scale.y)
val size = scalePosition(Vec2i(DEFAULT_WINDOW_SIZE.x, DEFAULT_WINDOW_SIZE.y))
glfwSetWindowSize(window, size.x, size.y)
val primaryMonitor = glfwGetPrimaryMonitor()
@ -313,8 +334,7 @@ class GLFWWindow(
return
}
val previousSize = Vec2i(_size)
val scale = getWindowScale()
val nextSize = Vec2i(width * scale.x, height * scale.y)
val nextSize = unscalePosition(Vec2i(width, height))
_size = nextSize
fireGLFWEvent(ResizeWindowEvent(context, previousSize = previousSize, size = _size))
this.skipNextMouseEvent = true
@ -356,7 +376,7 @@ class GLFWWindow(
}
val position = Vec2d(x, y) * getWindowScale()
val position = unscalePosition(Vec2d(x, y))
val previous = this.mousePosition
val delta = position - previous
this.mousePosition = position
@ -387,13 +407,6 @@ class GLFWWindow(
glfwSetWindowIcon(window, images)
}
private fun getWindowScale(): Vec2 {
val x = FloatArray(1)
val y = FloatArray(1)
glfwGetWindowContentScale(window, x, y)
return Vec2(x[0], y[0])
}
private fun fireGLFWEvent(event: RenderEvent): Boolean {
// ToDo: It looks like glfwPollEvents is mixing threads. This should not happen.
if (Rendering.currentContext != event.context) {
@ -418,143 +431,143 @@ class GLFWWindow(
}
val KEY_CODE_MAPPING = mapOf(
GLFW_KEY_UNKNOWN to KeyCodes.KEY_UNKNOWN,
GLFW_KEY_SPACE to KeyCodes.KEY_SPACE,
GLFW_KEY_APOSTROPHE to KeyCodes.KEY_APOSTROPHE,
GLFW_KEY_COMMA to KeyCodes.KEY_COMMA,
GLFW_KEY_MINUS to KeyCodes.KEY_MINUS,
GLFW_KEY_PERIOD to KeyCodes.KEY_PERIOD,
GLFW_KEY_SLASH to KeyCodes.KEY_SLASH,
GLFW_KEY_0 to KeyCodes.KEY_0,
GLFW_KEY_1 to KeyCodes.KEY_1,
GLFW_KEY_2 to KeyCodes.KEY_2,
GLFW_KEY_3 to KeyCodes.KEY_3,
GLFW_KEY_4 to KeyCodes.KEY_4,
GLFW_KEY_5 to KeyCodes.KEY_5,
GLFW_KEY_6 to KeyCodes.KEY_6,
GLFW_KEY_7 to KeyCodes.KEY_7,
GLFW_KEY_8 to KeyCodes.KEY_8,
GLFW_KEY_9 to KeyCodes.KEY_9,
GLFW_KEY_SEMICOLON to KeyCodes.KEY_SEMICOLON,
GLFW_KEY_EQUAL to KeyCodes.KEY_EQUAL,
GLFW_KEY_A to KeyCodes.KEY_A,
GLFW_KEY_B to KeyCodes.KEY_B,
GLFW_KEY_C to KeyCodes.KEY_C,
GLFW_KEY_D to KeyCodes.KEY_D,
GLFW_KEY_E to KeyCodes.KEY_E,
GLFW_KEY_F to KeyCodes.KEY_F,
GLFW_KEY_G to KeyCodes.KEY_G,
GLFW_KEY_H to KeyCodes.KEY_H,
GLFW_KEY_I to KeyCodes.KEY_I,
GLFW_KEY_J to KeyCodes.KEY_J,
GLFW_KEY_K to KeyCodes.KEY_K,
GLFW_KEY_L to KeyCodes.KEY_L,
GLFW_KEY_M to KeyCodes.KEY_M,
GLFW_KEY_N to KeyCodes.KEY_N,
GLFW_KEY_O to KeyCodes.KEY_O,
GLFW_KEY_P to KeyCodes.KEY_P,
GLFW_KEY_Q to KeyCodes.KEY_Q,
GLFW_KEY_R to KeyCodes.KEY_R,
GLFW_KEY_S to KeyCodes.KEY_S,
GLFW_KEY_T to KeyCodes.KEY_T,
GLFW_KEY_U to KeyCodes.KEY_U,
GLFW_KEY_V to KeyCodes.KEY_V,
GLFW_KEY_W to KeyCodes.KEY_W,
GLFW_KEY_X to KeyCodes.KEY_X,
GLFW_KEY_Y to KeyCodes.KEY_Y,
GLFW_KEY_Z to KeyCodes.KEY_Z,
GLFW_KEY_LEFT_BRACKET to KeyCodes.KEY_LEFT_BRACKET,
GLFW_KEY_BACKSLASH to KeyCodes.KEY_BACKSLASH,
GLFW_KEY_RIGHT_BRACKET to KeyCodes.KEY_RIGHT_BRACKET,
GLFW_KEY_GRAVE_ACCENT to KeyCodes.KEY_GRAVE_ACCENT,
GLFW_KEY_WORLD_1 to KeyCodes.KEY_WORLD_1,
GLFW_KEY_WORLD_2 to KeyCodes.KEY_WORLD_2,
GLFW_KEY_UNKNOWN to KeyCodes.KEY_UNKNOWN,
GLFW_KEY_SPACE to KeyCodes.KEY_SPACE,
GLFW_KEY_APOSTROPHE to KeyCodes.KEY_APOSTROPHE,
GLFW_KEY_COMMA to KeyCodes.KEY_COMMA,
GLFW_KEY_MINUS to KeyCodes.KEY_MINUS,
GLFW_KEY_PERIOD to KeyCodes.KEY_PERIOD,
GLFW_KEY_SLASH to KeyCodes.KEY_SLASH,
GLFW_KEY_0 to KeyCodes.KEY_0,
GLFW_KEY_1 to KeyCodes.KEY_1,
GLFW_KEY_2 to KeyCodes.KEY_2,
GLFW_KEY_3 to KeyCodes.KEY_3,
GLFW_KEY_4 to KeyCodes.KEY_4,
GLFW_KEY_5 to KeyCodes.KEY_5,
GLFW_KEY_6 to KeyCodes.KEY_6,
GLFW_KEY_7 to KeyCodes.KEY_7,
GLFW_KEY_8 to KeyCodes.KEY_8,
GLFW_KEY_9 to KeyCodes.KEY_9,
GLFW_KEY_SEMICOLON to KeyCodes.KEY_SEMICOLON,
GLFW_KEY_EQUAL to KeyCodes.KEY_EQUAL,
GLFW_KEY_A to KeyCodes.KEY_A,
GLFW_KEY_B to KeyCodes.KEY_B,
GLFW_KEY_C to KeyCodes.KEY_C,
GLFW_KEY_D to KeyCodes.KEY_D,
GLFW_KEY_E to KeyCodes.KEY_E,
GLFW_KEY_F to KeyCodes.KEY_F,
GLFW_KEY_G to KeyCodes.KEY_G,
GLFW_KEY_H to KeyCodes.KEY_H,
GLFW_KEY_I to KeyCodes.KEY_I,
GLFW_KEY_J to KeyCodes.KEY_J,
GLFW_KEY_K to KeyCodes.KEY_K,
GLFW_KEY_L to KeyCodes.KEY_L,
GLFW_KEY_M to KeyCodes.KEY_M,
GLFW_KEY_N to KeyCodes.KEY_N,
GLFW_KEY_O to KeyCodes.KEY_O,
GLFW_KEY_P to KeyCodes.KEY_P,
GLFW_KEY_Q to KeyCodes.KEY_Q,
GLFW_KEY_R to KeyCodes.KEY_R,
GLFW_KEY_S to KeyCodes.KEY_S,
GLFW_KEY_T to KeyCodes.KEY_T,
GLFW_KEY_U to KeyCodes.KEY_U,
GLFW_KEY_V to KeyCodes.KEY_V,
GLFW_KEY_W to KeyCodes.KEY_W,
GLFW_KEY_X to KeyCodes.KEY_X,
GLFW_KEY_Y to KeyCodes.KEY_Y,
GLFW_KEY_Z to KeyCodes.KEY_Z,
GLFW_KEY_LEFT_BRACKET to KeyCodes.KEY_LEFT_BRACKET,
GLFW_KEY_BACKSLASH to KeyCodes.KEY_BACKSLASH,
GLFW_KEY_RIGHT_BRACKET to KeyCodes.KEY_RIGHT_BRACKET,
GLFW_KEY_GRAVE_ACCENT to KeyCodes.KEY_GRAVE_ACCENT,
GLFW_KEY_WORLD_1 to KeyCodes.KEY_WORLD_1,
GLFW_KEY_WORLD_2 to KeyCodes.KEY_WORLD_2,
GLFW_KEY_ESCAPE to KeyCodes.KEY_ESCAPE,
GLFW_KEY_ENTER to KeyCodes.KEY_ENTER,
GLFW_KEY_TAB to KeyCodes.KEY_TAB,
GLFW_KEY_BACKSPACE to KeyCodes.KEY_BACKSPACE,
GLFW_KEY_INSERT to KeyCodes.KEY_INSERT,
GLFW_KEY_DELETE to KeyCodes.KEY_DELETE,
GLFW_KEY_RIGHT to KeyCodes.KEY_RIGHT,
GLFW_KEY_LEFT to KeyCodes.KEY_LEFT,
GLFW_KEY_DOWN to KeyCodes.KEY_DOWN,
GLFW_KEY_UP to KeyCodes.KEY_UP,
GLFW_KEY_PAGE_UP to KeyCodes.KEY_PAGE_UP,
GLFW_KEY_PAGE_DOWN to KeyCodes.KEY_PAGE_DOWN,
GLFW_KEY_HOME to KeyCodes.KEY_HOME,
GLFW_KEY_END to KeyCodes.KEY_END,
GLFW_KEY_CAPS_LOCK to KeyCodes.KEY_CAPS_LOCK,
GLFW_KEY_SCROLL_LOCK to KeyCodes.KEY_SCROLL_LOCK,
GLFW_KEY_NUM_LOCK to KeyCodes.KEY_NUM_LOCK,
GLFW_KEY_PRINT_SCREEN to KeyCodes.KEY_PRINT_SCREEN,
GLFW_KEY_PAUSE to KeyCodes.KEY_PAUSE,
GLFW_KEY_F1 to KeyCodes.KEY_F1,
GLFW_KEY_F2 to KeyCodes.KEY_F2,
GLFW_KEY_F3 to KeyCodes.KEY_F3,
GLFW_KEY_F4 to KeyCodes.KEY_F4,
GLFW_KEY_F5 to KeyCodes.KEY_F5,
GLFW_KEY_F6 to KeyCodes.KEY_F6,
GLFW_KEY_F7 to KeyCodes.KEY_F7,
GLFW_KEY_F8 to KeyCodes.KEY_F8,
GLFW_KEY_F9 to KeyCodes.KEY_F9,
GLFW_KEY_F10 to KeyCodes.KEY_F10,
GLFW_KEY_F11 to KeyCodes.KEY_F11,
GLFW_KEY_F12 to KeyCodes.KEY_F12,
GLFW_KEY_F13 to KeyCodes.KEY_F13,
GLFW_KEY_F14 to KeyCodes.KEY_F14,
GLFW_KEY_F15 to KeyCodes.KEY_F15,
GLFW_KEY_F16 to KeyCodes.KEY_F16,
GLFW_KEY_F17 to KeyCodes.KEY_F17,
GLFW_KEY_F18 to KeyCodes.KEY_F18,
GLFW_KEY_F19 to KeyCodes.KEY_F19,
GLFW_KEY_F20 to KeyCodes.KEY_F20,
GLFW_KEY_F21 to KeyCodes.KEY_F21,
GLFW_KEY_F22 to KeyCodes.KEY_F22,
GLFW_KEY_F23 to KeyCodes.KEY_F23,
GLFW_KEY_F24 to KeyCodes.KEY_F24,
GLFW_KEY_F25 to KeyCodes.KEY_F25,
GLFW_KEY_KP_0 to KeyCodes.KEY_KP_0,
GLFW_KEY_KP_1 to KeyCodes.KEY_KP_1,
GLFW_KEY_KP_2 to KeyCodes.KEY_KP_2,
GLFW_KEY_KP_3 to KeyCodes.KEY_KP_3,
GLFW_KEY_KP_4 to KeyCodes.KEY_KP_4,
GLFW_KEY_KP_5 to KeyCodes.KEY_KP_5,
GLFW_KEY_KP_6 to KeyCodes.KEY_KP_6,
GLFW_KEY_KP_7 to KeyCodes.KEY_KP_7,
GLFW_KEY_KP_8 to KeyCodes.KEY_KP_8,
GLFW_KEY_KP_9 to KeyCodes.KEY_KP_9,
GLFW_KEY_KP_DECIMAL to KeyCodes.KEY_KP_DECIMAL,
GLFW_KEY_KP_DIVIDE to KeyCodes.KEY_KP_DIVIDE,
GLFW_KEY_KP_MULTIPLY to KeyCodes.KEY_KP_MULTIPLY,
GLFW_KEY_KP_SUBTRACT to KeyCodes.KEY_KP_SUBTRACT,
GLFW_KEY_KP_ADD to KeyCodes.KEY_KP_ADD,
GLFW_KEY_KP_ENTER to KeyCodes.KEY_KP_ENTER,
GLFW_KEY_KP_EQUAL to KeyCodes.KEY_KP_EQUAL,
GLFW_KEY_LEFT_SHIFT to KeyCodes.KEY_LEFT_SHIFT,
GLFW_KEY_LEFT_CONTROL to KeyCodes.KEY_LEFT_CONTROL,
GLFW_KEY_LEFT_ALT to KeyCodes.KEY_LEFT_ALT,
GLFW_KEY_LEFT_SUPER to KeyCodes.KEY_LEFT_SUPER,
GLFW_KEY_RIGHT_SHIFT to KeyCodes.KEY_RIGHT_SHIFT,
GLFW_KEY_RIGHT_CONTROL to KeyCodes.KEY_RIGHT_CONTROL,
GLFW_KEY_RIGHT_ALT to KeyCodes.KEY_RIGHT_ALT,
GLFW_KEY_RIGHT_SUPER to KeyCodes.KEY_RIGHT_SUPER,
GLFW_KEY_MENU to KeyCodes.KEY_MENU,
GLFW_KEY_LAST to KeyCodes.KEY_LAST,
GLFW_KEY_ESCAPE to KeyCodes.KEY_ESCAPE,
GLFW_KEY_ENTER to KeyCodes.KEY_ENTER,
GLFW_KEY_TAB to KeyCodes.KEY_TAB,
GLFW_KEY_BACKSPACE to KeyCodes.KEY_BACKSPACE,
GLFW_KEY_INSERT to KeyCodes.KEY_INSERT,
GLFW_KEY_DELETE to KeyCodes.KEY_DELETE,
GLFW_KEY_RIGHT to KeyCodes.KEY_RIGHT,
GLFW_KEY_LEFT to KeyCodes.KEY_LEFT,
GLFW_KEY_DOWN to KeyCodes.KEY_DOWN,
GLFW_KEY_UP to KeyCodes.KEY_UP,
GLFW_KEY_PAGE_UP to KeyCodes.KEY_PAGE_UP,
GLFW_KEY_PAGE_DOWN to KeyCodes.KEY_PAGE_DOWN,
GLFW_KEY_HOME to KeyCodes.KEY_HOME,
GLFW_KEY_END to KeyCodes.KEY_END,
GLFW_KEY_CAPS_LOCK to KeyCodes.KEY_CAPS_LOCK,
GLFW_KEY_SCROLL_LOCK to KeyCodes.KEY_SCROLL_LOCK,
GLFW_KEY_NUM_LOCK to KeyCodes.KEY_NUM_LOCK,
GLFW_KEY_PRINT_SCREEN to KeyCodes.KEY_PRINT_SCREEN,
GLFW_KEY_PAUSE to KeyCodes.KEY_PAUSE,
GLFW_KEY_F1 to KeyCodes.KEY_F1,
GLFW_KEY_F2 to KeyCodes.KEY_F2,
GLFW_KEY_F3 to KeyCodes.KEY_F3,
GLFW_KEY_F4 to KeyCodes.KEY_F4,
GLFW_KEY_F5 to KeyCodes.KEY_F5,
GLFW_KEY_F6 to KeyCodes.KEY_F6,
GLFW_KEY_F7 to KeyCodes.KEY_F7,
GLFW_KEY_F8 to KeyCodes.KEY_F8,
GLFW_KEY_F9 to KeyCodes.KEY_F9,
GLFW_KEY_F10 to KeyCodes.KEY_F10,
GLFW_KEY_F11 to KeyCodes.KEY_F11,
GLFW_KEY_F12 to KeyCodes.KEY_F12,
GLFW_KEY_F13 to KeyCodes.KEY_F13,
GLFW_KEY_F14 to KeyCodes.KEY_F14,
GLFW_KEY_F15 to KeyCodes.KEY_F15,
GLFW_KEY_F16 to KeyCodes.KEY_F16,
GLFW_KEY_F17 to KeyCodes.KEY_F17,
GLFW_KEY_F18 to KeyCodes.KEY_F18,
GLFW_KEY_F19 to KeyCodes.KEY_F19,
GLFW_KEY_F20 to KeyCodes.KEY_F20,
GLFW_KEY_F21 to KeyCodes.KEY_F21,
GLFW_KEY_F22 to KeyCodes.KEY_F22,
GLFW_KEY_F23 to KeyCodes.KEY_F23,
GLFW_KEY_F24 to KeyCodes.KEY_F24,
GLFW_KEY_F25 to KeyCodes.KEY_F25,
GLFW_KEY_KP_0 to KeyCodes.KEY_KP_0,
GLFW_KEY_KP_1 to KeyCodes.KEY_KP_1,
GLFW_KEY_KP_2 to KeyCodes.KEY_KP_2,
GLFW_KEY_KP_3 to KeyCodes.KEY_KP_3,
GLFW_KEY_KP_4 to KeyCodes.KEY_KP_4,
GLFW_KEY_KP_5 to KeyCodes.KEY_KP_5,
GLFW_KEY_KP_6 to KeyCodes.KEY_KP_6,
GLFW_KEY_KP_7 to KeyCodes.KEY_KP_7,
GLFW_KEY_KP_8 to KeyCodes.KEY_KP_8,
GLFW_KEY_KP_9 to KeyCodes.KEY_KP_9,
GLFW_KEY_KP_DECIMAL to KeyCodes.KEY_KP_DECIMAL,
GLFW_KEY_KP_DIVIDE to KeyCodes.KEY_KP_DIVIDE,
GLFW_KEY_KP_MULTIPLY to KeyCodes.KEY_KP_MULTIPLY,
GLFW_KEY_KP_SUBTRACT to KeyCodes.KEY_KP_SUBTRACT,
GLFW_KEY_KP_ADD to KeyCodes.KEY_KP_ADD,
GLFW_KEY_KP_ENTER to KeyCodes.KEY_KP_ENTER,
GLFW_KEY_KP_EQUAL to KeyCodes.KEY_KP_EQUAL,
GLFW_KEY_LEFT_SHIFT to KeyCodes.KEY_LEFT_SHIFT,
GLFW_KEY_LEFT_CONTROL to KeyCodes.KEY_LEFT_CONTROL,
GLFW_KEY_LEFT_ALT to KeyCodes.KEY_LEFT_ALT,
GLFW_KEY_LEFT_SUPER to KeyCodes.KEY_LEFT_SUPER,
GLFW_KEY_RIGHT_SHIFT to KeyCodes.KEY_RIGHT_SHIFT,
GLFW_KEY_RIGHT_CONTROL to KeyCodes.KEY_RIGHT_CONTROL,
GLFW_KEY_RIGHT_ALT to KeyCodes.KEY_RIGHT_ALT,
GLFW_KEY_RIGHT_SUPER to KeyCodes.KEY_RIGHT_SUPER,
GLFW_KEY_MENU to KeyCodes.KEY_MENU,
GLFW_KEY_LAST to KeyCodes.KEY_LAST,
GLFW_MOUSE_BUTTON_1 to KeyCodes.MOUSE_BUTTON_1,
GLFW_MOUSE_BUTTON_2 to KeyCodes.MOUSE_BUTTON_2,
GLFW_MOUSE_BUTTON_3 to KeyCodes.MOUSE_BUTTON_3,
GLFW_MOUSE_BUTTON_4 to KeyCodes.MOUSE_BUTTON_4,
GLFW_MOUSE_BUTTON_5 to KeyCodes.MOUSE_BUTTON_5,
GLFW_MOUSE_BUTTON_6 to KeyCodes.MOUSE_BUTTON_6,
GLFW_MOUSE_BUTTON_7 to KeyCodes.MOUSE_BUTTON_7,
GLFW_MOUSE_BUTTON_8 to KeyCodes.MOUSE_BUTTON_8,
GLFW_MOUSE_BUTTON_LAST to KeyCodes.MOUSE_BUTTON_LAST,
GLFW_MOUSE_BUTTON_LEFT to KeyCodes.MOUSE_BUTTON_LEFT,
GLFW_MOUSE_BUTTON_RIGHT to KeyCodes.MOUSE_BUTTON_RIGHT,
GLFW_MOUSE_BUTTON_MIDDLE to KeyCodes.MOUSE_BUTTON_MIDDLE,
GLFW_MOUSE_BUTTON_1 to KeyCodes.MOUSE_BUTTON_1,
GLFW_MOUSE_BUTTON_2 to KeyCodes.MOUSE_BUTTON_2,
GLFW_MOUSE_BUTTON_3 to KeyCodes.MOUSE_BUTTON_3,
GLFW_MOUSE_BUTTON_4 to KeyCodes.MOUSE_BUTTON_4,
GLFW_MOUSE_BUTTON_5 to KeyCodes.MOUSE_BUTTON_5,
GLFW_MOUSE_BUTTON_6 to KeyCodes.MOUSE_BUTTON_6,
GLFW_MOUSE_BUTTON_7 to KeyCodes.MOUSE_BUTTON_7,
GLFW_MOUSE_BUTTON_8 to KeyCodes.MOUSE_BUTTON_8,
GLFW_MOUSE_BUTTON_LAST to KeyCodes.MOUSE_BUTTON_LAST,
GLFW_MOUSE_BUTTON_LEFT to KeyCodes.MOUSE_BUTTON_LEFT,
GLFW_MOUSE_BUTTON_RIGHT to KeyCodes.MOUSE_BUTTON_RIGHT,
GLFW_MOUSE_BUTTON_MIDDLE to KeyCodes.MOUSE_BUTTON_MIDDLE,
)
val CursorModes.glfw: Int
@ -584,5 +597,7 @@ class GLFWWindow(
CursorShapes.VERTICAL_RESIZE -> GLFW_VRESIZE_CURSOR
}
}
private val OSTypes.needsWindowScaling: Boolean get() = this == OSTypes.MAC
}
}