-
Notifications
You must be signed in to change notification settings - Fork 10
/
designs_cheat.rb
66 lines (39 loc) · 1.27 KB
/
designs_cheat.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
###
# to run use:
# ruby ./designs_cheat.rb
require 'mooncats'
# Step 1: Generate design images using original size and 3x
(0..127).each do |design|
name = 'design-%03d' % design
cat = Mooncats::Image.new( design: design )
cat.save( "i/#{name}.png" )
cat = Mooncats::Image.new( design: design, zoom: 3 )
cat.save( "i/#{name}x3.png" )
end
# Step 2: Generate the all-in-one cheat sheet page
buf =<<TXT
# MoonCat Designs (128)
In original pixel size¹ and 3x zoom;
tagged with pose (4), face (4), fur (4), facing (2) attributes.
¹: Standing (21×17), sleeping (20×14), pouncing (17×22), stalking (20×21)
TXT
buf << "| Standing | Sleeping | Pouncing | Stalking |\n"
buf << "|----------|----------|----------|----------|\n"
(0..127).each_slice(4) do |slice|
buf << "| "
slice.each do |design|
design_meta = Mooncats::Metadata::Design.new( design )
name = "design-%03d" % design
buf << " ![](i/#{name}.png)"
buf << " ![](i/#{name}x3.png)"
buf << " <br> #{design} "
buf << "#{design_meta.pose}·"
buf << "#{design_meta.face}·"
buf << "#{design_meta.fur}·"
buf << "#{design_meta.facing} "
buf << "|"
end
buf << "\n"
end
puts buf
File.open( './DESIGNS.md', 'w:utf-8') { |f| f.write( buf ) }