moonshot

technical

pensel

pensel is moonshot's pixel art editor. it takes over one window and paints the sprite being edited as a zoomed grid. on the way out it writes the result to jakel as a file a game can load. draw (file) opens it and draw (file) (size) opens it at a given canvas size, square, from 4 to 64 pixels across.

a moonshot screen with pensel open in the top-left corner. a sixteen by sixteen grid shows a drawn red mushroom with white spots and a pale stem with two dark eyes, on a grey checkerboard standing for transparency. a two-column palette of colour swatches sits to the right of the grid, with a diagonal red slash marking the transparent slot. a title line above reads 'pensel: hero.spr 16x16  [s]ave [c]lear [q]uit'.
a sprite drawn on the machine itself, on the transparency checkerboard, with the palette beside it.

drawing

the left mouse button paints the cell under the pointer, and dragging paints a stroke. the right button erases. a click on the palette picks a colour. an empty cell shows as a checkerboard, so transparent and black look different.

keys

s
save.
c
clear the canvas.
n, d
add a frame after this one, as a copy of it, or delete this frame.
, and .
step back and forward through the frames.
q, escape
quit, saving if anything was painted.

on every frame but the first, an empty pixel shows the frame before it faintly, so movement is drawn against where things just were. how many frames fit depends on the size, eight at 16 by 16, four at 32 by 32 and one at 64 by 64.

the file

a sprite file is a short header followed by pixels, little-endian throughout. a game reads it back with readfile(), so gnista can show art drawn on the machine itself, with no rebuild.

  0..7   width in pixels
  8..15  height
 16..23  frame count
 24..    frames * width * height * 4 bytes, BGR0 per pixel

a pixel of all zeroes is transparent, so the palette's black is a near-black.