示例#1
0
文件: 4s.go 项目: rjkroege/go
func main() {
	args := os.Args
	p := pieces4
	name := "4s"
	if len(args) > 1 && args[1] == "-5" {
		p = pieces5
		name = "5s"
	}

	d, err := draw.Init(nil, "", name, "")
	if err != nil {
		log.Fatal(err)
	}

	Play(p, d)
}
示例#2
0
文件: acme.go 项目: rjkroege/acme
func main() {
	var cols [5]*draw.Image
	errch := make(chan<- error)
	display, err := draw.Init(errch, "", "acme", "1024x720")
	if err != nil {
		panic(err)
	}
	img, err := display.AllocImage(image.Rect(0, 0, 1024, 720), draw.RGB16, true, draw.Cyan)
	if err != nil {
		panic(err)
	}
	f := frame.NewFrame(image.Rect(0, 0, 500, 600), display.DefaultFont, img, cols)

	for {
		f.Tick(image.ZP, true)
	}
}
示例#3
0
文件: spacewar.go 项目: rjkroege/go
func main() {
	d, err := draw.Init(nil, "", "spacewar", "512x512")
	if err != nil {
		log.Fatal(err)
	}

	var m SpacewarPDP1
	m.Init(d)
	m.PC = 4
	f := bytes.NewBuffer([]byte(spacewarCode))
	if err = m.Load(f); err != nil {
		log.Fatalf("loading %s: %s", "spacewar.lst", err)
	}
	for err == nil {
		//fmt.Printf("step PC=%06o ", m.PC);
		//fmt.Printf("inst=%06o AC=%06o IO=%06o OV=%o\n",
		//	m.Mem[m.PC], m.AC, m.IO, m.OV);
		err = m.Step()
	}
	log.Fatalf("step: %s", err)
}