Home - dimkauzh/webzen GitHub Wiki
Welcome to the webzen wiki! In this wiki there are gonna be tutorials, API and some docs.
General Setup
Everything needed
Webzen doesnt need anything except Go version that is higher that 1.18. There is no C compiler or anything needed, but we recommend wasmserve to quickly run your code. Also you need to have a Go module in your directory to use this. Create a go module using this command:
go mod init example.com
Change the example.com to your own package name or url (like Github).
Getting the Go package
Wenzen is an ordinary go package, so you can get it using this command:
go get github.com/dimkauzh/webzen@latest
Example
This is a example of the engine:
package main
import (
// Import the webzen package
"github.com/dimkauzh/webzen"
// Import the webzen draw package
"github.com/dimkauzh/webzen/src/draw"
)
func main() {
// Initialize webzen
webzen.Init()
// Start loop
for {
// Fill background
draw.FillBackground([4]int{255, 255, 188, 255})
// Draw text on the screen
draw.DrawText("Hello, world!", 21, 100, 100)
// Draw a rectangle on the screen
draw.DrawRect(50, 500, 400, 400, [4]int{146, 255, 123, 255})
// Draw a second rectangle on the screen
draw.DrawRect(200, 200, 100, 400, [4]int{146, 255, 123, 255})
// Update
webzen.Update()
}
}
About webzen
Webzen is a Go Game Engine that targets WebAssembly, enabling you to build web applications with Go. It helps you build your games easy and fast. This project leverages syscall/js
to interact with the JavaScript runtime in the browser.