squib 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/.travis.yml +5 -3
  4. data/CHANGELOG.md +24 -2
  5. data/README.md +2 -4
  6. data/RELEASE TODO.md +1 -0
  7. data/Rakefile +1 -1
  8. data/docs/arrays.rst +5 -2
  9. data/docs/build_groups.rst +15 -17
  10. data/docs/colors.rst +29 -3
  11. data/docs/conf.py +3 -3
  12. data/docs/config.rst +14 -1
  13. data/docs/data.rst +8 -4
  14. data/docs/dsl/configure.rst +18 -0
  15. data/docs/dsl/csv.rst +19 -0
  16. data/docs/dsl/data_frame.rst +85 -0
  17. data/docs/dsl/disable_build.rst +1 -4
  18. data/docs/dsl/disable_build_globally.rst +46 -0
  19. data/docs/dsl/enable_build.rst +1 -1
  20. data/docs/dsl/enable_build_globally.rst +44 -0
  21. data/docs/dsl/save_pdf.rst +44 -3
  22. data/docs/dsl/showcase.rst +11 -0
  23. data/docs/dsl/text.rst +3 -5
  24. data/docs/dsl/xlsx.rst +6 -0
  25. data/docs/guides/game_icons.rst +124 -4
  26. data/docs/guides/getting-started/part_1_zero_to_game.rst +4 -3
  27. data/docs/guides/getting-started/part_2_iconography.rst +92 -16
  28. data/docs/guides/getting-started/part_3_workflows.rst +43 -1
  29. data/docs/guides/getting-started/part_4_ruby_power.rst +18 -0
  30. data/docs/guides/git.rst +2 -1
  31. data/docs/guides/guard.rst +84 -0
  32. data/docs/guides/hello_world.rst +63 -4
  33. data/docs/guides/projects.rst +35 -0
  34. data/docs/install.rst +3 -1
  35. data/docs/layouts.rst +3 -3
  36. data/docs/learning.rst +3 -1
  37. data/docs/parameters.rst +14 -6
  38. data/docs/text_feature.rst +42 -13
  39. data/docs/units.rst +9 -1
  40. data/lib/squib/api/data.rb +6 -5
  41. data/lib/squib/api/groups.rb +14 -7
  42. data/lib/squib/api/save.rb +2 -1
  43. data/lib/squib/args/sheet.rb +57 -2
  44. data/lib/squib/card.rb +8 -0
  45. data/lib/squib/conf.rb +9 -1
  46. data/lib/squib/deck.rb +2 -1
  47. data/lib/squib/graphics/save_doc.rb +0 -45
  48. data/lib/squib/graphics/save_pdf.rb +85 -0
  49. data/lib/squib/graphics/showcase.rb +1 -1
  50. data/lib/squib/import/data_frame.rb +108 -0
  51. data/lib/squib/version.rb +1 -1
  52. data/samples/autoscale_font/.gitignore +2 -0
  53. data/samples/autoscale_font/card_00_expected.png +0 -0
  54. data/samples/backend/.gitignore +1 -0
  55. data/samples/backend/_backend-config.yml +5 -0
  56. data/samples/backend/_backend.rb +2 -9
  57. data/samples/backend/backend_00_expected.png +0 -0
  58. data/samples/backend/backend_01_expected.png +0 -0
  59. data/samples/backend/backend_vectorized_expected.pdf +0 -0
  60. data/samples/backend/backend_vectors_00_expected.svg +84 -0
  61. data/samples/backend/backend_vectors_01_expected.svg +84 -0
  62. data/samples/backend/shiny-purse.png +0 -0
  63. data/samples/backend/showcase_expected.png +0 -0
  64. data/samples/backend/spanner.svg +91 -0
  65. data/samples/build_groups/.gitignore +1 -0
  66. data/samples/build_groups/Rakefile +25 -0
  67. data/samples/colors/.gitignore +1 -0
  68. data/samples/colors/color_constants_00_expected.png +0 -0
  69. data/samples/colors/colors_00_expected.png +0 -0
  70. data/samples/colors/gradient_00_expected.png +0 -0
  71. data/samples/data/.gitignore +1 -0
  72. data/samples/data/explode_quantities.xlsx +0 -0
  73. data/samples/data/quantity_explosion.csv +3 -0
  74. data/samples/data/sample.csv +3 -0
  75. data/samples/data/sample.xlsx +0 -0
  76. data/samples/data/sample_csv_00_expected.png +0 -0
  77. data/samples/data/sample_csv_01_expected.png +0 -0
  78. data/samples/data/sample_csv_qty_00_expected.png +0 -0
  79. data/samples/data/sample_excel_00_expected.png +0 -0
  80. data/samples/data/sample_excel_01_expected.png +0 -0
  81. data/samples/data/sample_excel_02_expected.png +0 -0
  82. data/samples/data/sample_excel_resources_00_expected.png +0 -0
  83. data/samples/data/sample_excel_resources_01_expected.png +0 -0
  84. data/samples/data/sample_xlsx_qty_00_expected.png +0 -0
  85. data/samples/images/.gitignore +8 -0
  86. data/samples/images/_images_00_expected.png +0 -0
  87. data/samples/images/angler-fish.png +0 -0
  88. data/samples/images/ball.png +0 -0
  89. data/samples/images/glass-heart.svg +52 -0
  90. data/samples/images/grit.png +0 -0
  91. data/samples/images/offset.svg +85 -0
  92. data/samples/images/robot-golem.svg +1 -0
  93. data/samples/images/shiny-purse.png +0 -0
  94. data/samples/images/spanner.svg +91 -0
  95. data/samples/images/sprites.png +0 -0
  96. data/samples/images/with-alpha.png +0 -0
  97. data/samples/intro/.gitignore +2 -0
  98. data/samples/intro/auto-repair.svg +1 -0
  99. data/samples/intro/crawling.svg +1 -0
  100. data/samples/intro/data.xlsx +0 -0
  101. data/samples/intro/humans.svg +1 -0
  102. data/samples/intro/ninja-mask.svg +1 -0
  103. data/samples/intro/part1_00_expected.png +0 -0
  104. data/samples/intro/part2_00_expected.png +0 -0
  105. data/samples/intro/part3_00_expected.png +0 -0
  106. data/samples/intro/part3_layout.yml +34 -0
  107. data/samples/intro/part4_00_expected.png +0 -0
  108. data/samples/intro/part4_01_expected.png +0 -0
  109. data/samples/intro/part5_00_expected.png +0 -0
  110. data/samples/intro/part5_01_expected.png +0 -0
  111. data/samples/intro/part5_02_expected.png +0 -0
  112. data/samples/intro/part5_03_expected.png +0 -0
  113. data/samples/intro/part5_hand_expected.png +0 -0
  114. data/samples/intro/part5_showcase_expected.png +0 -0
  115. data/samples/intro/pirate-skull.svg +1 -0
  116. data/samples/intro/robot-golem.svg +1 -0
  117. data/samples/project/Gemfile +6 -0
  118. data/samples/project/Guardfile +18 -0
  119. data/samples/project/Rakefile +25 -0
  120. data/samples/project/bw/robot-golem.svg +53 -0
  121. data/samples/project/color/robot-golem.svg +1 -0
  122. data/samples/project/config.yml +2 -0
  123. data/samples/project/layouts/characters.yml +3 -0
  124. data/samples/project/layouts/skills.yml +3 -0
  125. data/samples/project/src/characters.rb +8 -0
  126. data/samples/project/src/skills.rb +7 -0
  127. data/samples/{ranges.rb → ranges/_ranges.rb} +0 -0
  128. data/samples/ranges/glass-heart.svg +52 -0
  129. data/samples/ranges/ranges_00_expected.png +0 -0
  130. data/samples/saves/.gitignore +1 -0
  131. data/samples/saves/_save_pdf.rb +18 -0
  132. data/samples/saves/hand_expected.png +0 -0
  133. data/samples/saves/hand_pretty_expected.png +0 -0
  134. data/samples/saves/save-pdf-small_expected.pdf +0 -0
  135. data/samples/saves/save-pdf_expected.pdf +0 -0
  136. data/samples/saves/save_png_00_expected.png +0 -0
  137. data/samples/saves/save_png_trimmed_00_expected.png +0 -0
  138. data/samples/saves/save_sheet_00_expected.png +0 -0
  139. data/samples/saves/save_sheet_01_expected.png +0 -0
  140. data/samples/saves/save_sheet_range_00_expected.png +0 -0
  141. data/samples/saves/save_sheet_range_01_expected.png +0 -0
  142. data/samples/saves/save_single_sheet_00_expected.png +0 -0
  143. data/samples/saves/saves_notrim_01_expected.png +0 -0
  144. data/samples/saves/showcase2_expected.png +0 -0
  145. data/samples/saves/showcase_expected.png +0 -0
  146. data/samples/saves/showcase_individual_00_expected.png +0 -0
  147. data/samples/saves/showcase_individual_01_expected.png +0 -0
  148. data/samples/saves/showcase_individual_02_expected.png +0 -0
  149. data/samples/saves/showcase_individual_03_expected.png +0 -0
  150. data/samples/saves/spanner.svg +91 -0
  151. data/samples/shapes/.gitignore +1 -0
  152. data/samples/shapes/shape_00_expected.png +0 -0
  153. data/samples/text/.gitignore +2 -0
  154. data/samples/text/README.md +1 -0
  155. data/samples/text/_text_00_expected.png +0 -0
  156. data/samples/text/config.yml +2 -0
  157. data/samples/units/_units.rb +32 -0
  158. data/samples/units/units_00_expected.png +0 -0
  159. data/samples/units/using_units.yml +10 -0
  160. data/spec/api/api_data_spec.rb +18 -18
  161. data/spec/api/api_groups_spec.rb +49 -0
  162. data/spec/args/sheet_spec.rb +24 -2
  163. data/spec/conf_spec.rb +8 -0
  164. data/spec/data/conf/basic.yml +1 -0
  165. data/spec/data/samples/autoscale_font/_autoscale_font.rb.txt +3 -0
  166. data/spec/data/samples/basic.rb.txt +3 -0
  167. data/spec/data/samples/cairo_access.rb.txt +2 -0
  168. data/spec/data/samples/colors/_gradients.rb.txt +1 -0
  169. data/spec/data/samples/config_text_markup.rb.txt +2 -0
  170. data/spec/data/samples/custom_config.rb.txt +1 -0
  171. data/spec/data/samples/data/_csv.rb.txt +6 -0
  172. data/spec/data/samples/data/_excel.rb.txt +13 -0
  173. data/spec/data/samples/embed_text.rb.txt +4 -0
  174. data/spec/data/samples/hello_world.rb.txt +2 -0
  175. data/spec/data/samples/images/_more_load_images.rb.txt +1 -0
  176. data/spec/data/samples/{ranges.rb.txt → ranges/_ranges.rb.txt} +3 -0
  177. data/spec/data/samples/saves/_hand.rb.txt +8 -0
  178. data/spec/data/samples/saves/_portrait_landscape.rb.txt +2 -0
  179. data/spec/data/samples/saves/_save_pdf.rb.txt +1505 -449
  180. data/spec/data/samples/saves/_saves.rb.txt +16 -0
  181. data/spec/data/samples/saves/_showcase.rb.txt +4 -0
  182. data/spec/data/samples/shapes/_draw_shapes.rb.txt +1 -0
  183. data/spec/data/samples/text_options.rb.txt +3 -0
  184. data/spec/data/samples/tgc_proofs.rb.txt +1 -0
  185. data/spec/data/samples/{units.rb.txt → units/_units.rb.txt} +20 -15
  186. data/spec/deck_spec.rb +7 -0
  187. data/spec/graphics/graphics_save_doc_spec.rb +2 -1
  188. data/spec/import/data_frame_spec.rb +251 -0
  189. data/spec/samples/run_samples_spec.rb +1 -1
  190. data/spec/samples/samples_regression_spec.rb +3 -2
  191. data/squib.gemspec +6 -6
  192. metadata +144 -24
  193. data/.gitmodules +0 -36
  194. data/samples/units.rb +0 -28
@@ -1,4 +1,46 @@
1
1
  The Squib Way pt 3: Workflows
2
2
  ===============================
3
3
 
4
- To be written.
4
+ .. warning::
5
+
6
+ Under construction
7
+
8
+ As we mentioned at the end :doc:`/guides/getting-started/part_2_iconography`, we've pretty much got most of what we need to prototype a game through completion. From here on out, the :doc:`/dsl/index` will be your best resource for getting things done. Everything from here one out is optional, but useful.
9
+
10
+ But, as you explore Squib's features and work away at your games, you'll pick up a few tricks and conventions to follow that makes your time easier. After years of developing games with Squib, here are some helpful ways of improving your workflow.
11
+
12
+ Improving your workflow comes down to a few principles:
13
+
14
+ * **Automate what will be tedious**. There's a balance here. What do you anticipate will change about your game as you develop it? What do you anticipate will *not* change? If you automate *everything*, you will probably spend more time on automating than game development. If you don't automate anything, you'll be re-making every component whenever you make a game design change.
15
+ * **Focus on one thing only: visual, game, or build**. Cognitively, you'll have an easier time when you focus on one thing and one thing only. The more loose ends you need to keep in your head, the more mistakes you'll make.
16
+
17
+ Additionally, improving your workflow can help you pivot to other tasks you might need for polishing your game later on, such as:
18
+
19
+ * Quickly building one card at a time to reduce the time between builds
20
+ * Maintaining a printer-friendly, black-and-white version of your game in tandem with a color version
21
+ * Building annotated figures for your rulebook
22
+ * Rolling back to older versions of your game
23
+
24
+ Organizing Your Project
25
+ -----------------------
26
+
27
+ Most games involve build multiple decks. Initially, you might think to put all of your Ruby code inside one file. That can work, but it gets slow and cumbersome. Instead, I like to organize my code into separate source code files inside of a `src` directory.
28
+
29
+ Keeping your artwork in its own folder will also make it easier for you to find what you need later on. Also, using `img_dir` parameter in the `config.yml` will let you switch the entire image directory over in one
30
+
31
+ Using a Rakefile
32
+ ----------------
33
+
34
+
35
+
36
+ * Setting up rake tasks
37
+ * Advanced project layout: splitting out decks into different files
38
+ * Testing individual files (build groups, ranges, id-lookup)
39
+ * Marketing images (using output as images, dependency in Rakefile)
40
+ * Rulebook figures (build groups, annotate after saving)
41
+ * Switch from built-in layouts to your own layout
42
+ * Launch what you need with Launchy
43
+ * Auto-building with Guard
44
+ * Maintaining color and black-and-white builds (build groups, multiple layout files). Changing build sessions within Guard
45
+ * Configuring different things for each build
46
+ * Git (save to json, tagging, rolling back, Gemfile.lock)
@@ -0,0 +1,18 @@
1
+ The Squib Way pt 4: Ruby Power!
2
+ ===============================
3
+
4
+ .. warning::
5
+
6
+ To be written.
7
+
8
+
9
+ This part is about cataloging some powerful things you can do if you're willing to write some Ruby.
10
+
11
+ * Modifying XML at runtime (e.g. convert to black-and-white from color)
12
+ * Using Travis to build and then post to something like Dropbox
13
+ * Scaling the size of text based on its contents
14
+ * Advanced Array techniques: inject, transpose, map, join (use the pre-req example)
15
+ * Building newlines yourself (i.e. with your own placeholder like "%n" in Your Last Heist)
16
+ * Summarization card backs for Your Last Heist as an example
17
+ * "Lacks" string for Your Last Heist
18
+ * Rules doc written in Markdown
@@ -1,12 +1,13 @@
1
1
  Squib + Git
