1
0

update graphics

This commit is contained in:
Ninjananas
2025-01-07 22:57:34 +01:00
parent f112f57e37
commit a04cf4d0cb
6 changed files with 240 additions and 58 deletions

View File

@@ -1,3 +1,3 @@
source 'https://rubygems.org'
gem 'squib'
gem "squib", path: "../squib/pkg"

Binary file not shown.

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 902 KiB

After

Width:  |  Height:  |  Size: 912 KiB

View File

@@ -41,7 +41,7 @@ def export_objects(svg_file: str, object_ids: Iterable[str]) -> None:
OUTPUT_DIR + "/" + obj[4:],
svg_file,
]
print(f"exporting {obj[4:]}...", end="")
print(f"exporting {obj[4:]}...", end="", flush=True)
res = subprocess.check_output(command)
if res:
print(f" An error might have occurred:\n{res}")

View File

@@ -63,17 +63,50 @@ ALT_BANNER_TEXT_X, ALT_BANNER_TEXT_Y = central_sym(BANNER_TEXT_X, BANNER_TEXT_Y)
# Effects
EFFECT_FRAME_WIDTH = SAFE_WIDTH - 2
EFFECT_FRAME_HEIGHT = 6
EFFECT_FRAME_HEIGHT = 7
EFFECT_FRAME_RADIUS = 0.2
EFFECT_FRAME_MARGIN_BOTTOM = 4.1
EFFECT_FRAME_X = (TOTAL_WIDTH - EFFECT_FRAME_WIDTH) / 2.
EFFECT_FRAME_Y = MAX_SAFE_Y - EFFECT_FRAME_MARGIN_BOTTOM - EFFECT_FRAME_HEIGHT
EFFECT_TEXT_MARGIN = 1
EFFECT_TEXT_X = EFFECT_FRAME_X + EFFECT_TEXT_MARGIN
EFFECT_TEXT_Y = EFFECT_FRAME_Y + EFFECT_TEXT_MARGIN
EFFECT_TEXT_WIDTH = EFFECT_FRAME_WIDTH - 2 * EFFECT_TEXT_MARGIN
EFFECT_TEXT_HEIGHT = EFFECT_FRAME_HEIGHT - 2 * EFFECT_TEXT_MARGIN
EFFECT_ICON_MARGIN = .5
EFFECT_ICON_SIZE = 1.5
EFFECT_ICON_X = EFFECT_FRAME_X + EFFECT_ICON_MARGIN + (EFFECT_ICON_SIZE / 2.)
EFFECT_TEXT_MARGIN = .2
EFFECT_SEPARATOR_HEIGHT = 1.
EFFECT_SEPARATOR_MARGIN = .05
TOTAL_SEPARATOR_HEIGHT = EFFECT_SEPARATOR_HEIGHT + (2 * EFFECT_SEPARATOR_MARGIN)
EFFECT_SEPARATOR_X = EFFECT_FRAME_X + (EFFECT_FRAME_WIDTH / 2.)
EFFECT_SEPARATOR_Y_2 = EFFECT_FRAME_Y + (EFFECT_FRAME_HEIGHT / 2.)
EFFECT_SEPARATOR_Y_3_0 = EFFECT_FRAME_Y + EFFECT_TEXT_MARGIN + (EFFECT_FRAME_HEIGHT - (2 * EFFECT_TEXT_MARGIN)) / 3.
EFFECT_SEPARATOR_Y_3_1 = EFFECT_FRAME_Y + EFFECT_TEXT_MARGIN + 2 * (EFFECT_FRAME_HEIGHT - (2 * EFFECT_TEXT_MARGIN)) / 3.
EFFECT_TEXT_X = EFFECT_FRAME_X + EFFECT_ICON_MARGIN + EFFECT_ICON_SIZE + EFFECT_TEXT_MARGIN
EFFECT_TEXT_HEIGHT_1 = EFFECT_FRAME_HEIGHT - 2 * EFFECT_TEXT_MARGIN
EFFECT_TEXT_Y_1 = EFFECT_FRAME_Y + EFFECT_TEXT_MARGIN
EFFECT_TEXT_HEIGHT_2 = (EFFECT_FRAME_HEIGHT - (2 * EFFECT_TEXT_MARGIN) - TOTAL_SEPARATOR_HEIGHT) / 2.
EFFECT_TEXT_Y_2_0 = EFFECT_TEXT_Y_1
EFFECT_TEXT_Y_2_1 = EFFECT_TEXT_Y_2_0 + EFFECT_TEXT_HEIGHT_2 + TOTAL_SEPARATOR_HEIGHT
EFFECT_TEXT_HEIGHT_3 = (EFFECT_FRAME_HEIGHT - (2 * EFFECT_TEXT_MARGIN) - (2 * TOTAL_SEPARATOR_HEIGHT)) / 2.
EFFECT_TEXT_Y_3_0 = EFFECT_TEXT_Y_1
EFFECT_TEXT_Y_3_1 = EFFECT_TEXT_Y_3_0 + EFFECT_TEXT_HEIGHT_3 + TOTAL_SEPARATOR_HEIGHT
EFFECT_TEXT_Y_3_2 = EFFECT_TEXT_Y_3_1 + EFFECT_TEXT_HEIGHT_3 + TOTAL_SEPARATOR_HEIGHT
EFFECT_TEXT_WIDTH = EFFECT_FRAME_X + EFFECT_FRAME_WIDTH - EFFECT_TEXT_X - EFFECT_TEXT_MARGIN
EFFECT_ICON_Y_1 = EFFECT_FRAME_Y + (EFFECT_FRAME_HEIGHT / 2.)
EFFECT_ICON_Y_2_0 = EFFECT_TEXT_Y_2_0 + (EFFECT_TEXT_HEIGHT_2 / 2.)
EFFECT_ICON_Y_2_1 = EFFECT_TEXT_Y_2_1 + (EFFECT_TEXT_HEIGHT_2 / 2.)
EFFECT_ICON_Y_3_0 = EFFECT_TEXT_Y_3_0 + (EFFECT_TEXT_HEIGHT_2 / 2.)
EFFECT_ICON_Y_3_1 = EFFECT_TEXT_Y_3_1 + (EFFECT_TEXT_HEIGHT_2 / 2.)
EFFECT_ICON_Y_3_2 = EFFECT_TEXT_Y_3_2 + (EFFECT_TEXT_HEIGHT_2 / 2.)
POKER_LAYOUT: str = f"""
background:
@@ -165,15 +198,91 @@ effect_frame:
radius: {EFFECT_FRAME_RADIUS}c
stroke_width: 0.3mm
effect_icon:
x: {EFFECT_ICON_X}c
width: {EFFECT_ICON_SIZE}c
height: {EFFECT_ICON_SIZE}c
anchor: :center
effect_icon_1_0:
extends: effect_icon
y: {EFFECT_ICON_Y_1}c
effect_icon_2_0:
extends: effect_icon
y: {EFFECT_ICON_Y_2_0}c
effect_icon_2_1:
extends: effect_icon
y: {EFFECT_ICON_Y_2_1}c
effect_icon_3_0:
extends: effect_icon
y: {EFFECT_ICON_Y_3_0}c
effect_icon_3_1:
extends: effect_icon
y: {EFFECT_ICON_Y_3_1}c
effect_icon_3_2:
extends: effect_icon
y: {EFFECT_ICON_Y_3_2}c
effect_separator:
x: {EFFECT_SEPARATOR_X}c
anchor: :center
height: {EFFECT_SEPARATOR_HEIGHT}c
width: :scale
effect_separator_2_0:
extends: effect_separator
y: {EFFECT_SEPARATOR_Y_2}c
effect_separator_3_0:
extends: effect_separator
y: {EFFECT_SEPARATOR_Y_3_0}c
effect_separator_3_1:
extends: effect_separator
y: {EFFECT_SEPARATOR_Y_3_1}c
effect_text:
x: {EFFECT_TEXT_X}c
y: {EFFECT_TEXT_Y}c
width: {EFFECT_TEXT_WIDTH}c
height: {EFFECT_TEXT_HEIGHT}c
align: center
valign: middle
markup: true
effect_text_1_0:
extends: effect_text
y: {EFFECT_TEXT_Y_1}c
height: {EFFECT_TEXT_HEIGHT_1}c
effect_text_2_0:
extends: effect_text
y: {EFFECT_TEXT_Y_2_0}c
height: {EFFECT_TEXT_HEIGHT_2}c
effect_text_2_1:
extends: effect_text
y: {EFFECT_TEXT_Y_2_1}c
height: {EFFECT_TEXT_HEIGHT_2}c
effect_text_3_0:
extends: effect_text
y: {EFFECT_TEXT_Y_3_0}c
height: {EFFECT_TEXT_HEIGHT_3}c
effect_text_3_1:
extends: effect_text
y: {EFFECT_TEXT_Y_3_1}c
height: {EFFECT_TEXT_HEIGHT_3}c
effect_text_3_2:
extends: effect_text
y: {EFFECT_TEXT_Y_3_2}c
height: {EFFECT_TEXT_HEIGHT_3}c
paparazzo:
x: {PAPARAZZO_X}c
y: {PAPARAZZO_Y}c

View File

@@ -1,7 +1,7 @@
require 'squib'
DPI = 300
DPI = 150
CELL_PX = DPI / 8.0
BLEED = 0.125 # In inches
WIDTH = (2.5 + 2*BLEED) * DPI
@@ -57,6 +57,35 @@ def get_art(data, idx)
return "default_art_#{icon}#{icon_alt}.svg"
end
def get_grouped_effects(data, idx)
if data['effet_1'].nil?
n_effects = 0
elsif data['effet_2'].nil?
n_effects = 1
elsif data['effet_3'].nil?
n_effects = 2
else
n_effects = 3
end
effects = []
(0..3).each do |i|
effects.append([data["type_effet_#{i}"], data["effet_#{i}"]])
end
return [n_effects, effects]
end
def get_n_effects(data, idx)
if data['effet_1'][idx].nil?
0
elsif data['effet_2'][idx].nil?
1
elsif data['effet_3'][idx].nil?
2
else
3
end
end
def embed_custom(embed, id)
embed.svg width: "#{EMBED_SIZE}c", height: "#{EMBED_SIZE}c", dx: '0c', dy: "#{EMBED_DY}c", key: ":#{id}:", file: "._graphics/#{id}.svg"
end
@@ -108,10 +137,15 @@ Squib::Deck.new(
svg file: alt_banner_file, layout: 'alt_banner'
text str: data['rang_alt'], layout: 'alt_banner_text'
fill_color = data['effet'].map { |effet| effet.nil? ? '#0000': '#f7f7f7ff' }
stroke_color = data['effet'].map { |effet| effet.nil? ? '#0000': '#cca9' }
fill_color = data['effet_1'].map { |effet| effet.nil? ? '#0000': '#f7f7f7ff' }
stroke_color = data['effet_1'].map { |effet| effet.nil? ? '#0000': '#cca9' }
rect layout: 'effect_frame', fill_color: fill_color, stroke_color: stroke_color
text(str: data['effet'], layout: 'effect_text', font_size: EFFECT_FONT_SIZE, spacing: EFFECT_FONT_SPACING) do |embed|
n_effects = (0..data['icone'].length).map { |idx| get_n_effects(data, idx) }
(1..3).each do |n|
n.times do |i|
# Effect texts
text(str: (0..data['icone'].length).map { |idx| (n == n_effects[idx]) ? data["effet_#{i+1}"][idx] : nil}, layout: "effect_text_#{n}_#{i}", font_size: EFFECT_FONT_SIZE, spacing: EFFECT_FONT_SPACING) do |embed|
embed_custom(embed, 'effet')
embed_custom(embed, 'magouille')
embed_custom(embed, 'pv')
@@ -123,6 +157,17 @@ Squib::Deck.new(
embed_custom(embed, 'symbole_eco')
end
# Effect icons
svg file: (0..data['icone'].length).map { |idx| (n == n_effects[idx]) ? data["type_effet_#{i+1}"][idx] + ".svg" : nil}, layout: "effect_icon_#{n}_#{i}"
end
end
(2..3).each do |n|
#Effect separators
(n-1).times do |i|
svg file: (0..data['icone'].length).map { |idx| (n == n_effects[idx]) ? "separateur_effet.svg" : nil}, layout: "effect_separator_#{n}_#{i}"
end
end
build :debug do
save_pdf sprue: 'sprues/debug.yml', file: 'debug.pdf'
end
@@ -133,8 +178,8 @@ Squib::Deck.new(
end
build :showcase do
hand range: [0, 6, 13, 21, 38, 59, 65], trim_radius: inches(0.125), fill_color: 'black'
showcase range: [0, 6, 13, 21, 38, 59, 65], trim: inches(BLEED), trim_radius: inches(0.125), fill_color: 'black'
hand range: [0, 6, 13, 21, 38, 59, 62], trim_radius: inches(0.125), fill_color: 'black'
showcase range: [0, 6, 13, 21, 38, 59, 62], trim: inches(BLEED), trim_radius: inches(0.125), fill_color: 'black'
end
build :full do