File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -65,9 +65,21 @@ var Time float64
65
65
66
66
var GameLoopStopped bool
67
67
68
- // Load loads files like sprite-sheet.png, custom-font.png
68
+ // Load loads files: sprite-sheet.png and custom-font.png from resources parameter.
69
69
//
70
- // Load looks for resources with specific names in the resources parameter, eg "sprite-sheet.png".
70
+ // Load looks for images with hard-coded names, eg for sprite-sheet it loads "sprite-sheet.png".
71
+ // Your file name must be exactly the same. And it cannot be inside subdirectory.
72
+ //
73
+ // sprite-sheet.png file must have an indexed color mode. This means that pixels in the sprite-sheet
74
+ // file refers to an index of the color defined in a small palette, also attached to the file in a
75
+ // form of mapping: index number->RGB color. Image must have an indexed color mode,
76
+ // because Pi loads the palette from the sprite-sheet.png file itself. Please use a pixel-art editor
77
+ // which supports indexed color mode, such as Aseprite (paid) or LibreSprite (free). Sprite-sheet
78
+ // width and height must be multiplication of 8.
79
+ //
80
+ // custom-font.png must also have an indexed color mode. Color with index 0 is treated as background.
81
+ // Any other color as foreground. The size of the image is fixed. It must be 128x128. Each char is 8x8.
82
+ // Char 0 is in the top-left corner. Char 1 to the right.
71
83
//
72
84
// To acquire the resources object, the easiest way is to include the resources in the game binary
73
85
// by using go:embed directive:
Original file line number Diff line number Diff line change @@ -58,10 +58,10 @@ func SprSheet() PixMap {
58
58
59
59
func newSpriteSheet (w int , h int ) spriteSheet {
60
60
if w % 8 != 0 || w == 0 {
61
- panic (fmt .Sprintf ("sprite sheet width %d is not a multiplcation of 8" , w ))
61
+ panic (fmt .Sprintf ("sprite sheet width %d is not a multiplication of 8" , w ))
62
62
}
63
63
if h % 8 != 0 || h == 0 {
64
- panic (fmt .Sprintf ("sprite sheet height %d is not a multiplcation of 8" , h ))
64
+ panic (fmt .Sprintf ("sprite sheet height %d is not a multiplication of 8" , h ))
65
65
}
66
66
67
67
size := w * h
You can’t perform that action at this time.
0 commit comments