2
2
  ===========
3
3
 
4
- .. note::
4
+ .. warning::
5
5
 
6
6
  To be written
7
7
 
8
8
 
9
9
  Ideas:
10
+ * .gitignore
10
11
  * Workflow
11
12
  * Tracking binary data (show json method)
12
13
  * Snippet about "what's changed"
@@ -0,0 +1,84 @@
1
+ Autobuild with Guard
2
+ ====================
3
+
4
+ .. warning::
5
+
6
+ Under construction - going to fold this into the Workflow guide. For now, you can see my samples. This is mostly just a brain dump.
7
+
8
+ Throughout your prototyping process, you'll be making small adjustments and then examining the graphical output. Re-running your code can get tedious, because you're cognitively switching from one context to another, e.g. editing x-y coordinates to running your code.
9
+
10
+ Ruby has a great tool for this: `Guard <https://github.com/guard/guard>`_. With Guard, you specify one configuration file (i.e. a ``Guardfile``), and then Guard will *watch* a set of files, then execute a *task*. There are many ways of executing a task, but the cleanest way is via a ``rake`` in a ``Rakefile``.
11
+
12
+ Project layout
13
+ --------------
14
+
15
+ Here's our project layout:
16
+
17
+ .. code-block:: text
18
+
19
+ .
20
+ ├── config.yml
21
+ ├── Gemfile
22
+ ├── Guardfile
23
+ ├── img
24
+ │   └── robot-golem.svg
25
+ ├── layouts
26
+ │   ├── characters.yml
27
+ │   └── skills.yml
28
+ ├── Rakefile
29
+ └── src
30
+ ├── characters.rb
31
+ └── skills.rb
32
+
33
+ Using Guard + Rake
34
+ ------------------
35
+
36
+ Guard is a gem, just like Squib. When using Guard, I recommend also using Bundler. So your Gemfile will look like this.
37
+
38
+ .. literalinclude:: ../../samples/project/Gemfile
39
+ :language: ruby
40
+ :linenos:
41
+
42
+ And then your Rakefile might look something like this
43
+
44
+ .. literalinclude:: ../../samples/project/Rakefile
45
+ :language: ruby
46
+ :linenos:
47
+
48
+ To get our images directory set, and to turn on proress bars (which I recommend when working under Guard), you'll need a ``config.yml`` file that looks like this.
49
+
50
+ .. literalinclude:: ../../samples/project/config.yml
51
+ :language: yaml
52
+ :linenos:
53
+
54
+ Note that we are using ``load`` instead of ``require`` to run our code. In Ruby, ``require`` will only run our code once, because it's about loading a library. The ``load`` will run Ruby code no matter whether or not it's been loaded before. This doesn't usually matter, unless you're running under Guard.
55
+
56
+ And then our Guardfile
57
+
58
+ .. literalinclude:: ../../samples/project/Guardfile
59
+ :language: ruby
60
+ :linenos:
61
+
62
+
63
+ So, let's say we're working on our Character deck. To run all this we can kick off our Guard with:
64
+
65
+ .. code-block:: text
66
+
67
+ $ bundle exec guard -g characters
68
+ 14:45:20 - INFO - Run 'gem install win32console' to use color on Windows
69
+ 14:45:21 - INFO - Starting guard-rake characters
70
+ 14:45:21 - INFO - running characters
71
+ Loading SVG(s) <===========================================> 100% Time: 00:00:00
72
+ Saving PNGs to _output/character__* <======================> 100% Time: 00:00:00
73
+ ]2;[running rake task: characters] watched files: []
74
+ [1] Characters guard(main)> ow watching at 'C:/Users/andy/code/squib/samples/project'
75
+
76
+ Guard will do an initial build, then wait for file changes to be made. From here, once we edit and save anything related to characters - any Excel file, our ``characters.rb`` file, any YML file, etc, we'll rebuild our images.
77
+
78
+ Guard can do much, much more. It opens up a debugging console based on `pry <http://pryrepl.org/>`_, which means if your code is broken you can test things out right there.
79
+
80
+ Guard also supports all kinds of notifications too. By default it tends to beep, but you can also have visual bells and other notifications.
81
+
82
+ To quit guard, type ``quit`` on their console. Or, you can do ``Ctrl+C`` to quit.
83
+
84
+ Enjoy!
@@ -1,6 +1,65 @@
1
- Hello, World!
2
- =============
1
+ Hello, World! Dissected
2
+ =======================
3
3
 
