I'm working on my first big project using LÖVE, a Manic Miner/Jet Set Willy style game. I wanted it to look authentic down to the colours and graphical glitches of the ZX Spectrum. I developed this library so all the display stuff could be reused for other projects.
Blog post here.
Basically you pass a 2d array of bits that describe a sprite to a function that draws it on 3 canvases. 2 canvases store the colour attributes while the 3rd has the sprite itself and a shader combines the three to recreate the Attribute Clash effect. The border also has a few modes to simulate the feedback of loading from tape.
I'm really paranoid about how rubbish my code is so I'm open to any pointers.
PRISM: A library to simulate the ZX Spectrum display in LÖVE
PRISM: A library to simulate the ZX Spectrum display in LÖVE
- Attachments
-
- prism.zip
- (4.43 KiB) Downloaded 254 times
Re: PRISM: A library to simulate the ZX Spectrum display in LÖVE
I ported a simple asteroids game to use my library. Shows off the on-the-fly sprite rotation.
Re: PRISM: A library to simulate the ZX Spectrum display in LÖVE
I love this! Wish I could use it in my own game (maybe I can find an excuse...) in the meantime, may I suggest:
Practical Rendering In Spectrum Mode
: D Cheers!
Edit:
Also, you could probably do this without shader code.
3 canvases: background, sprite pixels, sprite color
1. Draw the background color (could do per line or 8x8 block or whatever the actual speccy could do)
2. Draw sprites on cleared canvas
3. Draw sprite color onto third canvas
4. Multiply sprite color canvas onto the sprite pixel canvas
5. Draw combined sprite/color canvas
No idea if this would be faster, but I'd love to try/see it tried!
Practical Rendering In Spectrum Mode
: D Cheers!
Edit:
Also, you could probably do this without shader code.
3 canvases: background, sprite pixels, sprite color
1. Draw the background color (could do per line or 8x8 block or whatever the actual speccy could do)
2. Draw sprites on cleared canvas
3. Draw sprite color onto third canvas
4. Multiply sprite color canvas onto the sprite pixel canvas
5. Draw combined sprite/color canvas
No idea if this would be faster, but I'd love to try/see it tried!
Who is online
Users browsing this forum: No registered users and 4 guests