Skip to content

Instantly share code, notes, and snippets.

@andymeneely
Last active November 29, 2015 02:56
Show Gist options
  • Save andymeneely/de29434663ba2679f0a3 to your computer and use it in GitHub Desktop.
Save andymeneely/de29434663ba2679f0a3 to your computer and use it in GitHub Desktop.
Squib Exmaples: built-in layouts
require 'squib'
# This sample demonstrates the built-in layouts for Squib.
# Each card demonstrates a different built-in layout.
Squib::Deck.new(layout: 'fantasy.yml') do
background color: 'white'
set font: 'Times New Roman,Serif 32'
hint text: '#333' # show extents of text boxes to demo the layout
text str: 'fantasy.yml', layout: :title
text str: 'ur', layout: :upper_right
text str: 'art', layout: :art
text str: 'type', layout: :type
text str: 'tr', layout: :type_right
text str: 'description', layout: :description
text str: 'lr', layout: :lower_right
text str: 'll', layout: :lower_left
text str: 'credits', layout: :copy
rect layout: :safe
rect layout: :cut
save_png prefix: 'layouts_builtin_fantasy_'
end
Squib::Deck.new(layout: 'economy.yml') do
background color: 'white'
set font: 'Times New Roman,Serif 32'
hint text: '#333' # show extents of text boxes to demo the layout
text str: 'economy.yml', layout: :title
text str: 'art', layout: :art
text str: 'description', layout: :description
text str: 'type', layout: :type
text str: 'lr', layout: :lower_right
text str: 'll', layout: :lower_left
text str: 'credits', layout: :copy
rect layout: :safe
rect layout: :cut
save_png prefix: 'layouts_builtin_economy_'
end
Squib::Deck.new(layout: 'hand.yml') do
background color: 'white'
set font: 'Times New Roman,Serif 32'
hint text: '#333' # show extents of text boxes to demo the layout
text str: 'hand.yml' , layout: :title
text str: 'art', layout: :art
text str: 'description', layout: :description
text str: 'snark', layout: :snark
text str: 'bonus1', layout: :bonus1
text str: 'bonus2', layout: :bonus2
text str: 'bonus3', layout: :bonus3
text str: 'bonus4', layout: :bonus4
text str: 'bonus5', layout: :bonus5
rect layout: :safe
rect layout: :cut
save_png prefix: 'layouts_builtin_hand_'
end
# Stitch together a deck of all the above examples
# Squib::Deck.new(cards: 2) do
# Dir.glob('_output/layouts_builtin_*.png').each.with_index do |file, i|
# png file: file, range: i
# end
# save_sheet prefix: 'layouts_builtinsheet_'
# end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment