Nicolas Allemand

Music, game dev and emulation.

July 26, 1997; Apple introduced Mac OS 8. I remember the long hours I spent in front of my Macintosh, trying the new features of the OS. That's also the first time I had the chance to try HyperCard. One thing really caught my eye: the patterns. Here's a screenshot where you can see the default ones:
Screenshot of Hypercard's patterns window Pretty cool, huh?

I was -and still am- amazed at the ingenuity behind this. The patterns were usually small (17x12 for HyperCard patterns), and only two colours were allowed, yet some of these patterns were awfully complex.
Naturally, I thought this would be a fun idea to re-implement them in a more contemporary engine. I made a little library for LÖVE, which returns a canvas of the desired size, after loading a custom .lua pattern file.

Example of a pattern file:

local p = {}
p.width = 17
p.height = 12
p.data = {2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,}
return p

And how to draw it :

local patterns = require 'patterns'

function love.load()
    canvas = patterns.getCanvas(150, 250, 'my_pattern_file')
end

function love.draw()
    love.graphics.draw(canvas)
end

Finally, here's how the pattern editor looks like:
Screenshot of Pattern Editor app

Here :)