把别人的Tcl/Tk代码加入到Go语言里10 游戏3 简单的跑车

时间:2015-05-13 06:35:33   收藏:0   阅读:180

a 首先打开网页 http://wiki.tcl.tk/4364

Car racing in TclUpdated 2011-08-25 01:30:05 by RLE

b 把网页里提到的tcl/tk代码复制到如下go源代码的init_script字符串常量里

package main

import "github.com/nsf/gothic"

const init_script = `

#把Tcl/Tk源代码复制到这个常量里

`

func main() {

    ir := gothic.NewInterpreter(init_script)

    <-ir.Done

}

c 在LiteIDE里或命令行里go run go代码文件,运行效果如下

【使用wsad和上下左右键来控制车】

技术分享


原文:http://my.oschina.net/u/2315579/blog/414104

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!