Squib Documentation Release V0.17.0 Andy Meneely
Total Page:16
File Type:pdf, Size:1020Kb
Squib Documentation Release v0.17.0 Andy Meneely Sep 07, 2021 Contents 1 Install & Update 3 1.1 Pre-requisites...............................................3 1.2 Typical Install..............................................3 1.3 Updating Squib..............................................4 1.4 OS-Specific Quirks............................................4 2 Learning Squib 5 2.1 Hello, World! Dissected.........................................5 2.1.1 Dissection of “Even Bigger. ”................................6 2.2 The Squib Way pt 0: Learning Ruby...................................6 2.2.1 Not a Programmer?.......................................7 2.2.2 What You DON’T Need To Know about Ruby for Squib...................7 2.2.3 What You Need to Know about Ruby for Squib........................7 2.2.4 Find a good text editor.....................................8 2.2.5 Command line basics......................................8 2.2.6 Edit-Run-Check.........................................9 2.2.7 Plan to Fail...........................................9 2.2.8 Ruby Learning Resources.................................... 10 2.3 The Squib Way pt 1: Zero to Game................................... 10 2.3.1 Prototyping with Squib..................................... 10 2.3.2 Get Installed and Set Up.................................... 10 2.3.3 Our Idea: Familiar Fights.................................... 11 2.3.4 Running Your Squib Build................................... 11 2.3.5 Data or Layout?......................................... 11 2.3.6 Initial Card Layout....................................... 12 2.3.7 Multiple Cards......................................... 13 2.3.8 To the table!........................................... 14 2.3.9 Next up. ............................................. 14 2.4 The Squib Way pt 2: Iconography.................................... 14 2.4.1 Art: Graphic Design vs. Illustration.............................. 14 2.4.2 Iconography in Popular Games................................. 15 2.4.3 How Squib Supports Iconography............................... 16 2.4.4 Back to the Example: Drones vs. Humans........................... 16 2.4.5 Why Ruby+YAML+Spreadsheets Works............................ 17 2.4.6 Illustration: One per Card.................................... 18 2.4.7 Learn by Example........................................ 19 i 2.4.8 Are We Done?......................................... 19 2.5 The Squib Way pt 3: Workflows..................................... 19 2.5.1 Organizing Your Project.................................... 20 2.5.2 Rakefile: Your Project’s Butler................................. 20 2.5.3 Ideas to be written up...................................... 21 2.6 The Squib Way pt 4: Ruby Power!.................................... 21 2.7 Squib in Action.............................................. 22 2.7.1 My Projects........................................... 22 2.7.2 Open Source Projects using Squib............................... 22 2.7.3 Other Projects Using Squib................................... 22 2.7.4 Want yours here?........................................ 22 2.8 Squib + Game-Icons.net......................................... 23 2.8.1 Install the Gem......................................... 23 2.8.2 Find Your Icon......................................... 23 2.8.3 Use the SVG File........................................ 24 2.8.4 Recolor the SVG file...................................... 24 2.8.5 Use the SVG XML Data.................................... 24 2.8.6 Path Weirdness......................................... 25 2.9 Squib + Git................................................ 25 2.10 Autobuild with Guard.......................................... 25 2.10.1 Project layout.......................................... 26 2.10.2 Using Guard + Rake...................................... 26 3 Parameters are Optional 29 4 Squib Thinks in Arrays 31 4.1 Using range to specify cards...................................... 32 4.2 Behold! The Power of Ruby Arrays................................... 32 4.3 Examples................................................. 32 4.4 Contribute Recipes!........................................... 34 5 Layouts are Squib’s Best Feature 35 5.1 Order of Precedence for Options..................................... 36 5.2 When Layouts Are Similar, Use extends ............................... 37 5.3 Yes, extends is Multi-Generational.................................. 38 5.4 Yes, extends has Multiple Inheritance................................ 38 5.5 Multiple Layout Files get Merged.................................... 39 5.6 Squib Comes with Built-In Layouts................................... 39 5.6.1 fantasy.yml........................................... 41 5.6.2 economy.yml.......................................... 41 5.6.3 tuck_box.yml.......................................... 41 5.6.4 hand.yml............................................ 42 5.6.5 party.yml............................................ 42 5.6.6 playing_card.yml........................................ 42 5.7 See Layouts in Action.......................................... 42 6 Be Data-Driven with XLSX and CSV 47 6.1 Squib::DataFrame, or a Hash of Arrays................................. 47 6.2 Quantity Explosion............................................ 47 7 Unit Conversion 49 7.1 Cells................................................... 49 7.2 Samples.................................................. 49 7.2.1 _units.rb............................................. 49 7.2.2 _cells.rb............................................. 50 ii 8 XYWH Shorthands 53 8.1 Samples.................................................. 53 8.1.1 _shorthands.rb......................................... 53 9 Specifying Colors & Gradients 55 9.1 Colors.................................................. 55 9.1.1 by hex-string.......................................... 55 9.1.2 by name............................................. 55 9.1.3 by custom name......................................... 56 9.2 Gradients................................................. 56 9.3 Samples.................................................. 56 9.3.1 Sample: colors and color constants............................... 56 9.3.2 Sample: gradients........................................ 57 9.3.3 Sample: Switch color based on variable............................ 58 10 The Mighty text Method 61 10.1 Fonts................................................... 61 10.2 Width and Height............................................. 62 10.3 Autoscaling Font Size.......................................... 62 10.4 Hints................................................... 62 10.5 Extents.................................................. 62 10.6 Embedding Images............................................ 62 10.7 Markup.................................................. 63 10.8 Samples.................................................. 63 10.8.1 Sample: _text.rb........................................ 63 10.8.2 Sample: text_options.rb..................................... 64 10.8.3 Sample: embed_text.rb..................................... 66 10.8.4 Sample: config_text_markup.rb................................ 69 10.8.5 Sample: _autoscale_font.rb................................... 69 11 Always Have Bleed 73 11.1 Summary................................................. 73 11.2 What is a bleed?............................................. 73 11.3 Usage................................................... 74 11.4 Example................................................. 74 11.5 Templates................................................. 74 12 Configuration Options 75 12.1 Options are available as methods.................................... 76 12.2 Set options programmatically...................................... 77 12.3 Making Squib Verbose.......................................... 77 13 Vector vs. Raster Backends 79 14 Group Your Builds 81 15 Sprue Thy Sheets 85 15.1 Using a Sprue.............................................. 85 15.2 Make Your Own Sprue.......................................... 86 15.3 Sprue Format............................................... 87 15.3.1 Top-Level parameters...................................... 87 15.3.2 cards............................................... 88 15.3.3 crop_line............................................ 88 15.4 List of Built-in Sprues.......................................... 88 15.4.1 a4_euro_card.yml........................................ 89 iii 15.4.2 a4_poker_card_8up.yml.................................... 89 15.4.3 a4_usa_card.yml........................................ 89 15.4.4 letter_poker_card_9up.yml................................... 89 15.4.5 letter_poker_foldable_8up.yml................................. 89 15.4.6 printplaygames_18up.yml................................... 89 15.4.7 drivethrucards_1up.yml..................................... 89 16 Get Help and Give Help 91 16.1 Show Your Pride............................................. 91 16.2 Get Help................................................. 91 16.3 Help by Troubleshooting......................................... 91 16.4 Help by Beta Testing........................................... 92 16.4.1 Beta: Using Pre-Builds..................................... 92 16.4.2 Beta: About versions...................................... 93 16.4.3 Beta: About Bundler+RubyGems............................... 93 16.5 Make a Sprue!.............................................. 94 16.6