mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
internal/glfw: Remove one of go-vet warnings
This commit is contained in:
parent
584c6524ee
commit
0cea5f2f1a
@ -18,6 +18,7 @@ import (
|
|||||||
"image"
|
"image"
|
||||||
"image/draw"
|
"image/draw"
|
||||||
"math/bits"
|
"math/bits"
|
||||||
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
@ -89,13 +90,18 @@ func (m *Monitor) GetPos() (int, int) {
|
|||||||
func (m *Monitor) GetVideoMode() *VidMode {
|
func (m *Monitor) GetVideoMode() *VidMode {
|
||||||
v := glfwDLL.call("glfwGetVideoMode", m.m)
|
v := glfwDLL.call("glfwGetVideoMode", m.m)
|
||||||
panicError()
|
panicError()
|
||||||
|
var vals []int32
|
||||||
|
h := (*reflect.SliceHeader)(unsafe.Pointer(&vals))
|
||||||
|
h.Data = v
|
||||||
|
h.Len = 6
|
||||||
|
h.Cap = 6
|
||||||
return &VidMode{
|
return &VidMode{
|
||||||
Width: int(*(*int32)(unsafe.Pointer(v))),
|
Width: int(vals[0]),
|
||||||
Height: int(*(*int32)(unsafe.Pointer(v + 4))),
|
Height: int(vals[1]),
|
||||||
RedBits: int(*(*int32)(unsafe.Pointer(v + 8))),
|
RedBits: int(vals[2]),
|
||||||
GreenBits: int(*(*int32)(unsafe.Pointer(v + 12))),
|
GreenBits: int(vals[3]),
|
||||||
BlueBits: int(*(*int32)(unsafe.Pointer(v + 16))),
|
BlueBits: int(vals[4]),
|
||||||
RefreshRate: int(*(*int32)(unsafe.Pointer(v + 20))),
|
RefreshRate: int(vals[5]),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user