Skip to content

Commit 441b859

Browse files
committed
Move pi.Palette to palette.go file
Add type to pi.Palette var, even though it can be inferred by compiler. This is needed to generate better godoc documentation.
1 parent 9c29c3b commit 441b859

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

palette.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33

44
package pi
55

6+
import "github.com/elgopher/pi/image"
7+
8+
// Palette has all colors available in the game. Up to 256.
9+
// Palette is taken from loaded sprite sheet (which must be
10+
// a PNG file with indexed color mode). If sprite-sheet.png was not
11+
// found, then default 16 color palette is used.
12+
//
13+
// Can be freely read and updated when the game is running. Changes will be visible immediately.
14+
var Palette [256]image.RGB = defaultPalette
15+
616
// Palette swapping variables. Use them to generate new graphics by swapping colors.
717
var (
818
// Pal (draw palette) contains mapping of colors used to replace color with

pi.go

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import (
4040
"github.com/elgopher/pi/font"
4141
)
4242

43-
// User parameters
43+
// Game-loop function callbacks
4444
var (
4545
// Update is a user provided function executed each frame (30 times per second).
4646
//
@@ -53,19 +53,11 @@ var (
5353
//
5454
// The purpose of this function is to draw on screen.
5555
Draw func()
56-
57-
// Palette has all colors available in the game. Up to 256.
58-
// Palette is taken from loaded sprite sheet (which must be
59-
// a PNG file with indexed color mode). If sprite-sheet.png was not
60-
// found, then default 16 color palette is used.
61-
//
62-
// Can be freely read and updated when the game is running. Changes will be visible immediately.
63-
Palette = defaultPalette
64-
65-
// Camera has camera offset used for all subsequent draw operations.
66-
Camera Position
6756
)
6857

58+
// Camera has camera offset used for all subsequent draw operations.
59+
var Camera Position
60+
6961
// Time returns the amount of time since game was run, as a (fractional) number of seconds
7062
//
7163
// Time is updated each frame.

0 commit comments

Comments
 (0)