mirror of
https://github.com/SleepingInsomniac/pixelfaucet
synced 2024-11-17 07:48:20 +01:00
1.8 KiB
1.8 KiB
PixelFaucet Game
PixelFaucet is a "Game Engine" written in the Crystal programming language and uses SDL2 under the hood to create a window, renderer, and draw pixels. See the examples.
The examples can be built by running the ./scripts/build_examples.rb
script. This will build all the examples in the examples folder to the examples/build
directory.
Setup
PixelFaucet require the crystal compiler which can be installed via homebrew
- Install crystal
brew install crystal
- Install sdl2
brew install sdl2
- Create a new project:
crystal init app my_game
- Add the dependency to your
shard.yml
:
dependencies:
pixelfaucet:
github: sleepinginsomniac/pixelfaucet
- Run the shards command:
shards install
Usage
require "pixelfaucet/game"
class Example < PF::Game
def update(dt)
end
def draw
clear
0.upto(width) do |x|
0.upto(height) do |y|
draw_point(x, y, PF::Pixel.random)
end
end
end
end
e = Example.new(100, 60, 5)
e.run!
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