PRISM: A library to simulate the ZX Spectrum display in LÖVE

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
AukonDK
Prole
Posts: 2
Joined: Mon May 22, 2017 12:34 pm

PRISM: A library to simulate the ZX Spectrum display in LÖVE

Post by AukonDK » Mon May 22, 2017 12:49 pm

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.
Attachments
prism.zip
(4.43 KiB) Downloaded 95 times

AukonDK
Prole
Posts: 2
Joined: Mon May 22, 2017 12:34 pm

Re: PRISM: A library to simulate the ZX Spectrum display in LÖVE

Post by AukonDK » Thu Jun 08, 2017 1:28 pm

I ported a simple asteroids game to use my library. Shows off the on-the-fly sprite rotation.


User avatar
DmL
Prole
Posts: 18
Joined: Fri Nov 21, 2014 9:09 am

Re: PRISM: A library to simulate the ZX Spectrum display in LÖVE

Post by DmL » Tue Jul 18, 2017 7:34 pm

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!

User avatar
OmegaMax
Prole
Posts: 12
Joined: Wed Jun 07, 2017 3:49 pm

Re: PRISM: A library to simulate the ZX Spectrum display in LÖVE

Post by OmegaMax » Fri Jul 21, 2017 2:30 am

Very cool

Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests