Skip to content

Commit f37da23

Browse files
hajimehoshiTotallyGamerJet
authored andcommitted
examples/window: replace deprecated functions (ebitengine#269)
1 parent 4d82012 commit f37da23

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

examples/window/main_windows.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ func init() {
9696
}
9797

9898
func main() {
99-
className := windows.StringToUTF16Ptr("Sample Window Class")
99+
className, err := windows.UTF16PtrFromString("Sample Window Class")
100+
if err != nil {
101+
panic(err)
102+
}
100103
inst := GetModuleHandle(className)
101104

102105
wc := WNDCLASSEX{
@@ -114,10 +117,14 @@ func main() {
114117
Right: 320,
115118
Bottom: 240,
116119
}
120+
title, err := windows.UTF16PtrFromString("My Title")
121+
if err != nil {
122+
panic(err)
123+
}
117124
AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, false)
118125
hwnd := CreateWindowEx(
119126
0, className,
120-
windows.StringToUTF16Ptr("My Title"),
127+
title,
121128
WS_OVERLAPPEDWINDOW,
122129
CW_USEDEFAULT, CW_USEDEFAULT, int(wr.Right-wr.Left), int(wr.Bottom-wr.Top),
123130
0, 0, inst, nil,

0 commit comments

Comments
 (0)