Misc Go interop fixes

This commit is contained in:
2024-04-27 12:16:04 -07:00
parent 042f2dca79
commit c124e60168
13 changed files with 77 additions and 58 deletions

View File

@ -1 +1,3 @@
go 1.21.5
use .

View File

@ -1,14 +1,16 @@
package main
import "example_project/viperid"
func main() {
t := 0
for {
for y := 0; y < 120; y++ {
for x := 0; x < 160; x++ {
Pset(
int32(x),
int32(y),
int32((x+y+t)%64),
viperid.Pset(
x,
y,
(x+y+t)%64,
)
}
}
@ -17,15 +19,7 @@ func main() {
/*
debug.PrintStack()
*/
YieldFrame()
viperid.YieldFrame()
t += 1
}
}
//go:wasmimport viperid Pset
//go:noescape
func Pset(x int32, y int32, color int32)
//go:wasmimport viperid YieldFrame
//go:noescape
func YieldFrame()

View File

@ -0,0 +1,13 @@
package viperid
func YieldFrame() {
yieldFrame()
}
func Pset(x int, y int, color int) {
pset(int32(x), int32(y), int32(color))
}
func Pget(x int, y int) int {
return int(pget(int32(x), int32(y)))
}

View File

@ -0,0 +1,15 @@
//lint:file-ignore U1000 Ignore all unused code, it's generated
package viperid
//go:wasmimport viperid YieldFrame
//go:noescape
func yieldFrame()
//go:wasmimport viperid Pset
//go:noescape
func pset(x int32, y int32, color int32)
//go:wasmimport viperid Pget
//go:noescape
func pget(x int32, y int32) int32