mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2026-04-22 15:57:15 +08:00
internal/glfw: apply go-fix for Windows
This commit is contained in:
@@ -8,6 +8,7 @@ package glfw
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"slices"
|
||||
"strings"
|
||||
"unsafe"
|
||||
|
||||
@@ -331,12 +332,7 @@ func extensionSupportedWGL(extension string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, str := range strings.Split(extensions, " ") {
|
||||
if extension == str {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return slices.Contains(strings.Split(extensions, " "), extension)
|
||||
}
|
||||
|
||||
func getProcAddressWGL(procname string) uintptr {
|
||||
|
||||
@@ -145,7 +145,7 @@ func createKeyTables() {
|
||||
_glfw.platformWindow.keycodes[0x037] = KeyKPMultiply
|
||||
_glfw.platformWindow.keycodes[0x04A] = KeyKPSubtract
|
||||
|
||||
for scancode := 0; scancode < 512; scancode++ {
|
||||
for scancode := range 512 {
|
||||
if _glfw.platformWindow.keycodes[scancode] > 0 {
|
||||
_glfw.platformWindow.scancodes[_glfw.platformWindow.keycodes[scancode]] = scancode
|
||||
}
|
||||
|
||||
@@ -2366,7 +2366,7 @@ func (c *Cursor) platformCreateCursor(img *image.NRGBA, xhot, yhot int) error {
|
||||
// Repack into a tight RGBA buffer: createIcon expects contiguous pixels
|
||||
// and a non-zero image origin or non-trivial stride would confuse it.
|
||||
pixels := make([]byte, w*h*4)
|
||||
for y := 0; y < h; y++ {
|
||||
for y := range h {
|
||||
src := img.PixOffset(b.Min.X, b.Min.Y+y)
|
||||
copy(pixels[y*w*4:(y+1)*w*4], img.Pix[src:src+w*4])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user