Posts

Terminal-based Tetris - Part 1: Procedural polyomino generation

This is the first part of a series of tutorials on creating a terminal-based Tetris clone with Go. For a complete implementation of a Tetris clone in Go, see netris. Disclaimer Tetris is a registered trademark of the Tetris Holding, LLC. Rocket Nine Labs is in no way affiliated with Tetris Holding, LLC. Minos Game pieces are called “minos” because they are polyominos. This tutorial series will focus on the seven one-sided terominos, where each piece has four blocks.

tview and you - Creating Rich Terminal User Interfaces

This is an introduction to using tview (or cview) to create rich terminal-based user interfaces with Go. Primitives The Primitive interface is as follows: type Primitive interface { Draw(screen tcell.Screen) GetRect() (int, int, int, int) SetRect(x, y, width, height int) InputHandler() func(event *tcell.EventKey, setFocus func(p Primitive)) Focus(delegate func(p Primitive)) Blur() GetFocusable() Focusable } Box is the only primitive implemented. It has a size, padding amount, optional border, optional title and background color.