Example #1
0
func (t *Tetrimino) draw(w *gc.Window, o Orientation) {

	var p []Coord
	p = t.bitmaps[o]
	/*
		switch o {
		case North:
			p = t.bitmaps[Norhtt.North
		case East:
			p = t.East
		case West:
			p = t.West
		case South:
			p = t.South

		}
	*/
	for _, p := range p {
		w.MoveAddChar(p.y, p.x, '*')
	}

}
Example #2
0
func NewGame(parent *gc.Window) *Game {

	game := new(Game)
	game.linesCleared = 0
	h, w := parent.MaxYX()

	clog("newGame:  h,w = %v,%v\n", h, w)
	game.top = 0
	game.bottom = h - 1
	game.left = 0
	game.right = w - 1

	game.floor = NewFill(game.bottom - 1)
	game.win, _ = gc.NewWindow(h, w, 0, 0)

	game.scoreWin, _ = gc.NewWindow(1, 8, 0, w+3)

	game.shapeWin, _ = gc.NewWindow(1, 1, 1, 5)

	h, w = game.win.MaxYX()
	return game

}
Example #3
0
func (shape *Shape) draw(parent *gc.Window) {
	parent.Overlay(shape.win)

}