squib 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/CHANGELOG.md +24 -3
- data/README.md +4 -3
- data/RELEASE TODO.md +3 -1
- data/docs/_static/css/squibdocs.css +5 -0
- data/docs/conf.py +2 -2
- data/docs/config.rst +5 -0
- data/docs/dsl/ellipse.rst +6 -0
- data/docs/dsl/mm.rst +19 -0
- data/docs/dsl/rect.rst +4 -0
- data/docs/dsl/text.rst +2 -2
- data/docs/dsl/triangle.rst +20 -8
- data/docs/guides/game_icons.rst +4 -0
- data/docs/layouts.rst +55 -0
- data/docs/units.rst +1 -1
- data/lib/squib/api/background.rb +1 -1
- data/lib/squib/api/data.rb +4 -4
- data/lib/squib/api/groups.rb +4 -4
- data/lib/squib/api/image.rb +2 -2
- data/lib/squib/api/save.rb +6 -6
- data/lib/squib/api/settings.rb +4 -4
- data/lib/squib/api/shapes.rb +13 -11
- data/lib/squib/api/text.rb +1 -1
- data/lib/squib/api/text_embed.rb +4 -29
- data/lib/squib/api/units.rb +7 -2
- data/lib/squib/args/arg_loader.rb +2 -14
- data/lib/squib/args/draw.rb +1 -1
- data/lib/squib/args/hand_special.rb +37 -37
- data/lib/squib/args/unit_conversion.rb +2 -0
- data/lib/squib/deck.rb +1 -1
- data/lib/squib/graphics/embedding_utils.rb +28 -0
- data/lib/squib/graphics/shapes.rb +6 -3
- data/lib/squib/graphics/text.rb +49 -52
- data/lib/squib/layout_parser.rb +28 -9
- data/lib/squib/layouts/economy.yml +85 -85
- data/lib/squib/layouts/fantasy.yml +101 -101
- data/lib/squib/layouts/hand.yml +62 -62
- data/lib/squib/layouts/playing-card.yml +35 -35
- data/lib/squib/layouts/tuck_box.yml +45 -45
- data/lib/squib/version.rb +1 -1
- data/samples/custom-config.yml +5 -5
- data/samples/custom_config.rb +18 -18
- data/samples/embed_text.rb +27 -9
- data/samples/layouts/_output/.gitignore +2 -0
- data/samples/{layouts_builtin.rb → layouts/builtin_layouts.rb} +74 -51
- data/samples/{custom-layout.yml → layouts/custom-layout.yml} +0 -0
- data/samples/{custom-layout2.yml → layouts/custom-layout2.yml} +0 -0
- data/samples/layouts/expected_layouts_builtin_economy_00.png +0 -0
- data/samples/layouts/expected_layouts_builtin_fantasy_00.png +0 -0
- data/samples/layouts/expected_layouts_builtin_hand_00.png +0 -0
- data/samples/layouts/expected_layouts_builtin_playing_card_00.png +0 -0
- data/samples/layouts/expected_layouts_builtin_tuck_box_00.png +0 -0
- data/samples/{layouts.rb → layouts/layouts.rb} +0 -1
- data/samples/layouts/shiny-purse.png +0 -0
- data/samples/layouts/spanner.svg +91 -0
- data/samples/offset.svg +71 -71
- data/samples/shapes/_draw_shapes.rb +8 -2
- data/spec/api/api_units_spec.rb +37 -0
- data/spec/args/embed_key_spec.rb +13 -13
- data/spec/args/showcase_special_spec.rb +15 -15
- data/spec/args/unit_conversion_spec.rb +8 -1
- data/spec/data/csv/qty.csv +2 -2
- data/spec/data/csv/qty_named.csv +2 -2
- data/spec/data/csv/with_spaces.csv +2 -2
- data/spec/data/layouts/extends-units-mixed.yml +8 -0
- data/spec/data/layouts/extends-units.yml +8 -0
- data/spec/data/samples/autoscale_font/_autoscale_font.rb.txt +9 -0
- data/spec/data/samples/basic.rb.txt +18 -0
- data/spec/data/samples/cairo_access.rb.txt +6 -0
- data/spec/data/samples/colors/_gradients.rb.txt +6 -0
- data/spec/data/samples/config_text_markup.rb.txt +72 -72
- data/spec/data/samples/data/_csv.rb.txt +12 -0
- data/spec/data/samples/data/_excel.rb.txt +30 -0
- data/spec/data/samples/embed_text.rb.txt +70 -5
- data/spec/data/samples/hello_world.rb.txt +36 -36
- data/spec/data/samples/images/_more_load_images.rb.txt +3 -0
- data/spec/data/samples/ranges.rb.txt +9 -0
- data/spec/data/samples/saves/_hand.rb.txt +48 -0
- data/spec/data/samples/saves/_saves.rb.txt +48 -0
- data/spec/data/samples/saves/_showcase.rb.txt +12 -0
- data/spec/data/samples/shapes/_draw_shapes.rb.txt +41 -0
- data/spec/data/samples/text_options.rb.txt +1155 -1125
- data/spec/data/samples/tgc_proofs.rb.txt +6 -0
- data/spec/data/samples/units.rb.txt +9 -0
- data/spec/graphics/embedding_utils_spec.rb +73 -0
- data/spec/layout_parser_spec.rb +42 -17
- data/spec/spec_helper.rb +5 -1
- data/squib.gemspec +5 -3
- metadata +61 -15
data/lib/squib/layouts/hand.yml
CHANGED
@@ -1,62 +1,62 @@
|
|
1
|
-
# A layout designed for a card to be held in your hand.
|
2
|
-
# * Bonuses align along the left-hand side.
|
3
|
-
# * Title along the top.
|
4
|
-
# * Middle area for artwork,
|
5
|
-
# * Room for a text description
|
6
|
-
# * And some theme-based text (which I like call the "snark")
|
7
|
-
# Along the lines of Race for the Galaxy or 7 Wonders
|
8
|
-
# Based on TheGameCrafter.com's Poker Card, which is 825x1125
|
9
|
-
# Sample usage is found in samples/layouts.rb
|
10
|
-
title:
|
11
|
-
x: 275
|
12
|
-
y: 75
|
13
|
-
width: 475
|
14
|
-
height: 125
|
15
|
-
art:
|
16
|
-
x: 275
|
17
|
-
y: 225
|
18
|
-
width: 475
|
19
|
-
height: 475
|
20
|
-
description:
|
21
|
-
x: 275
|
22
|
-
y: 725
|
23
|
-
width: 475
|
24
|
-
height: 200
|
25
|
-
snark:
|
26
|
-
x: 275
|
27
|
-
y: 950
|
28
|
-
width: 475
|
29
|
-
height: 100
|
30
|
-
bonus1:
|
31
|
-
x: 75
|
32
|
-
y: 75
|
33
|
-
width: 175
|
34
|
-
height: 175
|
35
|
-
bonus2:
|
36
|
-
extends: bonus1
|
37
|
-
y: += 198
|
38
|
-
bonus3:
|
39
|
-
extends: bonus2
|
40
|
-
y: += 198
|
41
|
-
bonus4:
|
42
|
-
extends: bonus3
|
43
|
-
y: += 198
|
44
|
-
bonus5:
|
45
|
-
extends: bonus4
|
46
|
-
y: += 198
|
47
|
-
|
48
|
-
# The "cut line", without rounded corners
|
49
|
-
cut:
|
50
|
-
x: 37.5
|
51
|
-
y: 37.5
|
52
|
-
width: 750
|
53
|
-
height: 1050
|
54
|
-
|
55
|
-
# The "safe zone" as defined by TheGameCrafter poker cards
|
56
|
-
safe:
|
57
|
-
x: 75
|
58
|
-
y: 75
|
59
|
-
width: 675
|
60
|
-
height: 975
|
61
|
-
radius: 16
|
62
|
-
dash: 3 3
|
1
|
+
# A layout designed for a card to be held in your hand.
|
2
|
+
# * Bonuses align along the left-hand side.
|
3
|
+
# * Title along the top.
|
4
|
+
# * Middle area for artwork,
|
5
|
+
# * Room for a text description
|
6
|
+
# * And some theme-based text (which I like call the "snark")
|
7
|
+
# Along the lines of Race for the Galaxy or 7 Wonders
|
8
|
+
# Based on TheGameCrafter.com's Poker Card, which is 825x1125
|
9
|
+
# Sample usage is found in samples/layouts.rb
|
10
|
+
title:
|
11
|
+
x: 275
|
12
|
+
y: 75
|
13
|
+
width: 475
|
14
|
+
height: 125
|
15
|
+
art:
|
16
|
+
x: 275
|
17
|
+
y: 225
|
18
|
+
width: 475
|
19
|
+
height: 475
|
20
|
+
description:
|
21
|
+
x: 275
|
22
|
+
y: 725
|
23
|
+
width: 475
|
24
|
+
height: 200
|
25
|
+
snark:
|
26
|
+
x: 275
|
27
|
+
y: 950
|
28
|
+
width: 475
|
29
|
+
height: 100
|
30
|
+
bonus1:
|
31
|
+
x: 75
|
32
|
+
y: 75
|
33
|
+
width: 175
|
34
|
+
height: 175
|
35
|
+
bonus2:
|
36
|
+
extends: bonus1
|
37
|
+
y: += 198
|
38
|
+
bonus3:
|
39
|
+
extends: bonus2
|
40
|
+
y: += 198
|
41
|
+
bonus4:
|
42
|
+
extends: bonus3
|
43
|
+
y: += 198
|
44
|
+
bonus5:
|
45
|
+
extends: bonus4
|
46
|
+
y: += 198
|
47
|
+
|
48
|
+
# The "cut line", without rounded corners
|
49
|
+
cut:
|
50
|
+
x: 37.5
|
51
|
+
y: 37.5
|
52
|
+
width: 750
|
53
|
+
height: 1050
|
54
|
+
|
55
|
+
# The "safe zone" as defined by TheGameCrafter poker cards
|
56
|
+
safe:
|
57
|
+
x: 75
|
58
|
+
y: 75
|
59
|
+
width: 675
|
60
|
+
height: 975
|
61
|
+
radius: 16
|
62
|
+
dash: 3 3
|
@@ -1,35 +1,35 @@
|
|
1
|
-
# A basic playing card layout with bonuses in the upper-left and lower-right.
|
2
|
-
# The lower-right angle is rotated for text.
|
3
|
-
bonus_ul:
|
4
|
-
x: 75
|
5
|
-
y: 75
|
6
|
-
width: 200
|
7
|
-
height: 200
|
8
|
-
bonus_lr:
|
9
|
-
extends: bonus_ul
|
10
|
-
x: 750
|
11
|
-
y: 1050
|
12
|
-
angle: 3.14159
|
13
|
-
art:
|
14
|
-
x: 150
|
15
|
-
y: 275
|
16
|
-
width: 525
|
17
|
-
height: 575
|
18
|
-
valign: middle
|
19
|
-
align: center
|
20
|
-
|
21
|
-
# The "cut line", without rounded corners
|
22
|
-
cut:
|
23
|
-
x: 37.5
|
24
|
-
y: 37.5
|
25
|
-
width: 750
|
26
|
-
height: 1050
|
27
|
-
|
28
|
-
# The "safe zone" as defined by TheGameCrafter poker cards
|
29
|
-
safe:
|
30
|
-
x: 75
|
31
|
-
y: 75
|
32
|
-
width: 675
|
33
|
-
height: 975
|
34
|
-
radius: 16
|
35
|
-
dash: 3 3
|
1
|
+
# A basic playing card layout with bonuses in the upper-left and lower-right.
|
2
|
+
# The lower-right angle is rotated for text.
|
3
|
+
bonus_ul:
|
4
|
+
x: 75
|
5
|
+
y: 75
|
6
|
+
width: 200
|
7
|
+
height: 200
|
8
|
+
bonus_lr:
|
9
|
+
extends: bonus_ul
|
10
|
+
x: 750
|
11
|
+
y: 1050
|
12
|
+
angle: 3.14159
|
13
|
+
art:
|
14
|
+
x: 150
|
15
|
+
y: 275
|
16
|
+
width: 525
|
17
|
+
height: 575
|
18
|
+
valign: middle
|
19
|
+
align: center
|
20
|
+
|
21
|
+
# The "cut line", without rounded corners
|
22
|
+
cut:
|
23
|
+
x: 37.5
|
24
|
+
y: 37.5
|
25
|
+
width: 750
|
26
|
+
height: 1050
|
27
|
+
|
28
|
+
# The "safe zone" as defined by TheGameCrafter poker cards
|
29
|
+
safe:
|
30
|
+
x: 75
|
31
|
+
y: 75
|
32
|
+
width: 675
|
33
|
+
height: 975
|
34
|
+
radius: 16
|
35
|
+
dash: 3 3
|
@@ -1,46 +1,46 @@
|
|
1
|
-
## Rectangles correspond to the "safe zones" as defined by TheGameCrafter for tuck boxes 2325x1950 pixels
|
2
|
-
top_rect:
|
3
|
-
x: 313
|
4
|
-
y: 198
|
5
|
-
width: 688
|
6
|
-
height: 167
|
7
|
-
|
8
|
-
bottom_rect:
|
9
|
-
x: 313
|
10
|
-
y: 1526
|
11
|
-
width: 688
|
12
|
-
height: 167
|
13
|
-
|
14
|
-
right_rect:
|
15
|
-
x: 77
|
16
|
-
y: 466
|
17
|
-
width: 164
|
18
|
-
height: 988
|
19
|
-
|
20
|
-
left_rect:
|
21
|
-
x: 1080
|
22
|
-
y: 466
|
23
|
-
width: 164
|
24
|
-
height: 988
|
25
|
-
|
26
|
-
back_rect:
|
27
|
-
x: 313
|
28
|
-
y: 466
|
29
|
-
width: 688
|
30
|
-
height: 989
|
31
|
-
|
32
|
-
front_rect:
|
33
|
-
x: 1322
|
34
|
-
y: 466
|
35
|
-
width: 688
|
36
|
-
height: 989
|
37
|
-
|
38
|
-
front_curve:
|
39
|
-
x1: 1550
|
40
|
-
y1: 466
|
41
|
-
x2: 1765
|
42
|
-
y2: 466
|
43
|
-
cx1: 1575
|
44
|
-
cy1: 565
|
45
|
-
cx2: 1740
|
1
|
+
## Rectangles correspond to the "safe zones" as defined by TheGameCrafter for tuck boxes 2325x1950 pixels
|
2
|
+
top_rect:
|
3
|
+
x: 313
|
4
|
+
y: 198
|
5
|
+
width: 688
|
6
|
+
height: 167
|
7
|
+
|
8
|
+
bottom_rect:
|
9
|
+
x: 313
|
10
|
+
y: 1526
|
11
|
+
width: 688
|
12
|
+
height: 167
|
13
|
+
|
14
|
+
right_rect:
|
15
|
+
x: 77
|
16
|
+
y: 466
|
17
|
+
width: 164
|
18
|
+
height: 988
|
19
|
+
|
20
|
+
left_rect:
|
21
|
+
x: 1080
|
22
|
+
y: 466
|
23
|
+
width: 164
|
24
|
+
height: 988
|
25
|
+
|
26
|
+
back_rect:
|
27
|
+
x: 313
|
28
|
+
y: 466
|
29
|
+
width: 688
|
30
|
+
height: 989
|
31
|
+
|
32
|
+
front_rect:
|
33
|
+
x: 1322
|
34
|
+
y: 466
|
35
|
+
width: 688
|
36
|
+
height: 989
|
37
|
+
|
38
|
+
front_curve:
|
39
|
+
x1: 1550
|
40
|
+
y1: 466
|
41
|
+
x2: 1765
|
42
|
+
y2: 466
|
43
|
+
cx1: 1575
|
44
|
+
cy1: 565
|
45
|
+
cx2: 1740
|
46
46
|
cy2: 565
|
data/lib/squib/version.rb
CHANGED
data/samples/custom-config.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
progress_bars: true
|
2
|
-
text_hint: '#FF0000'
|
3
|
-
custom_colors:
|
4
|
-
foo: '#ccc'
|
5
|
-
img_dir: customconfig-imgdir
|
1
|
+
progress_bars: true
|
2
|
+
text_hint: '#FF0000'
|
3
|
+
custom_colors:
|
4
|
+
foo: '#ccc'
|
5
|
+
img_dir: customconfig-imgdir
|
data/samples/custom_config.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
require 'squib'
|
2
|
-
|
3
|
-
Squib::Deck.new(config: 'custom-config.yml') do
|
4
|
-
# Custom color defined in our config
|
5
|
-
background color: :foo
|
6
|
-
|
7
|
-
# Hints can be turned on in the config file
|
8
|
-
text str: 'The Title', x: 0, y: 78, width: 825,
|
9
|
-
font: 'Arial 72', align: :center
|
10
|
-
|
11
|
-
# Progress bars are shown for these commands
|
12
|
-
# And images are taken from img_dir, not the cwd.
|
13
|
-
png file: 'shiny-purse2.png', x: 620, y: 75
|
14
|
-
svg file: 'spanner2.svg', x: 620, y: 218
|
15
|
-
save_png prefix: 'custom-config_'
|
16
|
-
save_pdf file: 'custom-config-out.pdf'
|
17
|
-
|
18
|
-
end
|
1
|
+
require 'squib'
|
2
|
+
|
3
|
+
Squib::Deck.new(config: 'custom-config.yml') do
|
4
|
+
# Custom color defined in our config
|
5
|
+
background color: :foo
|
6
|
+
|
7
|
+
# Hints can be turned on in the config file
|
8
|
+
text str: 'The Title', x: 0, y: 78, width: 825,
|
9
|
+
font: 'Arial 72', align: :center
|
10
|
+
|
11
|
+
# Progress bars are shown for these commands
|
12
|
+
# And images are taken from img_dir, not the cwd.
|
13
|
+
png file: 'shiny-purse2.png', x: 620, y: 75
|
14
|
+
svg file: 'spanner2.svg', x: 620, y: 218
|
15
|
+
save_png prefix: 'custom-config_'
|
16
|
+
save_pdf file: 'custom-config-out.pdf'
|
17
|
+
|
18
|
+
end
|
data/samples/embed_text.rb
CHANGED
@@ -8,10 +8,9 @@ Squib::Deck.new do
|
|
8
8
|
text(str: embed_text, font: 'Sans 21',
|
9
9
|
x: 0, y: 0, width: 180, hint: :red,
|
10
10
|
align: :left, ellipsize: false, justify: false) do |embed|
|
11
|
-
|
12
|
-
embed.svg key: ':
|
13
|
-
embed.
|
14
|
-
embed.png key: ':purse:', width: 28, height: 28, dx: 0, dy: 4, file: 'shiny-purse.png'
|
11
|
+
embed.svg key: ':tool:', width: 28, height: 28, file: 'spanner.svg'
|
12
|
+
embed.svg key: ':health:', width: 28, height: 28, file: 'glass-heart.svg'
|
13
|
+
embed.png key: ':purse:', width: 28, height: 28, file: 'shiny-purse.png'
|
15
14
|
end
|
16
15
|
|
17
16
|
embed_text = 'Middle align: Take 1 :tool: and gain 2 :health:. Take 2 :tool: and gain 3 :purse:'
|
@@ -32,11 +31,11 @@ Squib::Deck.new do
|
|
32
31
|
embed.png key: ':purse:', width: 28, height: 28, file: 'shiny-purse.png'
|
33
32
|
end
|
34
33
|
|
35
|
-
embed_text = '
|
36
|
-
text(str: embed_text, font: 'Sans
|
37
|
-
x: 600, y: 0, width: 180, height: 300,
|
34
|
+
embed_text = 'Yes, this wraps strangely. We are trying to determine the cause. These are 1 :tool::tool::tool: and these are multiple :tool::tool: :tool::tool:'
|
35
|
+
text(str: embed_text, font: 'Sans 18',
|
36
|
+
x: 600, y: 0, width: 180, height: 300, wrap: :word_char,
|
38
37
|
align: :left, ellipsize: false, justify: false, hint: :cyan) do |embed|
|
39
|
-
embed.svg key: ':tool:',
|
38
|
+
embed.svg key: ':tool:', width: 28, height: 28, file: 'spanner.svg'
|
40
39
|
end
|
41
40
|
|
42
41
|
embed_text = ':tool:Justify will :tool: work too, and :purse: with more words just for fun'
|
@@ -87,13 +86,32 @@ Squib::Deck.new do
|
|
87
86
|
|
88
87
|
embed_text = ":tool: Death to Nemesis bug 103!! :purse:"
|
89
88
|
text(str: embed_text, font: 'Sans Bold 24', stroke_width: 2,
|
90
|
-
color: :red, stroke_color: :blue, dash: '3 3', align: :
|
89
|
+
color: :red, stroke_color: :blue, dash: '3 3', align: :left,
|
91
90
|
valign: :middle, x: 0, y: 700, width: 380, height: 150,
|
92
91
|
hint: :magenta) do |embed|
|
93
92
|
embed.svg key: ':tool:', file: 'spanner.svg', width: 32, height: 32
|
94
93
|
embed.png key: ':purse:', file: 'shiny-purse.png', width: 32, height: 32
|
95
94
|
end
|
96
95
|
|
96
|
+
embed_text = 'You can adjust the icon with dx and dy. Normal: :tool: Adjusted: :heart:'
|
97
|
+
text(str: embed_text, font: 'Sans 18', x: 400, y: 640, width: 180,
|
98
|
+
height: 300, hint: :magenta) do |embed|
|
99
|
+
embed.svg key: ':tool:', width: 28, height: 28, file: 'spanner.svg'
|
100
|
+
embed.svg key: ':heart:', width: 28, height: 28, dx: 10, dy: 10,
|
101
|
+
file: 'glass-heart.svg'
|
102
|
+
end
|
103
|
+
|
104
|
+
embed_text = "Native sizes work too\n:tool:\n\n\n\n\n\n:shiny-purse:\n\n\n\n\n\n:tool2:"
|
105
|
+
text(str: embed_text, font: 'Sans 18', x: 600, y: 640, width: 180,
|
106
|
+
height: 475, hint: :magenta) do |embed|
|
107
|
+
embed.svg key: ':tool:', width: :native, height: :native,
|
108
|
+
file: 'spanner.svg'
|
109
|
+
embed.svg key: ':tool2:', width: :native, height: :native,
|
110
|
+
data: File.open('spanner.svg','r').read
|
111
|
+
embed.png key: ':shiny-purse:', width: :native, height: :native,
|
112
|
+
file: 'shiny-purse.png'
|
113
|
+
end
|
114
|
+
|
97
115
|
save_png prefix: 'embed_'
|
98
116
|
end
|
99
117
|
|
@@ -1,51 +1,74 @@
|
|
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 32'
|
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 32'
|
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
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
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 32'
|
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 32'
|
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 100', hint: :red
|
58
|
+
text str: "A\u2660", layout: :bonus_lr, font: 'Sans bold 100', 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
|