mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 19:28:57 +01:00
glfw: Remove some suspicious codes depending on the memory layout
This commit is contained in:
parent
a3b41515a9
commit
ee15e06c50
@ -24,15 +24,6 @@ import (
|
|||||||
"golang.org/x/sys/windows"
|
"golang.org/x/sys/windows"
|
||||||
)
|
)
|
||||||
|
|
||||||
type glfwVidMode struct {
|
|
||||||
width int32
|
|
||||||
height int32
|
|
||||||
redBits int32
|
|
||||||
greenBits int32
|
|
||||||
blueBits int32
|
|
||||||
refreshRate int32
|
|
||||||
}
|
|
||||||
|
|
||||||
type glfwImage struct {
|
type glfwImage struct {
|
||||||
width int32
|
width int32
|
||||||
height int32
|
height int32
|
||||||
@ -87,14 +78,13 @@ 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()
|
||||||
vv := (*glfwVidMode)(unsafe.Pointer(v))
|
|
||||||
return &VidMode{
|
return &VidMode{
|
||||||
Width: int(vv.width),
|
Width: int(*(*int32)(unsafe.Pointer(v))),
|
||||||
Height: int(vv.height),
|
Height: int(*(*int32)(unsafe.Pointer(v + 4))),
|
||||||
RedBits: int(vv.redBits),
|
RedBits: int(*(*int32)(unsafe.Pointer(v + 8))),
|
||||||
GreenBits: int(vv.greenBits),
|
GreenBits: int(*(*int32)(unsafe.Pointer(v + 12))),
|
||||||
BlueBits: int(vv.blueBits),
|
BlueBits: int(*(*int32)(unsafe.Pointer(v + 16))),
|
||||||
RefreshRate: int(vv.refreshRate),
|
RefreshRate: int(*(*int32)(unsafe.Pointer(v + 20))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user