app_wasm.mx raw
1 //go:build wasm
2
3 package app
4
5 import "unsafe"
6
7 //go:wasmimport bridge app_CreateFullscreenCanvas
8 func wasmCreateFullscreenCanvas()
9
10 //go:wasmimport bridge app_CreateWebGLContext
11 func wasmCreateWebGLContext() int32
12
13 //go:wasmimport bridge app_GetDevicePixelRatio
14 func wasmGetDevicePixelRatio() float32
15
16 //go:wasmimport bridge app_GetCanvasCSSSize
17 func wasmGetCanvasCSSSize(wPtr *int32, hPtr *int32)
18
19 //go:wasmimport bridge app_SetCanvasBacking
20 func wasmSetCanvasBacking(w, h int32)
21
22 //go:wasmimport bridge app_RequestRAF
23 func wasmRequestRAF()
24
25 //go:wasmimport bridge app_SetCursor
26 func wasmSetCursor(ptr *byte, len int32)
27
28 //go:wasmimport bridge app_SetTitle
29 func wasmSetTitle(ptr *byte, len int32)
30
31 //go:wasmimport bridge app_SetFullscreen
32 func wasmSetFullscreen(full int32)
33
34 //go:wasmimport bridge app_RegisterPointerEvents
35 func wasmRegisterPointerEvents()
36
37 //go:wasmimport bridge app_RegisterKeyEvents
38 func wasmRegisterKeyEvents()
39
40 //go:wasmimport bridge app_RegisterResizeEvents
41 func wasmRegisterResizeEvents()
42
43 //go:wasmimport bridge app_RegisterTextEvents
44 func wasmRegisterTextEvents()
45
46 //go:wasmimport bridge app_FocusTextArea
47 func wasmFocusTextArea()
48
49 //go:wasmimport bridge app_BlurTextArea
50 func wasmBlurTextArea()
51
52 //go:wasmimport bridge app_RegisterContextLossEvents
53 func wasmRegisterContextLossEvents()
54
55 //go:wasmimport bridge app_WriteClipboard
56 func wasmWriteClipboard(ptr *byte, len int32)
57
58 //go:wasmimport bridge app_ReadClipboard
59 func wasmReadClipboard()
60
61 func CreateFullscreenCanvas() { wasmCreateFullscreenCanvas() }
62 func CreateWebGLContext() int32 { return wasmCreateWebGLContext() }
63 func GetDevicePixelRatio() float32 { return wasmGetDevicePixelRatio() }
64
65 func GetCanvasCSSSize(w, h *int32) { wasmGetCanvasCSSSize(w, h) }
66 func SetCanvasBacking(w, h int32) { wasmSetCanvasBacking(w, h) }
67 func RequestRAF() { wasmRequestRAF() }
68
69 func SetCursor(s string) {
70 wasmSetCursor(unsafe.StringData(s), int32(len(s)))
71 }
72
73 func SetTitle(s string) {
74 wasmSetTitle(unsafe.StringData(s), int32(len(s)))
75 }
76
77 func SetFullscreen(full bool) {
78 v := int32(0)
79 if full {
80 v = 1
81 }
82 wasmSetFullscreen(v)
83 }
84
85 func RegisterPointerEvents() { wasmRegisterPointerEvents() }
86 func RegisterKeyEvents() { wasmRegisterKeyEvents() }
87 func RegisterResizeEvents() { wasmRegisterResizeEvents() }
88 func RegisterTextEvents() { wasmRegisterTextEvents() }
89 func FocusTextArea() { wasmFocusTextArea() }
90 func BlurTextArea() { wasmBlurTextArea() }
91 func RegisterContextLossEvents() { wasmRegisterContextLossEvents() }
92 func ReadClipboard() { wasmReadClipboard() }
93
94 func WriteClipboard(s string) {
95 wasmWriteClipboard(unsafe.StringData(s), int32(len(s)))
96 }
97