mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 19:28:57 +01:00
parent
847357c3ea
commit
ec2df98c70
@ -1457,6 +1457,10 @@ func _LoadImageW(hInst _HINSTANCE, name uintptr, typ uint32, cx int32, cy int32,
|
||||
return windows.Handle(r), nil
|
||||
}
|
||||
|
||||
func _LoadImageW_Available() bool {
|
||||
return procLoadImageW.Find() == nil
|
||||
}
|
||||
|
||||
func _MapVirtualKeyW(uCode uint32, uMapType uint32) uint32 {
|
||||
r, _, _ := procMapVirtualKeyW.Call(uintptr(uCode), uintptr(uMapType))
|
||||
return uint32(r)
|
||||
@ -1683,6 +1687,10 @@ func _SetProcessDpiAwarenessContext(value _DPI_AWARENESS_CONTEXT) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func _SetProcessDpiAwarenessContext_Available() bool {
|
||||
return procSetProcessDpiAwarenessContext.Find() == nil
|
||||
}
|
||||
|
||||
func _SetPropW(hWnd windows.HWND, str string, hData windows.Handle) error {
|
||||
var lpString *uint16
|
||||
if str != "" {
|
||||
|
@ -254,9 +254,11 @@ func platformInit() error {
|
||||
createKeyTables()
|
||||
|
||||
if isWindows10CreatorsUpdateOrGreaterWin32() {
|
||||
if _SetProcessDpiAwarenessContext_Available() {
|
||||
if err := _SetProcessDpiAwarenessContext(_DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); err != nil && !errors.Is(err, windows.ERROR_ACCESS_DENIED) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else if _IsWindows8Point1OrGreater() {
|
||||
if err := _SetProcessDpiAwareness(_PROCESS_PER_MONITOR_DPI_AWARE); err != nil && !errors.Is(err, windows.ERROR_ACCESS_DENIED) {
|
||||
return err
|
||||
|
@ -1355,11 +1355,13 @@ func registerWindowClassWin32() error {
|
||||
// In the original GLFW implementation, an embedded resource GLFW_ICON is used if possible.
|
||||
// See https://www.glfw.org/docs/3.3/group__window.html
|
||||
|
||||
if _LoadImageW_Available() {
|
||||
icon, err := _LoadImageW(0, _IDI_APPLICATION, _IMAGE_ICON, 0, 0, _LR_DEFAULTSIZE|_LR_SHARED)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
wc.hIcon = _HICON(icon)
|
||||
}
|
||||
|
||||
if _, err := _RegisterClassExW(&wc); err != nil {
|
||||
return err
|
||||
@ -2138,6 +2140,10 @@ func (c *Cursor) platformCreateCursor(image *Image, xhot, yhot int) error {
|
||||
}
|
||||
|
||||
func (c *Cursor) platformCreateStandardCursor(shape StandardCursor) error {
|
||||
if !_LoadImageW_Available() {
|
||||
return nil
|
||||
}
|
||||
|
||||
var id int
|
||||
switch shape {
|
||||
case ArrowCursor:
|
||||
|
Loading…
Reference in New Issue
Block a user