diff --git a/render/const.go b/render/const.go index 445784c..b06336f 100644 --- a/render/const.go +++ b/render/const.go @@ -4,6 +4,7 @@ import "github.com/bobtfish/mayhem/logical" const CHAR_PIXELS = 64 const SPRITE_SIZE = 16 +const INVERSE_VIDEO_OFFSET = 10 func MainScreenV() logical.Vec { return logical.V(0, CHAR_PIXELS) diff --git a/render/sprite.go b/render/sprite.go index 8a17d34..1284604 100644 --- a/render/sprite.go +++ b/render/sprite.go @@ -16,7 +16,22 @@ func GetSpriteSheet(io io.Reader) pixel.Picture { if err != nil { panic(err) } - return pixel.PictureDataFromImage(img) + + // Recreate an image of double the width of the sprite sheet. + // Copy the original sprite sheet, and then to the right copy + // all the same pixels but with the colours inverted. + // This allows us to draw inverse video :) + size := img.Bounds().Size() + wImg := image.NewNRGBA(image.Rect(0, 0, size.X, size.Y)) + for x := 0; x < size.X*2; x++ { + for y := 0; y < size.Y; y++ { + pixel := img.At(x, y).(color.NRGBA) + newPixel := color.NRGBA{^pixel.R, ^pixel.G, ^pixel.B, pixel.A} + wImg.Set(x, y, pixel) + wImg.Set(x+size.X, y, newPixel) + } + } + return pixel.PictureDataFromImage(wImg) } func NewSpriteDrawer(ss pixel.Picture) SpriteDrawer {