pixelfaucet v0.2.3
PixelFaucet Game
PixelFaucet is a "Game Engine" written in the Crystal programming language and uses SDL under the hood to create a window, draw pixels, and expose hardware interfaces.
See the examples.
The examples can either be run with crystal run examples/<name>.cr from the root of the repo, or be all built by running the ./scripts/build_examples.rb script. This will place the binaries in the examples/build folder.
Setup
PixelFaucet requires the crystal compiler which can be installed via homebrew
- Install crystal
brew install crystal
- Install sdl3
brew install sdl3
brew install sdl3_image
- Create a new project:
crystal init app my_game
- Add the dependency to your
shard.yml:
dependencies:
pixelfaucet:
github: sleepinginsomniac/pixelfaucet
version: 0.2.2 # Or the current version
- Run the shards command:
shards install
Usage
The engine works be subclassing the PF::Game which requires two methods be defined:
require "pixelfaucet"
class Static < PF::Game
# Called every game tick
def update(delta_time : Time::Span)
end
# Called at a rate to satify `fps_limit` (Float::INFINITY by default)
def frame(delta_time)
window.lock do
window.clear
window.each_point { |p| window.draw_point(p, PF::RGBA.random) }
end
end
end
e = Example.new(100, 60, 5)
e.run!
Drawing methods come from PF2d. PF::Window and PF::Sprite implement the PF2d::Canvas(PF:RGBA) module which provides methods for drawing points, lines, rects, circles, bezier curves, triangles, and more.
Documentation
Run crystal docs to generate documentation. The documentation can then be found under the docs folder.
Contributing
- Fork it (https://github.com/sleepinginsomniac/pixelfaucet/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Alex Clink - creator and maintainer
pixelfaucet
- 6
- 1
- 0
- 2
- 4
- 18 days ago
- November 26, 2021
Other
Tue, 27 Jan 2026 09:02:56 GMT