This guide assumes intermediate level knowledge of Golang. If you are totally new to golang. These are some useful links:
1. Install Go:
Install the latest version of Go from here.
Note: Korok requires at least Go version 1.8 (for best Cgo performance).
2. Install korok:
$ go get korok.io/korok
Note: Dependencies is installed automatically when you use go get
command, these are:
If you can't install it successfully, read this wiki.
1. Create a file: main.go
2. Copy the following code:
package main
import (
"korok.io/korok"
"korok.io/korok/game"
"korok.io/korok/gfx/dbg"
)
type MainScene struct {
}
func (m *MainScene) OnEnter(g *game.Game) {
}
func (m *MainScene) Update(dt float32) {
dbg.DrawStr(180, 160, "Hello World")
}
func (*MainScene) OnExit() {
}
func main() {
// Run game
options := &korok.Options{
Title: "Hello, Korok Engine",
Width: 480,
Height:320,
}
korok.Run(options, &MainScene{})
}
3. Run the code with go run main.go
, your first Korok app works!
♥ Learn more from the Demo Project.