4
- .. note::
4
+ After seeing Squib's `landing page <http://squib.rocks>`_, your might find it helpful to dissect what's really going on in each line of code of a basic Squib snippet.
5
5
 
6
- Under construction
6
+ .. code-block:: ruby
7
+ :linenos:
8
+
9
+ require 'squib'
10
+
11
+ Squib::Deck.new width: 825, height: 1125, cards: 2 do
12
+ background color: 'pink'
13
+ rect
14
+ text str: ['Hello', 'World!']
15
+ save_png prefix: 'hello_'
16
+ end
17
+
18
+ Let’s dissect this:
19
+
20
+ * Line 1: this code will bring in the Squib library for us to use. Keep this at the top.
21
+ * Line 2: By convention, we put a blank line between our require statements and the rest of our code
22
+ * Line 3: Define a new deck of cards. Just 2 cards. 825 pixels wide etc. Squib also supports :doc:`/units` if you prefer to specify something like ``'2.75in'``.
23
+ * Line 4: Set the background to pink. Colors can be in various notations, and supports linear and radial graidents - see :doc:`/colors`.
24
+ * Line 5: Draw a rectangle around the edge of each card. Note that this has no arguments, because :doc:`/parameters`. The defaults can be found in the DSL reference for the :doc:`/dsl/rect` method.
25
+ * Line 6: Put some text in upper-left the corner of the card, using the default font, etc. See the :doc:`/dsl/text` DSL method for more options. The first card will have ``'Hello'`` and the second card will have ``'World'`` because :doc:`/arrays`.
26
+ * Line 7: Save our card out to a png files called ``hello_00.png`` and ``hello_01.png`` saved in the ``_output`` folder.
27
+
28
+ Dissection of "Even Bigger..."
29
+ ------------------------------
30
+
31
+ On Squib's `landing page <http://squib.rocks>`_ we end with a pretty complex example. It's compact and designed to show how much you can get done with a little bit of code. Here's a dissection of that.
32
+
33
+ .. code-block:: ruby
34
+ :linenos:
35
+
36
+ require 'squib'
37
+
38
+ Squib::Deck.new(cards: 4, layout: %w(hand.yml even-bigger.yml)) do
39
+ background color: '#230602'
40
+ deck = xlsx file: 'even-bigger.xlsx'
41
+ svg file: deck['Art'], layout: 'Art'
42
+
43
+ %w(Title Description Snark).each do |key|
44
+ text str: deck[key], layout: key
45
+ end
46
+
47
+ %w(Attack Defend Health).each do |key|
48
+ svg file: "#{key.downcase}.svg", layout: "#{key}Icon"
49
+ text str: deck[key], layout: key
50
+ end
51
+
52
+ save_png prefix: 'even_bigger_'
53
+ showcase file: 'showcase.png', fill_color: '#0000'
54
+ hand file: 'hand.png', trim: 37.5, trim_radius: 25, fill_color: '#0000'
55
+ end
56
+
57
+ * Line 3: Make 4 cards. Use two layouts: the built-in hand.yml (see :doc:`/layouts`) and then our own layout. The layouts get merged, with our own `even-bigger.yml` overriding ``hand.yml`` whenever they collide.
58
+ * Line 5: Read some data from an Excel file, which amounts to a column-based hash of arrays, so that each element of an array corresponds to a specific data point to a given card. For example, ``3`` in the ``'Attack'`` column will be put on the second card.
59
+ * Line 6: Using the Excel data cell for the filename, we can customize a different icon for every card. But, every SVG in this command will be styled according to the ``Art`` entry in our layout (i.e. in ``even-bigger.yml``)
60
+ * Line 8: Iterate over an array of strings, namely, ``'Title'``, ``'Description'``, and ``'Snark'``.
61
+ * Line 9: Draw text for the (Title, Description, or Snark), using *their* styling rules in our layout.
62
+ * Line 13: Using `Ruby String interpolation <https://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Literals#Interpolation>`_, lookup the appropriate icon (e.g. ``'attack.svg'``), converted to lowercase letters, and then using the Icon layout of that for styling (e.g. ``'AttackIcon'`` or ``'DefendIcon'``)
63
+ * Line 17: Render every card to individual PNG files
64
+ * Line 18: Render a "showcase" of cards, using a perspective-reflect effect. See :doc:`/dsl/showcase` method.
65
+ * Line 19: Render a "hand" of cards (spread over a circle). See :doc:`/dsl/hand` method.
@@ -0,0 +1,35 @@
1
+ Squib in Action
2
+ ===============
3
+
4
+ Squib is in use by a lot of people! You can learn a lot from looking at how a whole project is put together.
5
+
6
+ A good way to peruse Squib code is to search for Ruby files on GitHub that have the phrase ``require 'squib'`` in them. And these are the just the people who have decided to release their code open source!
7
+
8
+ My Projects
9
+ -----------
10
+
11
+ Here are some of my own board and card games that use Squib. They are all under "active" development, which means that sometimes I leave them alone for long periods of time ;)
12
+
13
+ * `Your Last Heist <http://github.com/andymeneely/project-timber-wolf>`_ is a big-box cooperative game. Lots of really cool Squib things in here, including lots of Rake features, color+bw, and showing how skills can "level up" on their backs by diff'ing the stats in Squib. You can see what the components look like at `the game website <http://yourlastheist.com>`_. Also: the best game I've ever made.
14
+ * `Victory Point Salad <https://github.com/andymeneely/victory-point-salad>`_. A card-only game with lots and lots and lots of cards. Pretty straightforward as far as Squib usage goes, but it's a good peek into how I like to use Squib. Also: the funniest game I've made.
15
+ * `Junk Land <https://github.com/andymeneely/junk-land>`_ A game I made prior to making starting Squib, but then ported over to Squib while developing Squib. Uses some strange features of SVG, but also a good intro. Also: the scrappiest game I've made.
16
+
17
+ .. note::
18
+
19
+ Want to donate back to Squib? Volunteer to playtest these games :)
20
+
21
+ Other Projects using Squib
22
+ --------------------------
23
+
24
+ Poking around GitHub, here are a few sightings of Squib:
25
+
26
+ * `Ecovalia <https://github.com/evolve2k/ecovalia-game>`_ - a game rapidly prototyped in a hackathon. Squib is featured in their video!
27
+ * `Werewolf <https://github.com/Xpktro/werewolf>`_ implemented and even uses GitHub releases!
28
+ * `Cult Following <https://github.com/ericathegreat/Cult-Following>`_ is a neat-looking project
29
+ * ScrapyardArmory's `Dysplacement <https://www.thegamecrafter.com/games/dysplacement>`_ was used with Squib, and **won** the `Worker Placement contest <https://www.thegamecrafter.com/games/dysplacement>`_ over at TheGameCrafter.
30
+ * `Mad World <https://github.com/spilth/madworld>`_ uses CircleCI to build, even with some custom fonts.
31
+
32
+ Want yours here?
33
+ ----------------
34
+
35
+ Create an issue on Github and ask for a link her and we'll add it here!
@@ -13,7 +13,9 @@ Squib works with both x86 and x86_64 versions of Ruby.
13
13
  Typical Install
