squib 0.14.1 → 0.14.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +41 -41
  3. data/.travis.yml +19 -19
  4. data/CHANGELOG.md +357 -340
  5. data/CONTRIBUTING.md +40 -40
  6. data/Gemfile +2 -2
  7. data/LICENSE.txt +22 -22
  8. data/README.md +121 -121
  9. data/RELEASE TODO.md +21 -21
  10. data/Rakefile +48 -48
  11. data/appveyor.yml +24 -24
  12. data/bin/squib +4 -4
  13. data/lib/squib.rb +32 -32
  14. data/lib/squib/api/background.rb +15 -15
  15. data/lib/squib/api/data.rb +137 -137
  16. data/lib/squib/api/groups.rb +54 -54
  17. data/lib/squib/api/image.rb +49 -49
  18. data/lib/squib/api/save.rb +83 -83
  19. data/lib/squib/api/settings.rb +21 -21
  20. data/lib/squib/api/shapes.rb +124 -124
  21. data/lib/squib/api/text.rb +25 -25
  22. data/lib/squib/api/text_embed.rb +71 -71
  23. data/lib/squib/api/units.rb +27 -27
  24. data/lib/squib/args/arg_loader.rb +126 -126
  25. data/lib/squib/args/box.rb +55 -55
  26. data/lib/squib/args/card_range.rb +32 -32
  27. data/lib/squib/args/color_validator.rb +12 -12
  28. data/lib/squib/args/coords.rb +35 -35
  29. data/lib/squib/args/csv_opts.rb +25 -25
  30. data/lib/squib/args/dir_validator.rb +16 -16
  31. data/lib/squib/args/draw.rb +92 -92
  32. data/lib/squib/args/embed_adjust.rb +25 -25
  33. data/lib/squib/args/embed_key.rb +17 -17
  34. data/lib/squib/args/hand_special.rb +37 -37
  35. data/lib/squib/args/import.rb +40 -40
  36. data/lib/squib/args/input_file.rb +37 -37
  37. data/lib/squib/args/paint.rb +44 -44
  38. data/lib/squib/args/paragraph.rb +116 -116
  39. data/lib/squib/args/save_batch.rb +63 -63
  40. data/lib/squib/args/scale_box.rb +53 -53
  41. data/lib/squib/args/sheet.rb +172 -172
  42. data/lib/squib/args/showcase_special.rb +38 -38
  43. data/lib/squib/args/sprue_file.rb +44 -44
  44. data/lib/squib/args/svg_special.rb +37 -37
  45. data/lib/squib/args/transform.rb +61 -61
  46. data/lib/squib/args/typographer.rb +119 -119
  47. data/lib/squib/args/unit_conversion.rb +29 -29
  48. data/lib/squib/builtin/layouts/economy.yml +85 -85
  49. data/lib/squib/builtin/layouts/fantasy.yml +101 -101
  50. data/lib/squib/builtin/layouts/hand.yml +62 -62
  51. data/lib/squib/builtin/layouts/party.yml +94 -94
  52. data/lib/squib/builtin/layouts/playing-card.yml +35 -35
  53. data/lib/squib/builtin/layouts/tuck_box.yml +46 -46
  54. data/lib/squib/builtin/projects/advanced/.gitignore +4 -4
  55. data/lib/squib/builtin/projects/advanced/ABOUT.md +19 -19
  56. data/lib/squib/builtin/projects/advanced/Gemfile +11 -11
  57. data/lib/squib/builtin/projects/advanced/Guardfile +21 -21
  58. data/lib/squib/builtin/projects/advanced/IDEAS.md +22 -22
  59. data/lib/squib/builtin/projects/advanced/PLAYTESTING.md +26 -26
  60. data/lib/squib/builtin/projects/advanced/Rakefile +27 -27
  61. data/lib/squib/builtin/projects/advanced/config.yml +49 -49
  62. data/lib/squib/builtin/projects/advanced/docs/PNP NOTES.md +3 -3
  63. data/lib/squib/builtin/projects/advanced/docs/RULES.md +21 -21
  64. data/lib/squib/builtin/projects/advanced/img/example.svg +60 -60
  65. data/lib/squib/builtin/projects/advanced/layouts/deck.yml +27 -27
  66. data/lib/squib/builtin/projects/advanced/src/deck.rb +34 -34
  67. data/lib/squib/builtin/projects/advanced/src/version.rb +3 -3
  68. data/lib/squib/builtin/projects/basic/.gitignore +4 -4
  69. data/lib/squib/builtin/projects/basic/ABOUT.md +19 -19
  70. data/lib/squib/builtin/projects/basic/Gemfile +3 -3
  71. data/lib/squib/builtin/projects/basic/IDEAS.md +22 -22
  72. data/lib/squib/builtin/projects/basic/PLAYTESTING.md +26 -26
  73. data/lib/squib/builtin/projects/basic/PNP NOTES.md +3 -3
  74. data/lib/squib/builtin/projects/basic/RULES.md +21 -21
  75. data/lib/squib/builtin/projects/basic/Rakefile +7 -7
  76. data/lib/squib/builtin/projects/basic/config.yml +49 -49
  77. data/lib/squib/builtin/projects/basic/deck.rb +6 -6
  78. data/lib/squib/builtin/sprues/a4_euro_card.yml +42 -42
  79. data/lib/squib/builtin/sprues/a4_poker_card_8up.yml +40 -40
  80. data/lib/squib/builtin/sprues/a4_poker_card_9up.yml +42 -42
  81. data/lib/squib/builtin/sprues/a4_usa_card.yml +42 -42
  82. data/lib/squib/builtin/sprues/drivethrucards_1up.yml +10 -0
  83. data/lib/squib/builtin/sprues/letter_poker_card_9up.yml +25 -25
  84. data/lib/squib/builtin/sprues/letter_poker_foldable_8up.yml +52 -52
  85. data/lib/squib/builtin/sprues/printplaygames_18up.yml +68 -0
  86. data/lib/squib/card.rb +75 -74
  87. data/lib/squib/commands/cli.rb +39 -39
  88. data/lib/squib/commands/data/template_option.rb +109 -109
  89. data/lib/squib/commands/make_sprue.rb +275 -275
  90. data/lib/squib/commands/new.rb +77 -77
  91. data/lib/squib/conf.rb +139 -139
  92. data/lib/squib/constants.rb +17 -17
  93. data/lib/squib/deck.rb +116 -116
  94. data/lib/squib/graphics/background.rb +14 -14
  95. data/lib/squib/graphics/cairo_context_wrapper.rb +113 -113
  96. data/lib/squib/graphics/embedding_utils.rb +28 -28
  97. data/lib/squib/graphics/gradient_regex.rb +47 -47
  98. data/lib/squib/graphics/hand.rb +42 -42
  99. data/lib/squib/graphics/image.rb +108 -108
  100. data/lib/squib/graphics/save_doc.rb +61 -61
  101. data/lib/squib/graphics/save_images.rb +52 -52
  102. data/lib/squib/graphics/save_pdf.rb +90 -90
  103. data/lib/squib/graphics/save_sprue.rb +204 -205
  104. data/lib/squib/graphics/shapes.rb +143 -143
  105. data/lib/squib/graphics/showcase.rb +85 -85
  106. data/lib/squib/graphics/text.rb +174 -174
  107. data/lib/squib/import/data_frame.rb +108 -108
  108. data/lib/squib/layout_parser.rb +138 -126
  109. data/lib/squib/progress.rb +38 -38
  110. data/lib/squib/sample_helpers.rb +34 -34
  111. data/lib/squib/sprues/crop_line.rb +28 -28
  112. data/lib/squib/sprues/crop_line_dash.rb +35 -35
  113. data/lib/squib/sprues/invalid_sprue_definition.rb +9 -9
  114. data/lib/squib/sprues/sprue.rb +203 -203
  115. data/lib/squib/sprues/sprue_schema.rb +48 -48
  116. data/lib/squib/version.rb +10 -10
  117. data/samples/autoscale_font/_autoscale_font.rb +29 -29
  118. data/samples/backend/_backend.rb +26 -26
  119. data/samples/basic.rb +19 -19
  120. data/samples/build_groups/build_groups.rb +36 -36
  121. data/samples/colors/_colors.rb +38 -38
  122. data/samples/colors/_gradients.rb +34 -34
  123. data/samples/config/config_text_markup.rb +20 -20
  124. data/samples/config/custom_config.rb +18 -18
  125. data/samples/data/_csv.rb +33 -33
  126. data/samples/data/_excel.rb +55 -55
  127. data/samples/data/_yaml.rb +12 -12
  128. data/samples/hello_world.rb +6 -6
  129. data/samples/images/_cairo_access.rb +39 -39
  130. data/samples/images/_images.rb +104 -104
  131. data/samples/images/_more_load_images.rb +102 -102
  132. data/samples/intro/01_hello.rb +8 -8
  133. data/samples/intro/02_options.rb +14 -14
  134. data/samples/intro/03_layout.rb +11 -11
  135. data/samples/intro/04_arrays.rb +15 -15
  136. data/samples/intro/05_excel.rb +14 -14
  137. data/samples/layouts/builtin_layouts.rb +97 -97
  138. data/samples/layouts/layouts.rb +71 -71
  139. data/samples/project/src/characters.rb +8 -8
  140. data/samples/project/src/skills.rb +7 -7
  141. data/samples/proofs/_tgc_proofs.rb +16 -16
  142. data/samples/ranges/_ranges.rb +64 -64
  143. data/samples/saves/_hand.rb +23 -23
  144. data/samples/saves/_portrait_landscape.rb +23 -23
  145. data/samples/saves/_save_pdf.rb +29 -29
  146. data/samples/saves/_saves.rb +51 -51
  147. data/samples/saves/_showcase.rb +25 -25
  148. data/samples/shapes/_draw_shapes.rb +60 -58
  149. data/samples/shapes/_proofs.rb +22 -22
  150. data/samples/sprues/_advanced_sprues.rb +24 -24
  151. data/samples/sprues/_builtin_sprues.rb +21 -19
  152. data/samples/sprues/_fold_sheet.rb +27 -27
  153. data/samples/sprues/_hex_tiles.rb +15 -15
  154. data/samples/sprues/_mints.rb +11 -11
  155. data/samples/sprues/_sprue_example.rb +11 -11
  156. data/samples/text/_embed_text.rb +128 -128
  157. data/samples/text/_text.rb +47 -47
  158. data/samples/text/_text_options.rb +102 -102
  159. data/samples/text/bug134.rb +14 -14
  160. data/samples/units/_units.rb +32 -32
  161. data/squib.gemspec +52 -51
  162. metadata +66 -50
@@ -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: '' # <-- 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: '' # <-- 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,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
@@ -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
@@ -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
@@ -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
@@ -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