8 changed files with 90 additions and 34 deletions
@ -1,11 +1,12 @@
|
||||
#!/usr/bin/env ruby |
||||
|
||||
require 'squib' |
||||
|
||||
deck width: 825, height: 1125, 3 |
||||
deck width: 825, height: 1125, cards: 3 |
||||
|
||||
data = {'name' => ['Thief', 'Grifter', 'Mastermind'], |
||||
'level' => [1,2,3]} |
||||
|
||||
text str: data['name'], x: 10, y: 250 |
||||
text str: data['level'], x: 10, y:10 |
||||
|
||||
save format: :png |
||||
@ -0,0 +1,18 @@
|
||||
module Squib |
||||
module Graphics |
||||
|
||||
class Save |
||||
def initialize(format) |
||||
@format = format |
||||
end |
||||
|
||||
def execute |
||||
puts "Here!" |
||||
Squib.the_deck.each_with_index do |card, i| |
||||
card.cairo_context.target.write_to_png("_img/img_#{i}.png") |
||||
end |
||||
end |
||||
end |
||||
|
||||
end |
||||
end |
||||
@ -0,0 +1,23 @@
|
||||
module Squib |
||||
module Graphics |
||||
|
||||
class Text |
||||
def initialize(card, str, font, x, y, options) |
||||
@card=card |
||||
@str=str |
||||
@font=font |
||||
@x=x; @y=y |
||||
end |
||||
|
||||
def execute |
||||
cc = @card.cairo_context |
||||
cc.set_source_rgb(0.0,0.0,0.0) |
||||
cc.select_font_face ("Helvetica"); |
||||
cc.set_font_size(36) |
||||
cc.move_to(@x,@y) |
||||
cc.show_text(@str.to_s) |
||||
end |
||||
end |
||||
|
||||
end |
||||
end |
||||
Loading…
Reference in new issue