You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Pixel
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.
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!
Example
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"
)
funcrun() {
cfg:= pixelgl.WindowConfig{
Title: "TilePix",
Bounds: pixel.R(0, 0, 640, 320),
VSync: true,
}
win, err:=pixelgl.NewWindow(cfg)
iferr!=nil {
panic(err)
}
// Load and initialise the map.m, err:=tilepix.ReadFile("myMap.tmx")
iferr!=nil {
panic(err)
}
for!win.Closed() {
win.Clear(color.White)
// Draw all layers to the window.iferr:=m.DrawAll(win, color.White, pixel.IM); err!=nil {
panic(err)
}
win.Update()
}
}
funcmain() {
pixelgl.Run(run)
}