pf2d
Version, currently 0.4.27 versions
github.com/SleepingInsomniac/pf2d
PixelFaucet 2d graphics library
Nothing has been indexed for 0.4.2 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
pf2d:
github: SleepingInsomniac/pf2d
version: ~> 0.4.2Then run:
shards installshard.yml
No shard.yml has been indexed for 0.4.2. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
PF2d
PF2d is a 2d drawing library that provides a set of structs and methods for 2d drawing operations. PF2d was extracted from PixelFaucet.
Installation
-
Add the dependency to your
shard.yml:dependencies: pf2d: github: sleepinginsomniac/pf2d -
Run
shards install
Usage
require "pf2d"
char_grid = PF2d::Grid(Char).new(11, 11) { ' ' }
char_grid.fill_circle(PF2d::Vec[5, 5], 5, '#')
char_grid.each_row do |row|
puts row.join
end
###
#######
#########
#########
###########
###########
###########
#########
#########
#######
###
Implementing your own
class View
include PF2d::Viewable(Color)
#...
def get_point?(x, y) : Color?
return nil unless in_bounds?(x, y)
# @data[y * width + x] ... etc.
end
end
class Draw
include PF2d::Drawable(Color)
#...
def draw_point(x, y, value)
return nil unless in_bounds?(x, y)
# @data[y * width + x] = value ... etc.
end
end
Caveats
- Drawing operations don't anti-alias
Contributing
- Fork it (https://github.com/sleepinginsomniac/pf2d/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
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.4.2- Tagged
- Feb 27, 2026
- Commit
9bb0faf16ec3- Indexed
- not yet
Dependents
Repository
github.com/SleepingInsomniac/pf2d
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 7