mirror of
https://github.com/vlang/v.git
synced 2025-09-16 19:06:24 -04:00
glfw: fix mut scale bug
This commit is contained in:
parent
60fbceea43
commit
aa0643f785
@ -147,10 +147,13 @@ pub fn create_window(c WinCfg) &glfw.Window {
|
|||||||
// println('create window wnd=$cwindow ptr==$c.ptr')
|
// println('create window wnd=$cwindow ptr==$c.ptr')
|
||||||
C.glfwSetWindowUserPointer(cwindow, c.ptr)
|
C.glfwSetWindowUserPointer(cwindow, c.ptr)
|
||||||
|
|
||||||
scale := 1.0
|
mut scale := f32(1.0)
|
||||||
$if windows {
|
$if windows {
|
||||||
C.glfwGetWindowContentScale(cwindow, &scale, &scale)
|
C.glfwGetWindowContentScale(cwindow, &scale, &scale)
|
||||||
}
|
}
|
||||||
|
$else {
|
||||||
|
scale = 1.0
|
||||||
|
}
|
||||||
|
|
||||||
window := &glfw.Window {
|
window := &glfw.Window {
|
||||||
data: cwindow,
|
data: cwindow,
|
||||||
@ -257,10 +260,13 @@ pub fn get_cursor_pos(cwindow voidptr) (f64, f64) {
|
|||||||
y := f64(0)
|
y := f64(0)
|
||||||
C.glfwGetCursorPos(cwindow, &x, &y)
|
C.glfwGetCursorPos(cwindow, &x, &y)
|
||||||
|
|
||||||
scale := 1.0
|
mut scale := f32(1.0)
|
||||||
$if windows {
|
$if windows {
|
||||||
C.glfwGetWindowContentScale(cwindow, &scale, &scale)
|
C.glfwGetWindowContentScale(cwindow, &scale, &scale)
|
||||||
}
|
}
|
||||||
|
$else {
|
||||||
|
scale = 1.0
|
||||||
|
}
|
||||||
return x/scale, y/scale
|
return x/scale, y/scale
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user