Misc Go interop fixes
This commit is contained in:
@ -1 +1,3 @@
|
||||
go 1.21.5
|
||||
|
||||
use .
|
@ -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()
|
||||
|
13
example_project/viperid/exports.go
Normal file
13
example_project/viperid/exports.go
Normal 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)))
|
||||
}
|
15
example_project/viperid/imports.go
Normal file
15
example_project/viperid/imports.go
Normal 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
|
Reference in New Issue
Block a user