Go (golang) bindings for libtcod roguelike toolkit
Go C C++ Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.


What is it
libtcod-go is a set of Go bindings for the libtcod library

libtcod (http://roguecentral.org/doryen/libtcod/) is an open-source, cross-platform C
library for writing roguelike games
It provides many utilities frequently used in roguelike games, like
- truecolor console (SDL and OpenGL backends)
- keyboard/mouse input
- misc algorithms (line drawing, pathfinding, field of view, dungeon generation)
- terrain and noise generators
- widget toolkit
- config parser
- name generator

Go (http://golang.org/) is a programming language released in 2009 by Google.
It is a static language with dynamic feel, compiles to native code, has clean syntax (somewhat
between C and Python) with garbage collection and language support for unicode
and concurrency.

Most of libtcod API (version 1.5.1) is wrapped in Go, with some parts fully ported to enable easier
callbacks. In addition, the demo and terrain-generation tool were also fully ported to
serve as examples on how to use the library.

To build the bindings, you will need the libtcod library and Go language installed.
Please refer to http://golang.org/doc/install.html for Go installation
and to http://doryen.eptalys.net/libtcod/download/ for libtcod installation.

You can obtain libtcod-go by running `go get github.com/afolmert/libtcod-go/tcod`,
and use the library in your programs with `import "github.com/afolmert/libtcod-go/tcod"`.

The sample program and hmtool program can be built by running `go build` from
within their respective directories, and then running the `./sample` and `./hmtool`
binaries respectively. This is preferred to using `go get` or `go install` to
install these binaries because they use data and images from their source directory
and `go install` has no way to install these.

Although there is no documentation for the bindings themselves, the bindings API
does not differ much from the original library, so the original documentation should
be very helpful (http://doryen.eptalys.net/data/libtcod/doc/1.5.1/index2.html?c=true).

The samples and hmtool program also use many parts of the API so they also could be
helpful to get started.

Original API parts missing from Go bindings:
- custom containers (TCOD_list_t) - alternatives exist in Go
- thread/mutexes functions - alternatives exist in Go
- SDL callback renderer - callbacks from C are currently cumbersome in Go

The bindings have been tested on 32bit and 64bit Linux with 8g and 6g compilers.
There may still be some issues on other platforms.

Please report any problems and other bugs to afolmert (at) gmail (dot) com

Thanks to:
Go Authors for the Go language
Jice, Mingos and others for the libtcod library
Chris Hamons for API design ideas in the libtcod-net bindings
Felipe Bichued for comments and ideas
Alex Ogier for patches updating to Go 1.2