14
14
  ---------------
15
15
 
16
- Regardless of your OS, installation is::
16
+ Regardless of your OS, installation is
17
+
18
+ .. code-block:: none
17
19
 
18
20
  $ gem install squib
19
21
 
@@ -250,7 +250,7 @@ economy.yml
250
250
  https://github.com/andymeneely/squib/tree/master/lib/squib/layouts/economy.yml
251
251
 
252
252
  tuck_box.yml
253
- ~~~~~~~~~~~
253
+ ~~~~~~~~~~~~
254
254
 
255
255
  Based on TheGameCrafter's template.
256
256
 
@@ -263,7 +263,7 @@ https://github.com/andymeneely/squib/tree/master/lib/squib/layouts/tuck_box.yml
263
263
 
264
264
 
265
265
  hand.yml
266
- ~~~~~~~~~~~
266
+ ~~~~~~~~
267
267
 
268
268
  .. raw:: html
269
269
 
@@ -273,7 +273,7 @@ hand.yml
273
273
  https://github.com/andymeneely/squib/tree/master/lib/squib/layouts/hand.yml
274
274
 
275
275
  playing_card.yml
276
- ~~~~~~~~~~~
276
+ ~~~~~~~~~~~~~~~~
277
277
 
278
278
  .. raw:: html
