Korok Engine学习二

Korok Engine

第一个Korok应用程序(hello world)

对应官网的quick start
(但是官网的代码是错的,没有更新到新版本,虽然我提交了pr但是作者目前还没改)
1. 创建项目目录

cd $GOPATH/src/
mkdir hello

然后用vscode打开hello文件夹
创建文件main.go并写入代码

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{})
}

然后按control+`调出终端,输入

go run main.go

然后出现运行结果
注意:`是tab键上面的那一个键


代码

结果
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容