parent
62a2d54ed2
commit
c795852fa8
|
|
@ -1,6 +1,12 @@
|
|||
# Squib CHANGELOG
|
||||
Squib follows [semantic versioning](http://semver.org).
|
||||
|
||||
## v0.17.1 / 2021-08-11
|
||||
|
||||
Bugs:
|
||||
* Sprues now allow negative coordinates (#336)
|
||||
* Documentation typos (#337)
|
||||
|
||||
## v0.17.0 / 2021-07-23
|
||||
Features:
|
||||
* Drop shadows! The `save_png` method now supports a bunch of `shadow_` arguments that will add a drop shadow just before rendering. This is intended for using in rulebooks or marketing. Try it out by adding `shadow_radius: 8` to your save_png (#306, #264)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
module Squib
|
||||
module Sprues
|
||||
UNIT_REGEX = /^(\d*[.])?\d+(in|cm|mm)$/
|
||||
ROTATE_REGEX = /^(\d*[.])?\d+(deg|rad)?$/
|
||||
COORD_REGEX = /^\-?(\d*[.])?\d+(in|cm|mm)$/
|
||||
ROTATE_REGEX = /^\-?(\d*[.])?\d+(deg|rad)?$/
|
||||
SCHEMA = {
|
||||
'sheet_width' => UNIT_REGEX,
|
||||
'sheet_height' => UNIT_REGEX,
|
||||
|
|
@ -35,8 +36,8 @@ module Squib
|
|||
}]]
|
||||
},
|
||||
'cards' => [[{
|
||||
'x' => UNIT_REGEX,
|
||||
'y' => UNIT_REGEX,
|
||||
'x' => COORD_REGEX,
|
||||
'y' => COORD_REGEX,
|
||||
'rotate' => [
|
||||
:optional, Numeric,
|
||||
ClassyHash::G.enum(:clockwise, :counterclockwise, :turnaround),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
require_relative '../../lib/squib'
|
||||
|
||||
Squib::Deck.new(width: 100, height: 100, cards: 3) do
|
||||
background color: :grey
|
||||
text str: 'Hello', font: 'Sans Bold 10'
|
||||
save_sheet sprue: 'my_sprues/negatives.yml', prefix: 'sprue_negatives_'
|
||||
end
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
sheet_width: 3.0in
|
||||
sheet_height: 3.0in
|
||||
card_width: 1in
|
||||
card_height: 1in
|
||||
cards:
|
||||
- x: -0.15in
|
||||
y: -0.10in
|
||||
- x: 1.5in
|
||||
y: 0.5in
|
||||
- x: 0.5in
|
||||
y: 1.5in
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.2 KiB |
|
|
@ -0,0 +1,7 @@
|
|||
sheet_width: 8.5in
|
||||
sheet_height: 11in
|
||||
card_width: 2.5in
|
||||
card_height: 3.5in
|
||||
cards:
|
||||
- x: -0.5in
|
||||
y: -1in
|
||||
|
|
@ -159,6 +159,13 @@ describe Squib::Sprue do
|
|||
.to eq( [false, false, true] )
|
||||
end
|
||||
|
||||
it 'parses negative coordinates' do
|
||||
tmpl = Squib::Sprue.load(sprue_file('negatives.yml'), 100, 37.5)
|
||||
expect(tmpl.cards.length).to eq(1)
|
||||
expect(tmpl.cards.map { |card| card['x'] }) .to eq( [-50] )
|
||||
expect(tmpl.cards.map { |card| card['y'] }) .to eq( [-100] )
|
||||
end
|
||||
|
||||
it 'fails when sheet_width is not defined' do
|
||||
expect do
|
||||
Squib::Sprue.load(sprue_file('fail_no_sheet_width.yml'), 100, 37.5)
|
||||
|
|
|
|||
Loading…
Reference in New Issue