279
279
 
@@ -6,5 +6,7 @@ Learning Squib
6
6
 
7
7
  guides/hello_world
8
8
  guides/getting-started/index
9
- guides/git
9
+ guides/projects
10
10
  guides/game_icons
11
+ guides/git
12
+ guides/guard
@@ -1,13 +1,17 @@
1
1
  Parameters are Optional
2
2
  =======================
3
3
 
4
- Squib is all about sane defaults and shorthand specification. Arguments to DSL methods are almost always using hashes, which look a lot like [Ruby 2.0's named parameters](http://www.ruby-doc.org/core-2.0.0/doc/syntax/calling_methods_rdoc.html#label-Keyword+Arguments). This means you can specify your parameters in any order you please. All parameters are optional.
4
+ Squib is all about sane defaults and shorthand specification. Arguments to DSL methods are almost always using hashes, which look a lot like `Ruby 2.0's named parameters <http://www.ruby-doc.org/core-2.0.0/doc/syntax/calling_methods_rdoc.html#label-Keyword+Arguments>`_. This means you can specify your parameters in any order you please. All parameters are optional.
5
5
 
6
- For example `x` and `y` default to 0 (i.e. the upper-left corner of the card). Any parameter that is specified in the command overrides any Squib defaults, `config.yml` settings, or layout rules.
6
+ For example ``x`` and ``y`` default to ``0`` (i.e. the upper-left corner of the card). Any parameter that is specified in the command overrides any Squib defaults or layout rules.
7
7
 
8
- .. highlight:: none
8
+ You must use *named parameters* rather than *positional parameters*. For example::
9
9
 
10
- Note: you MUST use named parameters rather than positional parameters. For example: ``save :png`` will lead to an error like this::
10
+ save(:png) # wrong
11
+
12
+ will lead to an error like this:
13
+
14
+ .. code-block:: none
11
15
 
12
16
  C:/Ruby200/lib/ruby/gems/2.0.0/gems/squib-0.0.3/lib/squib/api/save.rb:12:in `save': wrong number of arguments (2 for 0..1) (ArgumentError)
13
17
  from deck.rb:22:in `block in <main>'
@@ -16,11 +20,15 @@ Note: you MUST use named parameters rather than positional parameters. For examp
16
20
  from deck.rb:18:in `new'
17
21
  from deck.rb:18:in `<main>'
18
22
 
19
- Instead, you must name the parameters: `save format: :png`
23
+ Instead, you must name the parameters::
24
+
25
+ save(format: :png) # the right way
20
26
 
21
27
  .. warning::
22
28
 
23
29
  If you provide an option to a DSL method that the DSL method does not recognize, Squib ignores the extraenous option without warning. For example, these two calls have identical behavior::
24
30
 
25
31
  save_png prefix: 'front_'
26
- save_png prefix: 'front_', narf: true
32
+ save_png prefix: 'front_', narf: true # narf has no effect
33
+
34
+ This can be troublesome when you accidentally misspell an option and don't realize it.
@@ -1,7 +1,6 @@
1
1
  The Mighty text Method
2
2
  ======================
3
3
 
4
-
5
4
  The :doc:`/dsl/text` method is a particularly powerful method with a ton of options. Be sure to check the option-by-option details in the DSL reference, but here are the highlights.
6
5
 
7
6
  Fonts
@@ -42,7 +41,7 @@ Hints
42
41
  Laying out text by typing in numbers can be confusing. What Squib calls "hints" is merely a rectangle around the text box. Hints can be turned on globally in the config file, using the :doc:`/dsl/hint` method, or in an individual text method. These are there merely for prototyping and are not intended for production. Additionally, these are not to be conflated with "rendering hints" that Pango and Cairo mention in their documentation.
43
42
 
44
43
  Extents
45
- ------
44
+ -------
46
45
 
47
46
  Sometimes you want size things based on the size of your rendered text. For example, drawing a rectangle around card's title such that the rectangle perfectly fits. Squib returns the final rendered size of the text so you can work with it afterward. It's an array of hashes that correspond to each card. The output looks like this::
48
47
 
@@ -56,7 +55,7 @@ will output::
56
55
  [{:width=>109, :height=>55}, {:width=>142, :height=>55}] # Hello was 109 pixels wide, World 142 pixels
57
56
 
58
57
  Embedding Images
59
- ------------------
58
+ ----------------
60
59
 
61
60
  Squib can embed icons into the flow of text. To do this, you need to define text keys for Squib to look for, and then the corresponding files. The object given to the block is a ``TextEmbed``, which supports PNG and SVG. Here's a minimal example::
62
61
 
@@ -69,18 +68,48 @@ Markup
69
68
 
70
69
  See :ref:`Markup <text-markup>` in :doc:`/dsl/text`.
71
70
 
72
- Examples
73
- --------
71
+ Samples
72
+ -------
73
+
74
+ These samples are maintained in the `repository here <https://github.com/andymeneely/squib/tree/master/samples>`_ in case you need some of the assets referenced.
74
75
 
75
- * Examples of all of the above are crammed into the ``text_options.rb`` sample `found here <https://github.com/andymeneely/squib/tree/master/samples/text_options.rb>`_
76
- * The ``embed_text.rb`` sample has more examples of embedding text, which can be `found here <https://github.com/andymeneely/squib/tree/master/samples/embed_text.rb>`_
77
- * The ``config_text_markup.rb`` sample demonstrates how quoting can be configured, `found here <https://github.com/andymeneely/squib/tree/master/samples/config_text_markup.rb>`_
76
+ Sample: _text.rb
77
+ ^^^^^^^^^^^^^^^^
78
78
 
79
- And this one too:
79
+ .. literalinclude:: ../samples/text/_text.rb
80
+ :language: ruby
81
+ :linenos:
80
82
 
81
83
  .. raw:: html
82
84
 
83
- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
84
- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/gist-embed/2.4/gist-embed.min.js"></script>
85
- <code data-gist-id="52d7b8e332194946bc69" data-gist-file="_text.rb"></code>
86
- <code data-gist-id="52d7b8e332194946bc69" data-gist-file="_text_00_expected.png"></code>
85
+ <img src="text/_text_00_expected.png" width=600 class="figure">
86
+
87
+ Sample: text_options.rb
88
+ ^^^^^^^^^^^^^^^^^^^^^^^
89
+
90
+ .. literalinclude:: ../samples/text_options.rb
91
+ :language: ruby
92
+ :linenos:
93
+
94
+ Sample: embed_text.rb
95
+ ^^^^^^^^^^^^^^^^^^^^^
96
+
97
+ .. literalinclude:: ../samples/embed_text.rb
98
+ :language: ruby
99
+ :linenos:
100
+
101
+
102
+ Sample: config_text_markup.rb
103
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
104
+
105
+ .. literalinclude:: ../samples/config_text_markup.rb
106
+ :language: ruby
107
+ :linenos:
108
+
109
+ .. literalinclude:: ../samples/config_text_markup.yml
110
+ :language: ruby
111
+ :linenos:
112
+
113
+ .. literalinclude:: ../samples/config_disable_quotes.yml
114
+ :language: ruby
115
+ :linenos:
@@ -3,4 +3,12 @@ Unit Conversion
3
3
 
4
4
  By default, Squib thinks in pixels. This decision was made so that we can have pixel-perfect layouts without automatically scaling everything, even though working in units is sometimes easier. We provide some conversion methods, including looking for strings that end in "in", "cm", or "mm" and computing based on the current DPI. The dpi is set on `Squib::Deck.new` (not `config.yml`).
5
5
 
6
- Example is in `samples/units.rb` found [here](https://github.com/andymeneely/squib/tree/master/samples/units.rb)
6
+ Here are some examples, which `lives here <https://github.com/andymeneely/squib/tree/master/samples/units.rb>`_
7
+
8
+ .. literalinclude:: ../samples/units/_units.rb
9
+ :language: ruby
10
+ :linenos:
11
+
12
+ .. raw:: html
13
+
14
+ <img src="units/units_00_expected.png" class="figure">