You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Andy Meneely b4702e1d4a Example of svg id being supplied, better input handling of svg ids 12 years ago
bin Putting together a basic squib new command 12 years ago
lib Example of svg id being supplied, better input handling of svg ids 12 years ago
samples Example of svg id being supplied, better input handling of svg ids 12 years ago
spec Removing debug statement 12 years ago
.gitignore Ignoring built pdfs 12 years ago
.travis.yml Getting travis to use new bundler 12 years ago
.yardopts Tons of documentation work 12 years ago
API.md Minor documentation tweaks 12 years ago
Gemfile Re-generating gem with bundler 12 years ago
LICENSE.txt Re-generating gem with bundler 12 years ago
README.md More documentation for prior methods 12 years ago
Rakefile rake installs and runs all samples 12 years ago
squib.gemspec Tons of documentation work 12 years ago

README.md

Squib Gem Version Build Status Dependency Status

Squib is a Ruby DSL for prototyping card and board games. Think of it like nanDeck done "the Ruby way". Start with some basic commands and generate print-ready PNGs and PDFs. Squib supports:

  • Complex text rendering using Pango
  • Reading PNGs and SVGs using Cairo
  • Reading .xlsx files
  • Basic shape drawing
  • Saving to PNGs and PDFs
  • Plus the full power of Ruby!
require 'squib'

Squib::Deck.new do
  text str: 'Hello, World!'  
  save_png
end

Installation

Install it yourself with:

$ gem install squib

If you're using Bundler, add this line to your application's Gemfile:

gem 'squib'

And then execute:

$ bundle

Note: Squib has some native dependencies, such as Cairo, Pango, and Nokogiri, which all require DevKit to compile C code. This is usually not painful, but on some setups can cause headaches. For Windows users, I strongly recommend using the *non-*64 bit RubyInstaller at http://rubyinstaller.org. For Mac, I recommend using rvm.

Getting Started

After installing Squib, you can create a project and run your first build like this:

$ squib new my-cool-game
$ cd my-cool-game
$ ruby deck.rb

The squib new command will generate files and folders like this:

_output
  gitkeep.txt
.gitignore
ABOUT.md
config.yml
deck.rb
Gemfile
layout.yml
PNP NOTES.md

The central file here is deck.rb. Here's a more complex example of a deck to work from:

require 'squib'

Squib::Deck.new(width: 825, height: 1125, cards: 3) do
  background color: :white
  data = xlsx file: 'sample.xlsx'

  rect x: 15, y: 15, width: 795, height: 1095, x_radius: 50, y_radius: 50

  text str: data['name'], x: 250, y: 55, font: 'Arial 54'
  text str: data['level'], x: 65, y: 40, font: 'Arial 72'

  png file: 'icon.png', x: 665, y: 30

  save format: :png
end

Learning Squib's API

  • The samples directory in the source repository has lots of examples
  • The document called API.md walks through the various methods and options that apply to the entire Squib API
  • API Documentation is also kept up-to-date.

Development

Squib is currently in pre-release alpha, so the API is still maturing. If you are using Squib, however, I'd love to hear about it! Feel free to file a bug or feature request.

Contributing

Squib is an open source tool, and I would love participation. If you want your code integrated:

  1. Fork it ( https://github.com/[my-github-username]/squib/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request