Project

doomfire

0.01
No release in over 3 years
Low commit activity in last 3 years
Puts your console on fire. Use a truecolor console for best effect.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
 Project Readme

Build Status Gem Version

Doomfire

Put your terminal on fire.

terminal example

This gem implements the Doom fire algorithm in Ruby, because why not, and outputs it into the terminal. Right now it requires the terminal to be able to display 24-bit colors, so it will either not work at all or not work properly on terminals that can't do that, for example on MacOS's default Terminal.app - in which case you should probably install a better terminal application (like iTerm or whatever else you like).

You can check the list of terminals supporting 24-bit color here.

Installation

Add this line to your application's Gemfile:

gem 'doomfire'

And then execute:

$ bundle

Or install it yourself as:

$ gem install doomfire

Usage

The most basic way to run this is to run it directly from the command line:

$ doomfire

Pressing CTRL-C will stop the program gracefully after a few extra frames to let it end nicely.

Alternatively you can use it for amusement while running some long rake tasks.

require 'doomfire'

desc 'some long running task'
task :long do
  fire = Doomfire::Spinner.new
  fire.run

  5.times do
    sleep 1
  end

  fire.stop
end

This will run the fire in a separate thread while your rake tasks works in the main thread, and at the end of the task it will gracefully extinguish the fire and clear the terminal.

SDL

Now with actual pixel manipulation! You can set the output to use the SDL2 library, which will put the output in a graphical window. It's a bit restricted right now to a small window and sometimes blows up, so I consider it a bit of an experiment.

You need libSDL2 installed on your system (most likely through Homebrew, apt or whatever your system uses). The doomfire executable script will complain if you don't have it.

$ brew install sdl2

Then you can run the executable:

$ doomfire --sdl

And the output should be shown in a separate window. Closing the window will end the program after a few seconds of the ending animation.

SDL example

If running on a Ruby interpreter on the JVM, you will need the -XstartOnFirstThread option.

Benchmarks

$ bundle exec bench/micro.rb
$ bundle exec bench/macro.rb

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/marcinruszkiewicz/doomfire.

License

The gem is available as open source under the terms of the MIT License.