TilePix is a complementary library, designed to be used with the Pixel library (see below for more details on Pixel). TilePix was born out of Ludum Dare; having found that a vast amount of very limited time during the Ludum Dare weekends was used planing out map layouts, and defining collision or activation areas. TilePix should make those activities a trivially short amount of time.
This library is a complement to the Pixel 2D games library, and is largely inspired
by it. A huge thanks to faiface for one, giving us access to such a fantastic library;
and two, providing the inspiration for this library! Further thanks to duysqubix and
collaborators for continuing the effort with Pixel2
.
TilePix would not have been possible without the great amount of care and effort that has been put into Pixel.
Pixel is subject to the MIT licence.
TilePix is a work-in-progress project; as such, expect bugs and missing features. If you notice a bug or a feature you feel is missing, please consider contributing - simply (and correctly) raising issues is just as valuable as writing code!
Here is a very basic example of using the library. It is advisable to view the excellent Pixel tutorials before trying to understand this package, as TilePix is very Pixel centric.
package main
import (
"image/color"
// We must use blank imports for any image formats in the tileset image sources.
// You will get an error if a blank import is not made; TilePix does not import
// specific image formats, that is the responsibility of the calling code.
_ "image/png"
"github.com/bcvery1/tilepix"
pixel "github.com/duysqubix/pixel2"
"github.com/duysqubix/pixel2/pixelgl"
)
func run() {
cfg := pixelgl.WindowConfig{
Title: "TilePix",
Bounds: pixel.R(0, 0, 640, 320),
VSync: true,
}
win, err := pixelgl.NewWindow(cfg)
if err != nil {
panic(err)
}
// Load and initialise the map.
m, err := tilepix.ReadFile("myMap.tmx")
if err != nil {
panic(err)
}
for !win.Closed() {
win.Clear(color.White)
// Draw all layers to the window.
if err := m.DrawAll(win, color.White, pixel.IM); err != nil {
panic(err)
}
win.Update()
}
}
func main() {
pixelgl.Run(run)
}
Further examples can be found in the examples directory.
Thanks for considering contributing to TilePix; for details on how you can contribute, please consult the contribution guide.