A little excercise for myself creating a demoscene'ish program, showing off classic Amiga demoscene-like graphics, On Linux.
Made with C using SDL2 that implements the classic "Doom" pixel fire algorithm, spherical text scrolling banner and a parrallax moving star trail background. Now with a soundbyte bgm loop!
Should work on any Linux distribution that has SDL2 + SDL2_mixer.
sudo apt-get install build-essential libsdl2-dev libsdl2-mixer-devUsage:
$ linuxdemo -f / --fullscreen / -w 1280 -h 720 / --width 1280 --height 720Demo of demo: https://www.youtube.com/watch?v=qbnEi5xHPZY
-O3optimized demoscene binary (36KB, 16KB more than theLICENSEfile).44KBintro sound chunk +20KBsoundbyte loop (courtesy of k!M), making the total size 100KB!
- It creates an internal framebuffer (an array of pixels), updates the fire logic by seeding heat at the bottom and spreading it upward with randomized decay, and renders it to an SDL2 texture.
- For the spherical text scroller, it iterates over the string and map each character's index to a circular path using sin(theta) and cos(theta).
- It uses Bresenham's Line Algorithm for parrallax star trails.
- It also emulates CRT scanlines for oldschool feels' :P Right before blasting the buffer to the GPU, we loop over every even row in the frameBuffer and bit-shift/divide the RGB channels by half, creating dark interlaced lines.
