squib 0.15.2 → 0.15.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +41 -41
- data/.travis.yml +17 -17
- data/CHANGELOG.md +400 -395
- data/CONTRIBUTING.md +40 -40
- data/Dockerfile +25 -25
- data/Gemfile +2 -2
- data/LICENSE.txt +22 -22
- data/README.md +145 -145
- data/RELEASE TODO.md +21 -21
- data/Rakefile +48 -48
- data/appveyor.yml +25 -25
- data/bin/squib +4 -4
- data/lib/squib.rb +32 -32
- data/lib/squib/api/background.rb +15 -15
- data/lib/squib/api/data.rb +137 -137
- data/lib/squib/api/groups.rb +54 -54
- data/lib/squib/api/image.rb +49 -49
- data/lib/squib/api/save.rb +83 -83
- data/lib/squib/api/settings.rb +21 -21
- data/lib/squib/api/shapes.rb +124 -124
- data/lib/squib/api/text.rb +25 -25
- data/lib/squib/api/text_embed.rb +71 -71
- data/lib/squib/api/units.rb +27 -27
- data/lib/squib/args/arg_loader.rb +126 -126
- data/lib/squib/args/box.rb +55 -55
- data/lib/squib/args/card_range.rb +32 -32
- data/lib/squib/args/color_validator.rb +12 -12
- data/lib/squib/args/coords.rb +35 -35
- data/lib/squib/args/csv_opts.rb +25 -25
- data/lib/squib/args/dir_validator.rb +16 -16
- data/lib/squib/args/draw.rb +92 -92
- data/lib/squib/args/embed_adjust.rb +25 -25
- data/lib/squib/args/embed_key.rb +17 -17
- data/lib/squib/args/hand_special.rb +37 -37
- data/lib/squib/args/import.rb +40 -40
- data/lib/squib/args/input_file.rb +37 -37
- data/lib/squib/args/paint.rb +44 -44
- data/lib/squib/args/paragraph.rb +116 -116
- data/lib/squib/args/save_batch.rb +63 -63
- data/lib/squib/args/scale_box.rb +53 -53
- data/lib/squib/args/sheet.rb +172 -172
- data/lib/squib/args/showcase_special.rb +41 -41
- data/lib/squib/args/sprue_file.rb +44 -44
- data/lib/squib/args/svg_special.rb +37 -37
- data/lib/squib/args/transform.rb +61 -61
- data/lib/squib/args/typographer.rb +119 -119
- data/lib/squib/args/unit_conversion.rb +29 -29
- data/lib/squib/builtin/layouts/economy.yml +85 -85
- data/lib/squib/builtin/layouts/fantasy.yml +101 -101
- data/lib/squib/builtin/layouts/hand.yml +62 -62
- data/lib/squib/builtin/layouts/party.yml +94 -94
- data/lib/squib/builtin/layouts/playing-card.yml +35 -35
- data/lib/squib/builtin/layouts/tuck_box.yml +46 -46
- data/lib/squib/builtin/projects/advanced/.gitignore +4 -4
- data/lib/squib/builtin/projects/advanced/ABOUT.md +19 -19
- data/lib/squib/builtin/projects/advanced/Gemfile +11 -11
- data/lib/squib/builtin/projects/advanced/Guardfile +21 -21
- data/lib/squib/builtin/projects/advanced/IDEAS.md +22 -22
- data/lib/squib/builtin/projects/advanced/PLAYTESTING.md +26 -26
- data/lib/squib/builtin/projects/advanced/Rakefile +27 -27
- data/lib/squib/builtin/projects/advanced/config.yml +49 -49
- data/lib/squib/builtin/projects/advanced/docs/PNP NOTES.md +3 -3
- data/lib/squib/builtin/projects/advanced/docs/RULES.md +21 -21
- data/lib/squib/builtin/projects/advanced/img/example.svg +60 -60
- data/lib/squib/builtin/projects/advanced/layouts/deck.yml +27 -27
- data/lib/squib/builtin/projects/advanced/src/deck.rb +34 -34
- data/lib/squib/builtin/projects/advanced/src/version.rb +3 -3
- data/lib/squib/builtin/projects/basic/.gitignore +4 -4
- data/lib/squib/builtin/projects/basic/ABOUT.md +19 -19
- data/lib/squib/builtin/projects/basic/Gemfile +3 -3
- data/lib/squib/builtin/projects/basic/IDEAS.md +22 -22
- data/lib/squib/builtin/projects/basic/PLAYTESTING.md +26 -26
- data/lib/squib/builtin/projects/basic/PNP NOTES.md +3 -3
- data/lib/squib/builtin/projects/basic/RULES.md +21 -21
- data/lib/squib/builtin/projects/basic/Rakefile +7 -7
- data/lib/squib/builtin/projects/basic/config.yml +49 -49
- data/lib/squib/builtin/projects/basic/deck.rb +6 -6
- data/lib/squib/builtin/sprues/a4_euro_card.yml +42 -42
- data/lib/squib/builtin/sprues/a4_poker_card_8up.yml +40 -40
- data/lib/squib/builtin/sprues/a4_poker_card_9up.yml +42 -42
- data/lib/squib/builtin/sprues/a4_usa_card.yml +42 -42
- data/lib/squib/builtin/sprues/drivethrucards_1up.yml +10 -10
- data/lib/squib/builtin/sprues/letter_poker_card_9up.yml +25 -25
- data/lib/squib/builtin/sprues/letter_poker_foldable_8up.yml +52 -52
- data/lib/squib/builtin/sprues/printplaygames_18up.yml +68 -68
- data/lib/squib/card.rb +75 -75
- data/lib/squib/commands/cli.rb +39 -39
- data/lib/squib/commands/data/template_option.rb +109 -109
- data/lib/squib/commands/make_sprue.rb +277 -277
- data/lib/squib/commands/new.rb +77 -77
- data/lib/squib/conf.rb +139 -139
- data/lib/squib/constants.rb +17 -17
- data/lib/squib/deck.rb +116 -116
- data/lib/squib/graphics/background.rb +14 -14
- data/lib/squib/graphics/cairo_context_wrapper.rb +113 -113
- data/lib/squib/graphics/embedding_utils.rb +28 -28
- data/lib/squib/graphics/gradient_regex.rb +47 -47
- data/lib/squib/graphics/hand.rb +42 -42
- data/lib/squib/graphics/image.rb +123 -123
- data/lib/squib/graphics/save_doc.rb +61 -61
- data/lib/squib/graphics/save_images.rb +52 -52
- data/lib/squib/graphics/save_pdf.rb +90 -90
- data/lib/squib/graphics/save_sprue.rb +219 -219
- data/lib/squib/graphics/shapes.rb +143 -143
- data/lib/squib/graphics/showcase.rb +85 -85
- data/lib/squib/graphics/text.rb +174 -174
- data/lib/squib/import/data_frame.rb +108 -108
- data/lib/squib/layout_parser.rb +138 -138
- data/lib/squib/progress.rb +38 -38
- data/lib/squib/sample_helpers.rb +34 -34
- data/lib/squib/sprues/crop_line.rb +28 -28
- data/lib/squib/sprues/crop_line_dash.rb +35 -35
- data/lib/squib/sprues/invalid_sprue_definition.rb +9 -9
- data/lib/squib/sprues/sprue.rb +206 -206
- data/lib/squib/sprues/sprue_schema.rb +50 -50
- data/lib/squib/version.rb +10 -10
- data/samples/autoscale_font/_autoscale_font.rb +29 -29
- data/samples/backend/_backend.rb +26 -26
- data/samples/basic.rb +19 -19
- data/samples/build_groups/build_groups.rb +36 -36
- data/samples/colors/_colors.rb +44 -44
- data/samples/colors/_gradients.rb +34 -34
- data/samples/colors/_switch_color.rb +33 -33
- data/samples/config/config_text_markup.rb +20 -20
- data/samples/config/custom_config.rb +18 -18
- data/samples/data/_csv.rb +33 -33
- data/samples/data/_excel.rb +55 -55
- data/samples/data/_yaml.rb +12 -12
- data/samples/hello_world.rb +6 -6
- data/samples/images/_cairo_access.rb +39 -39
- data/samples/images/_images.rb +104 -104
- data/samples/images/_more_load_images.rb +102 -102
- data/samples/intro/01_hello.rb +8 -8
- data/samples/intro/02_options.rb +14 -14
- data/samples/intro/03_layout.rb +11 -11
- data/samples/intro/04_arrays.rb +15 -15
- data/samples/intro/05_excel.rb +14 -14
- data/samples/layouts/builtin_layouts.rb +97 -97
- data/samples/layouts/layouts.rb +71 -71
- data/samples/project/src/characters.rb +8 -8
- data/samples/project/src/skills.rb +7 -7
- data/samples/proofs/_tgc_proofs.rb +16 -16
- data/samples/ranges/_ranges.rb +64 -64
- data/samples/saves/_hand.rb +23 -23
- data/samples/saves/_portrait_landscape.rb +23 -23
- data/samples/saves/_save_filenames.rb +24 -24
- data/samples/saves/_save_pdf.rb +29 -29
- data/samples/saves/_saves.rb +51 -51
- data/samples/saves/_showcase.rb +25 -25
- data/samples/shapes/_draw_shapes.rb +60 -60
- data/samples/shapes/_proofs.rb +22 -22
- data/samples/sprues/_advanced_sprues.rb +25 -25
- data/samples/sprues/_builtin_sprues.rb +21 -21
- data/samples/sprues/_fold_sheet.rb +27 -27
- data/samples/sprues/_hex_tiles.rb +15 -15
- data/samples/sprues/_mints.rb +11 -11
- data/samples/sprues/_sprue_example.rb +11 -11
- data/samples/text/_embed_text.rb +128 -128
- data/samples/text/_text.rb +47 -47
- data/samples/text/_text_options.rb +102 -102
- data/samples/text/bug134.rb +14 -14
- data/samples/units/_units.rb +32 -32
- data/squib.gemspec +52 -52
- metadata +62 -63
@@ -1,102 +1,102 @@
|
|
1
|
-
require 'squib'
|
2
|
-
|
3
|
-
Squib::Deck.new(width: 825, height: 1125, cards: 1, config: 'load_images_config.yml') do
|
4
|
-
background color: '#0b7c8e'
|
5
|
-
rect x: 38, y: 38, width: 750, height: 1050, x_radius: 38, y_radius: 38
|
6
|
-
|
7
|
-
png file: 'shiny-purse.png', x: 620, y: 75 # no scaling is done by default
|
8
|
-
svg file: 'spanner.svg', x: 620, y: 218
|
9
|
-
|
10
|
-
# Can be scaled if width and height are set
|
11
|
-
svg file: 'spanner.svg', x: 50, y: 50, width: 250, height: 250
|
12
|
-
png file: 'shiny-purse.png', x: 305, y: 50, width: 250, height: 250
|
13
|
-
# ...but PNGs will warn if it's an upscale, unless you disable them in config.yml
|
14
|
-
|
15
|
-
# Can be scaled using just width or height, if one of them is set to :scale
|
16
|
-
svg file: 'spanner.svg', x: 200, y: 350, width: 35, height: :scale
|
17
|
-
svg file: 'spanner.svg', x: 200, y: 390, width: :scale, height: 35
|
18
|
-
png file: 'shiny-purse.png', x: 240, y: 350, width: 35, height: :scale
|
19
|
-
png file: 'shiny-purse.png', x: 240, y: 390, width: :scale, height: 35
|
20
|
-
|
21
|
-
# You can also crop the loaded images, so you can work from a sprite sheet
|
22
|
-
png file: 'sprites.png', x: 300, y: 350 # entire sprite sheet
|
23
|
-
png file: 'sprites.png', x: 300, y: 425, # just the robot golem image
|
24
|
-
crop_x: 0, crop_y: 0, crop_corner_radius: 10,
|
25
|
-
crop_width: 64, crop_height: 64
|
26
|
-
png file: 'sprites.png', x: 400, y: 425, # just the drakkar ship image
|
27
|
-
crop_x: 64, crop_y: 0, crop_corner_x_radius: 25, crop_corner_y_radius: 25,
|
28
|
-
crop_width: 64, crop_height: 64
|
29
|
-
png file: 'sprites.png', x: 500, y: 415, # just the drakkar ship image, rotated
|
30
|
-
crop_x: 64, crop_y: 0, crop_corner_x_radius: 25, crop_corner_y_radius: 25,
|
31
|
-
crop_width: 64, crop_height: 64, angle: Math::PI / 6
|
32
|
-
|
33
|
-
# Cropping also works on SVGs too
|
34
|
-
svg file: 'spanner.svg', x: 300, y: 500, width: 64, height: 64,
|
35
|
-
crop_x: 32, crop_y: 32, crop_width: 32, crop_height:32
|
36
|
-
|
37
|
-
# We can flip our images too
|
38
|
-
png file: 'sprites.png', x: 300, y: 535, flip_vertical: true, flip_horizontal: true
|
39
|
-
svg file: 'spanner.svg', x: 300, y: 615, width: 64, height: 64,
|
40
|
-
flip_vertical: true, flip_horizontal: true
|
41
|
-
|
42
|
-
# We can also limit our rendering to a single object, if the SVG ID is set
|
43
|
-
svg file: 'spanner.svg', id: '#backdrop', x: 50, y: 350, width: 75, height: 75
|
44
|
-
# Squib prepends a #-sign if one is not specified
|
45
|
-
svg file: 'spanner.svg', id: 'backdrop', x: 50, y: 450, width: 125, height: 125
|
46
|
-
|
47
|
-
# We can also load SVGs as a string of XML
|
48
|
-
svg data: File.read('spanner.svg'), x: 50, y: 600, width: 75, height: 75
|
49
|
-
|
50
|
-
# The svg data field works nicely with modifying the SVG XML on-the-fly.
|
51
|
-
# To run this one, do `gem install game_icons` and uncomment the following
|
52
|
-
#
|
53
|
-
# require 'game_icons'
|
54
|
-
# svg data: GameIcons.get('angler-fish').recolor(fg: '#ccc', bg: '#333').string,
|
55
|
-
# x: 150, y: 600, width: 75, height: 75
|
56
|
-
#
|
57
|
-
# More examples at https://github.com/andymeneely/game_icons
|
58
|
-
# (or `gem install game_icons`) to get & manipulate art from game-icons.net
|
59
|
-
# Nokogiri (already included in Squib) is also great for XML manipulation.
|
60
|
-
|
61
|
-
# WARNING! If you choose to use the SVG ID, the x-y coordinates are still
|
62
|
-
# relative to the SVG page. See this example in an SVG editor
|
63
|
-
svg file: 'offset.svg', id: 'thing', x: 0, y: 0, width: 600, height: 600
|
64
|
-
|
65
|
-
# Over 15 different blending operators are supported.
|
66
|
-
# See http://cairographics.org/operators
|
67
|
-
# Alpha transparency too
|
68
|
-
png file: 'ball.png', x: 50, y: 700
|
69
|
-
png file: 'grit.png', x: 70, y: 750, blend: :color_burn, alpha: 0.75
|
70
|
-
|
71
|
-
# Images can be rotated around their upper-left corner
|
72
|
-
png file: 'shiny-purse.png', x: 300, y: 700, angle: 0.0 # default (no rotate)
|
73
|
-
png file: 'shiny-purse.png', x: 300, y: 800, angle: Math::PI / 4
|
74
|
-
svg file: 'spanner.svg', x: 300, y: 900, angle: Math::PI / 2 - 0.1
|
75
|
-
|
76
|
-
# Images can also be used as masks instead of being directly painted.
|
77
|
-
# This is particularly useful for switching directly over to black-and-white for printing
|
78
|
-
# Or, if you want the same image to be used but with different colors/gradients
|
79
|
-
svg mask: '#00ff00',
|
80
|
-
file: 'glass-heart.svg',
|
81
|
-
x: 500, y: 600, width: 200, height: 200
|
82
|
-
svg mask: '(0,0)(0,500) #ccc@0.0 #333@1.0',
|
83
|
-
file: 'glass-heart.svg',
|
84
|
-
x: 500, y: 800, width: 200, height: 200
|
85
|
-
|
86
|
-
# Masks are based on the alpha channel, so this is just a magenta square
|
87
|
-
png mask: :magenta, file: 'shiny-purse.png',
|
88
|
-
x: 650, y: 950
|
89
|
-
|
90
|
-
# Note that this method does nothing, even though it would normally fill up
|
91
|
-
# the card. force_id: true looks to the id field to be non-empty to render.
|
92
|
-
# This is useful if you have multiple different icons in one SVG file,
|
93
|
-
# but sometimes want to use none.
|
94
|
-
# e.g. id: [:attack, :defend, nil]
|
95
|
-
svg file: 'spanner.svg', width: :deck, height: :deck,
|
96
|
-
force_id: true, id: nil # <-- the important part
|
97
|
-
|
98
|
-
# Squib can handle incorrectly formatted svg files
|
99
|
-
svg file: 'bad-svg.svg'
|
100
|
-
|
101
|
-
save prefix: 'load_images_', format: :png
|
102
|
-
end
|
1
|
+
require 'squib'
|
2
|
+
|
3
|
+
Squib::Deck.new(width: 825, height: 1125, cards: 1, config: 'load_images_config.yml') do
|
4
|
+
background color: '#0b7c8e'
|
5
|
+
rect x: 38, y: 38, width: 750, height: 1050, x_radius: 38, y_radius: 38
|
6
|
+
|
7
|
+
png file: 'shiny-purse.png', x: 620, y: 75 # no scaling is done by default
|
8
|
+
svg file: 'spanner.svg', x: 620, y: 218
|
9
|
+
|
10
|
+
# Can be scaled if width and height are set
|
11
|
+
svg file: 'spanner.svg', x: 50, y: 50, width: 250, height: 250
|
12
|
+
png file: 'shiny-purse.png', x: 305, y: 50, width: 250, height: 250
|
13
|
+
# ...but PNGs will warn if it's an upscale, unless you disable them in config.yml
|
14
|
+
|
15
|
+
# Can be scaled using just width or height, if one of them is set to :scale
|
16
|
+
svg file: 'spanner.svg', x: 200, y: 350, width: 35, height: :scale
|
17
|
+
svg file: 'spanner.svg', x: 200, y: 390, width: :scale, height: 35
|
18
|
+
png file: 'shiny-purse.png', x: 240, y: 350, width: 35, height: :scale
|
19
|
+
png file: 'shiny-purse.png', x: 240, y: 390, width: :scale, height: 35
|
20
|
+
|
21
|
+
# You can also crop the loaded images, so you can work from a sprite sheet
|
22
|
+
png file: 'sprites.png', x: 300, y: 350 # entire sprite sheet
|
23
|
+
png file: 'sprites.png', x: 300, y: 425, # just the robot golem image
|
24
|
+
crop_x: 0, crop_y: 0, crop_corner_radius: 10,
|
25
|
+
crop_width: 64, crop_height: 64
|
26
|
+
png file: 'sprites.png', x: 400, y: 425, # just the drakkar ship image
|
27
|
+
crop_x: 64, crop_y: 0, crop_corner_x_radius: 25, crop_corner_y_radius: 25,
|
28
|
+
crop_width: 64, crop_height: 64
|
29
|
+
png file: 'sprites.png', x: 500, y: 415, # just the drakkar ship image, rotated
|
30
|
+
crop_x: 64, crop_y: 0, crop_corner_x_radius: 25, crop_corner_y_radius: 25,
|
31
|
+
crop_width: 64, crop_height: 64, angle: Math::PI / 6
|
32
|
+
|
33
|
+
# Cropping also works on SVGs too
|
34
|
+
svg file: 'spanner.svg', x: 300, y: 500, width: 64, height: 64,
|
35
|
+
crop_x: 32, crop_y: 32, crop_width: 32, crop_height:32
|
36
|
+
|
37
|
+
# We can flip our images too
|
38
|
+
png file: 'sprites.png', x: 300, y: 535, flip_vertical: true, flip_horizontal: true
|
39
|
+
svg file: 'spanner.svg', x: 300, y: 615, width: 64, height: 64,
|
40
|
+
flip_vertical: true, flip_horizontal: true
|
41
|
+
|
42
|
+
# We can also limit our rendering to a single object, if the SVG ID is set
|
43
|
+
svg file: 'spanner.svg', id: '#backdrop', x: 50, y: 350, width: 75, height: 75
|
44
|
+
# Squib prepends a #-sign if one is not specified
|
45
|
+
svg file: 'spanner.svg', id: 'backdrop', x: 50, y: 450, width: 125, height: 125
|
46
|
+
|
47
|
+
# We can also load SVGs as a string of XML
|
48
|
+
svg data: File.read('spanner.svg'), x: 50, y: 600, width: 75, height: 75
|
49
|
+
|
50
|
+
# The svg data field works nicely with modifying the SVG XML on-the-fly.
|
51
|
+
# To run this one, do `gem install game_icons` and uncomment the following
|
52
|
+
#
|
53
|
+
# require 'game_icons'
|
54
|
+
# svg data: GameIcons.get('angler-fish').recolor(fg: '#ccc', bg: '#333').string,
|
55
|
+
# x: 150, y: 600, width: 75, height: 75
|
56
|
+
#
|
57
|
+
# More examples at https://github.com/andymeneely/game_icons
|
58
|
+
# (or `gem install game_icons`) to get & manipulate art from game-icons.net
|
59
|
+
# Nokogiri (already included in Squib) is also great for XML manipulation.
|
60
|
+
|
61
|
+
# WARNING! If you choose to use the SVG ID, the x-y coordinates are still
|
62
|
+
# relative to the SVG page. See this example in an SVG editor
|
63
|
+
svg file: 'offset.svg', id: 'thing', x: 0, y: 0, width: 600, height: 600
|
64
|
+
|
65
|
+
# Over 15 different blending operators are supported.
|
66
|
+
# See http://cairographics.org/operators
|
67
|
+
# Alpha transparency too
|
68
|
+
png file: 'ball.png', x: 50, y: 700
|
69
|
+
png file: 'grit.png', x: 70, y: 750, blend: :color_burn, alpha: 0.75
|
70
|
+
|
71
|
+
# Images can be rotated around their upper-left corner
|
72
|
+
png file: 'shiny-purse.png', x: 300, y: 700, angle: 0.0 # default (no rotate)
|
73
|
+
png file: 'shiny-purse.png', x: 300, y: 800, angle: Math::PI / 4
|
74
|
+
svg file: 'spanner.svg', x: 300, y: 900, angle: Math::PI / 2 - 0.1
|
75
|
+
|
76
|
+
# Images can also be used as masks instead of being directly painted.
|
77
|
+
# This is particularly useful for switching directly over to black-and-white for printing
|
78
|
+
# Or, if you want the same image to be used but with different colors/gradients
|
79
|
+
svg mask: '#00ff00',
|
80
|
+
file: 'glass-heart.svg',
|
81
|
+
x: 500, y: 600, width: 200, height: 200
|
82
|
+
svg mask: '(0,0)(0,500) #ccc@0.0 #333@1.0',
|
83
|
+
file: 'glass-heart.svg',
|
84
|
+
x: 500, y: 800, width: 200, height: 200
|
85
|
+
|
86
|
+
# Masks are based on the alpha channel, so this is just a magenta square
|
87
|
+
png mask: :magenta, file: 'shiny-purse.png',
|
88
|
+
x: 650, y: 950
|
89
|
+
|
90
|
+
# Note that this method does nothing, even though it would normally fill up
|
91
|
+
# the card. force_id: true looks to the id field to be non-empty to render.
|
92
|
+
# This is useful if you have multiple different icons in one SVG file,
|
93
|
+
# but sometimes want to use none.
|
94
|
+
# e.g. id: [:attack, :defend, nil]
|
95
|
+
svg file: 'spanner.svg', width: :deck, height: :deck,
|
96
|
+
force_id: true, id: nil # <-- the important part
|
97
|
+
|
98
|
+
# Squib can handle incorrectly formatted svg files
|
99
|
+
svg file: 'bad-svg.svg'
|
100
|
+
|
101
|
+
save prefix: 'load_images_', format: :png
|
102
|
+
end
|
data/samples/intro/01_hello.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require 'squib'
|
2
|
-
|
3
|
-
Squib::Deck.new cards: 1 do
|
4
|
-
background color: 'pink'
|
5
|
-
rect
|
6
|
-
text str: 'Draw two cards.'
|
7
|
-
save_png prefix: 'part1_'
|
8
|
-
end
|
1
|
+
require 'squib'
|
2
|
+
|
3
|
+
Squib::Deck.new cards: 1 do
|
4
|
+
background color: 'pink'
|
5
|
+
rect
|
6
|
+
text str: 'Draw two cards.'
|
7
|
+
save_png prefix: 'part1_'
|
8
|
+
end
|
data/samples/intro/02_options.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
require 'squib'
|
2
|
-
|
3
|
-
Squib::Deck.new cards: 1 do
|
4
|
-
background color: '#252322'
|
5
|
-
rect fill_color: '#0B3736',
|
6
|
-
x: 38, y: 38, width: 750, height: 1050, radius: 38
|
7
|
-
text str: 'Robot Golem', font: 'True Crimes, Sans 24',
|
8
|
-
align: :center, x: 75, width: :deck, color: '#DFDFE1', y: 90
|
9
|
-
svg file: 'auto-repair.svg', x: 75, y: 75, width: 100, height: :scale
|
10
|
-
svg file: 'robot-golem.svg', x: 75, y: 300, width: 675, height: :scale
|
11
|
-
text str: 'Draw two cards', font: 'Serif 12',
|
12
|
-
align: :center, width: :deck, color: '#DFDFE1', y: 1000
|
13
|
-
save_png prefix: 'part2_'
|
14
|
-
end
|
1
|
+
require 'squib'
|
2
|
+
|
3
|
+
Squib::Deck.new cards: 1 do
|
4
|
+
background color: '#252322'
|
5
|
+
rect fill_color: '#0B3736',
|
6
|
+
x: 38, y: 38, width: 750, height: 1050, radius: 38
|
7
|
+
text str: 'Robot Golem', font: 'True Crimes, Sans 24',
|
8
|
+
align: :center, x: 75, width: :deck, color: '#DFDFE1', y: 90
|
9
|
+
svg file: 'auto-repair.svg', x: 75, y: 75, width: 100, height: :scale
|
10
|
+
svg file: 'robot-golem.svg', x: 75, y: 300, width: 675, height: :scale
|
11
|
+
text str: 'Draw two cards', font: 'Serif 12',
|
12
|
+
align: :center, width: :deck, color: '#DFDFE1', y: 1000
|
13
|
+
save_png prefix: 'part2_'
|
14
|
+
end
|
data/samples/intro/03_layout.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
require 'squib'
|
2
|
-
|
3
|
-
Squib::Deck.new cards: 1, layout: 'part3_layout.yml' do
|
4
|
-
background color: '#252322'
|
5
|
-
rect layout: 'backdrop'
|
6
|
-
text str: 'Robot Golem', layout: 'title'
|
7
|
-
svg layout: 'drone'
|
8
|
-
svg file: 'robot-golem.svg', layout: 'art'
|
9
|
-
text str: 'Draw two cards.', layout: 'power'
|
10
|
-
save_png prefix: 'part3_'
|
11
|
-
end
|
1
|
+
require 'squib'
|
2
|
+
|
3
|
+
Squib::Deck.new cards: 1, layout: 'part3_layout.yml' do
|
4
|
+
background color: '#252322'
|
5
|
+
rect layout: 'backdrop'
|
6
|
+
text str: 'Robot Golem', layout: 'title'
|
7
|
+
svg layout: 'drone'
|
8
|
+
svg file: 'robot-golem.svg', layout: 'art'
|
9
|
+
text str: 'Draw two cards.', layout: 'power'
|
10
|
+
save_png prefix: 'part3_'
|
11
|
+
end
|
data/samples/intro/04_arrays.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
require 'squib'
|
2
|
-
|
3
|
-
Squib::Deck.new cards: 2, layout: 'part3_layout.yml' do
|
4
|
-
background color: '#252322'
|
5
|
-
rect layout: 'backdrop'
|
6
|
-
text str: ['Robot Golem', 'Ninja'],
|
7
|
-
layout: 'title'
|
8
|
-
svg layout: ['drone', 'human']
|
9
|
-
svg file: ['robot-golem.svg','ninja-mask.svg'],
|
10
|
-
layout: 'art'
|
11
|
-
text str: ['Draw two cards',
|
12
|
-
'Use the power of another player'],
|
13
|
-
layout: 'power'
|
14
|
-
save_png prefix: 'part4_'
|
15
|
-
end
|
1
|
+
require 'squib'
|
2
|
+
|
3
|
+
Squib::Deck.new cards: 2, layout: 'part3_layout.yml' do
|
4
|
+
background color: '#252322'
|
5
|
+
rect layout: 'backdrop'
|
6
|
+
text str: ['Robot Golem', 'Ninja'],
|
7
|
+
layout: 'title'
|
8
|
+
svg layout: ['drone', 'human']
|
9
|
+
svg file: ['robot-golem.svg','ninja-mask.svg'],
|
10
|
+
layout: 'art'
|
11
|
+
text str: ['Draw two cards',
|
12
|
+
'Use the power of another player'],
|
13
|
+
layout: 'power'
|
14
|
+
save_png prefix: 'part4_'
|
15
|
+
end
|
data/samples/intro/05_excel.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
require 'squib'
|
2
|
-
|
3
|
-
Squib::Deck.new cards: 4, layout: 'part3_layout.yml' do
|
4
|
-
background color: '#252322'
|
5
|
-
rect layout: 'backdrop'
|
6
|
-
data = xlsx file: 'data.xlsx'
|
7
|
-
text str: data['name'], layout: 'title'
|
8
|
-
svg layout: data['class']
|
9
|
-
svg file: data['art'], layout: 'art'
|
10
|
-
text str: data['power'], layout: 'power'
|
11
|
-
save_png prefix: 'part5_'
|
12
|
-
hand file: 'part5_hand.png', trim_radius: 38
|
13
|
-
showcase file: 'part5_showcase.png'
|
14
|
-
end
|
1
|
+
require 'squib'
|
2
|
+
|
3
|
+
Squib::Deck.new cards: 4, layout: 'part3_layout.yml' do
|
4
|
+
background color: '#252322'
|
5
|
+
rect layout: 'backdrop'
|
6
|
+
data = xlsx file: 'data.xlsx'
|
7
|
+
text str: data['name'], layout: 'title'
|
8
|
+
svg layout: data['class']
|
9
|
+
svg file: data['art'], layout: 'art'
|
10
|
+
text str: data['power'], layout: 'power'
|
11
|
+
save_png prefix: 'part5_'
|
12
|
+
hand file: 'part5_hand.png', trim_radius: 38
|
13
|
+
showcase file: 'part5_showcase.png'
|
14
|
+
end
|
@@ -1,97 +1,97 @@
|
|
1
|
-
require 'squib'
|
2
|
-
|
3
|
-
# This sample demonstrates the built-in layouts for Squib.
|
4
|
-
# Each card demonstrates a different built-in layout.
|
5
|
-
Squib::Deck.new(layout: 'fantasy.yml') do
|
6
|
-
background color: 'white'
|
7
|
-
|
8
|
-
set font: 'Times New Roman,Serif 10.5'
|
9
|
-
hint text: '#333' # show extents of text boxes to demo the layout
|
10
|
-
|
11
|
-
text str: 'fantasy.yml', layout: :title
|
12
|
-
text str: 'ur', layout: :upper_right
|
13
|
-
text str: 'art', layout: :art
|
14
|
-
text str: 'type', layout: :type
|
15
|
-
text str: 'tr', layout: :type_right
|
16
|
-
text str: 'description', layout: :description
|
17
|
-
text str: 'lr', layout: :lower_right
|
18
|
-
text str: 'll', layout: :lower_left
|
19
|
-
text str: 'credits', layout: :copy
|
20
|
-
|
21
|
-
rect layout: :safe
|
22
|
-
rect layout: :cut
|
23
|
-
save_png prefix: 'layouts_builtin_fantasy_'
|
24
|
-
end
|
25
|
-
|
26
|
-
Squib::Deck.new(layout: 'economy.yml') do
|
27
|
-
background color: 'white'
|
28
|
-
|
29
|
-
set font: 'Times New Roman,Serif 10.5'
|
30
|
-
hint text: '#333' # show extents of text boxes to demo the layout
|
31
|
-
|
32
|
-
text str: 'economy.yml', layout: :title
|
33
|
-
text str: 'art', layout: :art
|
34
|
-
text str: 'description', layout: :description
|
35
|
-
text str: 'type', layout: :type
|
36
|
-
text str: 'lr', layout: :lower_right
|
37
|
-
text str: 'll', layout: :lower_left
|
38
|
-
text str: 'credits', layout: :copy
|
39
|
-
|
40
|
-
rect layout: :safe
|
41
|
-
rect layout: :cut
|
42
|
-
save_png prefix: 'layouts_builtin_economy_'
|
43
|
-
end
|
44
|
-
|
45
|
-
Squib::Deck.new(layout: 'hand.yml') do
|
46
|
-
background color: 'white'
|
47
|
-
%w(title bonus1 bonus2 bonus3 bonus4 bonus5 description
|
48
|
-
snark art).each do |icon|
|
49
|
-
text str: icon.capitalize, layout: icon,
|
50
|
-
hint: :red, valign: 'middle', align: 'center'
|
51
|
-
end
|
52
|
-
save_png prefix: 'layouts_builtin_hand_'
|
53
|
-
end
|
54
|
-
|
55
|
-
Squib::Deck.new(layout: 'playing-card.yml') do
|
56
|
-
background color: 'white'
|
57
|
-
text str: "A\u2660", layout: :bonus_ul, font: 'Sans bold 33', hint: :red
|
58
|
-
text str: "A\u2660", layout: :bonus_lr, font: 'Sans bold 33', hint: :red
|
59
|
-
text str: 'artwork here', layout: :art, hint: :red
|
60
|
-
save_png prefix: 'layouts_builtin_playing_card_'
|
61
|
-
end
|
62
|
-
|
63
|
-
Squib::Deck.new(layout: 'tuck_box.yml', width: 2325, height: 1950) do
|
64
|
-
background color: 'white'
|
65
|
-
rect layout: :top_rect
|
66
|
-
rect layout: :bottom_rect
|
67
|
-
rect layout: :right_rect
|
68
|
-
rect layout: :left_rect
|
69
|
-
rect layout: :back_rect
|
70
|
-
rect layout: :front_rect
|
71
|
-
curve layout: :front_curve
|
72
|
-
|
73
|
-
save_png prefix: 'layouts_builtin_tuck_box_'
|
74
|
-
end
|
75
|
-
|
76
|
-
Squib::Deck.new(layout: 'party.yml') do
|
77
|
-
background color: 'white'
|
78
|
-
# hint text: :black # uncomment to see the text box boundaries
|
79
|
-
|
80
|
-
rect layout: :title_box,
|
81
|
-
fill_color: :deep_sky_blue, stroke_width: 0
|
82
|
-
text str: "A SILLY NAME", layout: :title
|
83
|
-
text str: '✔', layout: :type_icon
|
84
|
-
text str: 'TYPE', layout: :type
|
85
|
-
text str: 'A Silly Name', layout: :title_middle
|
86
|
-
rect fill_color: :black, layout: :middle_rect
|
87
|
-
|
88
|
-
str = 'Rule or story text. Be funny ha ha ha this is a party.'
|
89
|
-
text str: str, layout: :rule_top
|
90
|
-
text str: str, layout: :rule_bottom
|
91
|
-
|
92
|
-
text str: 'Tiny text', layout: :copyright
|
93
|
-
|
94
|
-
rect layout: :safe
|
95
|
-
rect layout: :cut
|
96
|
-
save_png prefix: 'layouts_builtin_party_'
|
97
|
-
end
|
1
|
+
require 'squib'
|
2
|
+
|
3
|
+
# This sample demonstrates the built-in layouts for Squib.
|
4
|
+
# Each card demonstrates a different built-in layout.
|
5
|
+
Squib::Deck.new(layout: 'fantasy.yml') do
|
6
|
+
background color: 'white'
|
7
|
+
|
8
|
+
set font: 'Times New Roman,Serif 10.5'
|
9
|
+
hint text: '#333' # show extents of text boxes to demo the layout
|
10
|
+
|
11
|
+
text str: 'fantasy.yml', layout: :title
|
12
|
+
text str: 'ur', layout: :upper_right
|
13
|
+
text str: 'art', layout: :art
|
14
|
+
text str: 'type', layout: :type
|
15
|
+
text str: 'tr', layout: :type_right
|
16
|
+
text str: 'description', layout: :description
|
17
|
+
text str: 'lr', layout: :lower_right
|
18
|
+
text str: 'll', layout: :lower_left
|
19
|
+
text str: 'credits', layout: :copy
|
20
|
+
|
21
|
+
rect layout: :safe
|
22
|
+
rect layout: :cut
|
23
|
+
save_png prefix: 'layouts_builtin_fantasy_'
|
24
|
+
end
|
25
|
+
|
26
|
+
Squib::Deck.new(layout: 'economy.yml') do
|
27
|
+
background color: 'white'
|
28
|
+
|
29
|
+
set font: 'Times New Roman,Serif 10.5'
|
30
|
+
hint text: '#333' # show extents of text boxes to demo the layout
|
31
|
+
|
32
|
+
text str: 'economy.yml', layout: :title
|
33
|
+
text str: 'art', layout: :art
|
34
|
+
text str: 'description', layout: :description
|
35
|
+
text str: 'type', layout: :type
|
36
|
+
text str: 'lr', layout: :lower_right
|
37
|
+
text str: 'll', layout: :lower_left
|
38
|
+
text str: 'credits', layout: :copy
|
39
|
+
|
40
|
+
rect layout: :safe
|
41
|
+
rect layout: :cut
|
42
|
+
save_png prefix: 'layouts_builtin_economy_'
|
43
|
+
end
|
44
|
+
|
45
|
+
Squib::Deck.new(layout: 'hand.yml') do
|
46
|
+
background color: 'white'
|
47
|
+
%w(title bonus1 bonus2 bonus3 bonus4 bonus5 description
|
48
|
+
snark art).each do |icon|
|
49
|
+
text str: icon.capitalize, layout: icon,
|
50
|
+
hint: :red, valign: 'middle', align: 'center'
|
51
|
+
end
|
52
|
+
save_png prefix: 'layouts_builtin_hand_'
|
53
|
+
end
|
54
|
+
|
55
|
+
Squib::Deck.new(layout: 'playing-card.yml') do
|
56
|
+
background color: 'white'
|
57
|
+
text str: "A\u2660", layout: :bonus_ul, font: 'Sans bold 33', hint: :red
|
58
|
+
text str: "A\u2660", layout: :bonus_lr, font: 'Sans bold 33', hint: :red
|
59
|
+
text str: 'artwork here', layout: :art, hint: :red
|
60
|
+
save_png prefix: 'layouts_builtin_playing_card_'
|
61
|
+
end
|
62
|
+
|
63
|
+
Squib::Deck.new(layout: 'tuck_box.yml', width: 2325, height: 1950) do
|
64
|
+
background color: 'white'
|
65
|
+
rect layout: :top_rect
|
66
|
+
rect layout: :bottom_rect
|
67
|
+
rect layout: :right_rect
|
68
|
+
rect layout: :left_rect
|
69
|
+
rect layout: :back_rect
|
70
|
+
rect layout: :front_rect
|
71
|
+
curve layout: :front_curve
|
72
|
+
|
73
|
+
save_png prefix: 'layouts_builtin_tuck_box_'
|
74
|
+
end
|
75
|
+
|
76
|
+
Squib::Deck.new(layout: 'party.yml') do
|
77
|
+
background color: 'white'
|
78
|
+
# hint text: :black # uncomment to see the text box boundaries
|
79
|
+
|
80
|
+
rect layout: :title_box,
|
81
|
+
fill_color: :deep_sky_blue, stroke_width: 0
|
82
|
+
text str: "A SILLY NAME", layout: :title
|
83
|
+
text str: '✔', layout: :type_icon
|
84
|
+
text str: 'TYPE', layout: :type
|
85
|
+
text str: 'A Silly Name', layout: :title_middle
|
86
|
+
rect fill_color: :black, layout: :middle_rect
|
87
|
+
|
88
|
+
str = 'Rule or story text. Be funny ha ha ha this is a party.'
|
89
|
+
text str: str, layout: :rule_top
|
90
|
+
text str: str, layout: :rule_bottom
|
91
|
+
|
92
|
+
text str: 'Tiny text', layout: :copyright
|
93
|
+
|
94
|
+
rect layout: :safe
|
95
|
+
rect layout: :cut
|
96
|
+
save_png prefix: 'layouts_builtin_party_'
|
97
|
+
end
|