punks 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Manifest.txt +6 -1
- data/config/punks-24x24.csv +903 -822
- data/config/punks-24x24.png +0 -0
- data/config/punks-32x32.csv +27 -0
- data/config/punks-32x32.png +0 -0
- data/config/saudis-24x24.csv +64 -60
- data/config/saudis-24x24.png +0 -0
- data/lib/punks/bodies_32.rb +131 -0
- data/lib/punks/bodies_40.rb +107 -0
- data/lib/punks/philips.rb +1 -1
- data/lib/punks/pixelart/generator.rb +134 -0
- data/lib/punks/{generator.rb → pixelart/spritesheet.rb} +280 -337
- data/lib/punks/punks.rb +38 -30
- data/lib/punks/version.rb +1 -1
- data/lib/punks.rb +6 -2
- metadata +8 -3
data/config/punks-24x24.png
CHANGED
Binary file
|
@@ -0,0 +1,27 @@
|
|
1
|
+
id, name, gender, size, type, more_names
|
2
|
+
0, Human 1, m, l, Archetype - Human, Human Male 1 | Human 1 ♂ | Male 1
|
3
|
+
1, Human 2, m, l, Archetype - Human, Human Male 2 | Human 2 ♂ | Male 2
|
4
|
+
2, Human 3, m, l, Archetype - Human, Human Male 3 | Human 3 ♂ | Male 3
|
5
|
+
3, Human Mid 1, m, l, Archetype - Human, Human Male Mid 1 | Human Mid 1 ♂ | Male Mid 1
|
6
|
+
4, Human Mid 2, m, l, Archetype - Human, Human Male Mid 2 | Human Mid 2 ♂ | Male Mid 2
|
7
|
+
5, Human Mid 3, m, l, Archetype - Human, Human Male Mid 3 | Human Mid 3 ♂ | Male Mid 3
|
8
|
+
6, Human Female 1, f, s, Archetype - Human, Human 1 ♀ | Female 1
|
9
|
+
7, Human Female 1A, f, s, Archetype - Human, Human 1A ♀ | Female 1A
|
10
|
+
8, Human Female 2, f, s, Archetype - Human, Human 2 ♀ | Female 2
|
11
|
+
9, Human Female 3, f, s, Archetype - Human, Human 3 ♀ | Female 3
|
12
|
+
10, Human Female 3A, f, s, Archetype - Human, Human 3A ♀ | Female 3A
|
13
|
+
11, Human Female Big 1, f, s, Archetype - Human, Human Big 1 ♀ | Female Big 1
|
14
|
+
12, Human Female Big 2, f, s, Archetype - Human, Human Big 2 ♀ | Female Big 2
|
15
|
+
13, Human Female Big 3, f, s, Archetype - Human, Human Big 3 ♀ | Female Big 3
|
16
|
+
14, Human Female Big 3A, f, s, Archetype - Human, Human Big 3A ♀ | Female Big 3A
|
17
|
+
15, Zombie, m, l, Archetype - Zombie, Zombie Male | Zombie ♂
|
18
|
+
16, Ape, m, l, Archetype - Ape, Ape Male | Ape ♂
|
19
|
+
17, Alien, m, l, Archetype - Alien, Alien Male | Alien ♂
|
20
|
+
18, Zombie Female, f, s, Archetype - Zombie, Zombie ♀
|
21
|
+
19, Zombie Female A, f, s, Archetype - Zombie, Zombie A ♀
|
22
|
+
20, Zombie Female Big, f, s, Archetype - Zombie, Zombie Big ♀
|
23
|
+
21, Ape Female, f, s, Archetype - Ape, Ape ♀
|
24
|
+
22, Ape Female Big, f, s, Archetype - Ape, Ape Big ♀
|
25
|
+
23, Alien Female, f, s, Archetype - Alien, Alien ♀
|
26
|
+
24, Alien Female A, f, s, Archetype - Alien, Alien A ♀
|
27
|
+
25, Alien Female Big, f, s, Archetype - Alien, Alien Big ♀
|
Binary file
|
data/config/saudis-24x24.csv
CHANGED
@@ -15,63 +15,67 @@ id, category, name, more_names
|
|
15
15
|
13, , medium 2,
|
16
16
|
14, , dark 1,
|
17
17
|
15, , dark 2,
|
18
|
-
16, ,
|
19
|
-
17, ,
|
20
|
-
18, ,
|
21
|
-
19, ,
|
22
|
-
20, , white shemagh
|
23
|
-
21, ,
|
24
|
-
22, ,
|
25
|
-
23, ,
|
26
|
-
24, ,
|
27
|
-
25, ,
|
28
|
-
26, ,
|
29
|
-
27, ,
|
30
|
-
28, ,
|
31
|
-
29, ,
|
32
|
-
30, ,
|
33
|
-
31, ,
|
34
|
-
32, , normal
|
35
|
-
33, , luxurious
|
36
|
-
34, ,
|
37
|
-
35, ,
|
38
|
-
36, ,
|
39
|
-
37, ,
|
40
|
-
38, ,
|
41
|
-
39, ,
|
42
|
-
40, ,
|
43
|
-
41, ,
|
44
|
-
42, ,
|
45
|
-
43, ,
|
46
|
-
44, ,
|
47
|
-
45, ,
|
48
|
-
46, ,
|
49
|
-
47, ,
|
50
|
-
48, ,
|
51
|
-
49, ,
|
52
|
-
50, ,
|
53
|
-
51, ,
|
54
|
-
52, ,
|
55
|
-
53, ,
|
56
|
-
54, ,
|
57
|
-
55, ,
|
58
|
-
56, ,
|
59
|
-
57, ,
|
60
|
-
58, ,
|
61
|
-
59, ,
|
62
|
-
60, , big
|
63
|
-
61, ,
|
64
|
-
62, ,
|
65
|
-
63, ,
|
66
|
-
64, ,
|
67
|
-
65, ,
|
68
|
-
66, ,
|
69
|
-
67, ,
|
70
|
-
68, ,
|
71
|
-
69, ,
|
72
|
-
70, ,
|
73
|
-
71, ,
|
74
|
-
72, ,
|
75
|
-
73, ,
|
76
|
-
74, ,
|
77
|
-
75, ,
|
18
|
+
16, , green,
|
19
|
+
17, , dark green,
|
20
|
+
18, , cyan,
|
21
|
+
19, , pink,
|
22
|
+
20, , white shemagh,
|
23
|
+
21, , white shemagh agal,
|
24
|
+
22, , white shemagh gold agal,
|
25
|
+
23, , white shemagh stylish gold agal,
|
26
|
+
24, , white shemagh crown,
|
27
|
+
25, , brown shemagh agal,
|
28
|
+
26, , brown shemagh crown,
|
29
|
+
27, , red shemagh,
|
30
|
+
28, , red shemagh agal,
|
31
|
+
29, , red shemagh crown,
|
32
|
+
30, , messy white beard,
|
33
|
+
31, , short white beard,
|
34
|
+
32, , normal white beard,
|
35
|
+
33, , luxurious white beard,
|
36
|
+
34, , short grey beard,
|
37
|
+
35, , messy brown beard,
|
38
|
+
36, , normal brown beard,
|
39
|
+
37, , luxurious brown beard,
|
40
|
+
38, , shadow beard,
|
41
|
+
39, , shadow beard mustache,
|
42
|
+
40, , light beard,
|
43
|
+
41, , mustache,
|
44
|
+
42, , stylish mustache,
|
45
|
+
43, , sideburns,
|
46
|
+
44, , sideburns mustache,
|
47
|
+
45, , normal beard,
|
48
|
+
46, , normal brown beard mustache,
|
49
|
+
47, , luxurious beard,
|
50
|
+
48, , horn rimmed glasses,
|
51
|
+
49, , rimless glasses,
|
52
|
+
50, , nerd glasses,
|
53
|
+
51, , stylish nerd glasses,
|
54
|
+
52, , classic shades,
|
55
|
+
53, , classic green shades,
|
56
|
+
54, , classic gold shades,
|
57
|
+
55, , regular pixel shades,
|
58
|
+
56, , regular reflective shades,
|
59
|
+
57, , big green shades,
|
60
|
+
58, , big pixel shades,
|
61
|
+
59, , big purple shades,
|
62
|
+
60, , big shades,
|
63
|
+
61, , small shades,
|
64
|
+
62, , regular shades,
|
65
|
+
63, , round shades,
|
66
|
+
64, , big round shades,
|
67
|
+
65, , square reflective shades,
|
68
|
+
66, , square shades,
|
69
|
+
67, , 3d glasses,
|
70
|
+
68, , vr,
|
71
|
+
69, , laser eyes,
|
72
|
+
70, , max bidding,
|
73
|
+
71, , cigarette,
|
74
|
+
72, , shadowless cigarette,
|
75
|
+
73, , miswak,
|
76
|
+
74, , vape,
|
77
|
+
75, , shadowless vape,
|
78
|
+
76, , cigar,
|
79
|
+
77, , pearwood pipe,
|
80
|
+
78, , rosewood pipe,
|
81
|
+
79, , bubble gum,
|
data/config/saudis-24x24.png
CHANGED
Binary file
|
@@ -0,0 +1,131 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Punk32
|
4
|
+
|
5
|
+
class Spritesheet
|
6
|
+
def self.builtin
|
7
|
+
@builtin ||= Pixelart::SpritesheetEx.read( "#{Pixelart::Module::Punks.root}/config/punks-32x32.png",
|
8
|
+
"#{Pixelart::Module::Punks.root}/config/punks-32x32.csv",
|
9
|
+
width: 32,
|
10
|
+
height: 32 )
|
11
|
+
end
|
12
|
+
|
13
|
+
## note: for now class used for "namespace" only
|
14
|
+
def self.find_by( name:, gender: nil, size: nil, warn: true ) ## return archetype/attribute image by name
|
15
|
+
# note: pass along name as q (query string)
|
16
|
+
builtin.find_by( name: name,
|
17
|
+
gender: gender,
|
18
|
+
size: size,
|
19
|
+
warn: warn )
|
20
|
+
end
|
21
|
+
def self.find_meta_by( name:, gender: nil, size: nil, warn: true ) ## return archetype/attribute image by name
|
22
|
+
# note: pass along name as q (query string)
|
23
|
+
builtin.find_meta_by( name: name,
|
24
|
+
gender: gender,
|
25
|
+
size: size,
|
26
|
+
warn: warn )
|
27
|
+
end
|
28
|
+
def self.image() builtin.image; end
|
29
|
+
|
30
|
+
## helpers
|
31
|
+
def self.normalize_key( str ) Pixelart::SpritesheetEx.normalize_key( str ); end
|
32
|
+
end # class Spritesheet
|
33
|
+
|
34
|
+
|
35
|
+
## add convenience (alternate spelling) alias - why? why not?
|
36
|
+
SpriteSheet = Spritesheet
|
37
|
+
Sheet = Spritesheet
|
38
|
+
Sprite = Spritesheet
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
class Image < Pixelart::Image
|
43
|
+
|
44
|
+
def self.generate( *values, patch: nil )
|
45
|
+
|
46
|
+
attributes = [] ## collect all attribute images (32x32, 24x24, etc.) to merge/paste here
|
47
|
+
|
48
|
+
|
49
|
+
archetype_name = values[0]
|
50
|
+
|
51
|
+
if archetype_name.is_a?( Pixelart::Image )
|
52
|
+
archetype = archetype_name
|
53
|
+
attributes << archetype
|
54
|
+
### for now assume (support only)
|
55
|
+
## large & male (l/m) for "inline/patch" archetypes - why? why not?
|
56
|
+
## change male to unisex - why? why not? (note: for now unisex is not doing a backup lookup using male/female)
|
57
|
+
attribute_gender = 'm'
|
58
|
+
attribute_size = 'l'
|
59
|
+
elsif patch && img=patch[ Sheet.normalize_key(archetype_name) ]
|
60
|
+
archetype = img
|
61
|
+
attributes << archetype
|
62
|
+
if archetype_name.downcase.index( 'female' )
|
63
|
+
## note: attribute lookup requires gender from archetype!!!!
|
64
|
+
## quick & dirty hack for now
|
65
|
+
## if name incl. female (automagically) switch to f(emale)/s(mall)
|
66
|
+
attribute_gender = 'f'
|
67
|
+
attribute_size = 's'
|
68
|
+
else
|
69
|
+
attribute_gender = 'm'
|
70
|
+
attribute_size = 'l'
|
71
|
+
end
|
72
|
+
else ## assume it's a string
|
73
|
+
### todo/fix: check for nil/not found!!!!
|
74
|
+
## todo/check/fix: assert meta record returned is archetype NOT attribute!!!!
|
75
|
+
archetype = Sheet.find_meta_by( name: archetype_name )
|
76
|
+
if archetype.nil?
|
77
|
+
puts "!! ERROR - archetype >#{archetype}< not found; sorry"
|
78
|
+
exit 1
|
79
|
+
end
|
80
|
+
attributes << Sheet.image[ archetype.id ]
|
81
|
+
attribute_gender = archetype.gender
|
82
|
+
attribute_size = archetype.size
|
83
|
+
end
|
84
|
+
|
85
|
+
attribute_names = values[1..-1]
|
86
|
+
attribute_names.each do |attribute_name|
|
87
|
+
## note: quick hack - allow "inline" raw images for now - why? why not?
|
88
|
+
## pass through as-is
|
89
|
+
if attribute_name.is_a?( Pixelart::Image )
|
90
|
+
attributes << attribute_name
|
91
|
+
elsif patch && img=patch[ Sheet.normalize_key(attribute_name) ]
|
92
|
+
attributes << img
|
93
|
+
else
|
94
|
+
attribute = Sheet.find_by( name: attribute_name,
|
95
|
+
gender: attribute_gender,
|
96
|
+
size: attribute_size,
|
97
|
+
warn: false )
|
98
|
+
## try 24x24 punk attribute next
|
99
|
+
attribute = Punk::Sheet.find_by( name: attribute_name,
|
100
|
+
gender: attribute_gender,
|
101
|
+
size: attribute_size ) if attribute.nil?
|
102
|
+
|
103
|
+
if attribute.nil?
|
104
|
+
puts "!! ERROR - attribute >#{attribute_name}< for (#{attribute_gender}+#{attribute_size}) not found; sorry"
|
105
|
+
exit 1
|
106
|
+
end
|
107
|
+
|
108
|
+
attributes << attribute
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
punk = new( 32, 32 )
|
113
|
+
|
114
|
+
attributes.each do |attribute|
|
115
|
+
if attribute.width == 24 && attribute.height == 24
|
116
|
+
## cut-off top 1px (24x23)
|
117
|
+
attribute = attribute.crop( 0, 1, 24, 23 )
|
118
|
+
## offset x/y for classic 24x24 attributes in 40x40 canvas
|
119
|
+
punk.compose!( attribute, 6, 0 )
|
120
|
+
elsif attribute.width == 32 && attribute.height == 32
|
121
|
+
punk.compose!( attribute )
|
122
|
+
else
|
123
|
+
puts "!! ERROR - unsupported attribute size; got #{attribute.width}x#{attribute.height} - expected 32x32 or 24x24; sorry"
|
124
|
+
exit 1
|
125
|
+
end
|
126
|
+
end
|
127
|
+
punk
|
128
|
+
end # method Image.generate
|
129
|
+
end # class Image
|
130
|
+
end # module Punk32
|
131
|
+
|
@@ -0,0 +1,107 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Punk40
|
4
|
+
|
5
|
+
class Spritesheet
|
6
|
+
## helpers
|
7
|
+
def self.normalize_key( str ) Pixelart::SpritesheetEx.normalize_key( str ); end
|
8
|
+
end # class Spritesheet
|
9
|
+
|
10
|
+
## add convenience (alternate spelling) alias - why? why not?
|
11
|
+
SpriteSheet = Spritesheet
|
12
|
+
Sheet = Spritesheet
|
13
|
+
Sprite = Spritesheet
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
class Image < Pixelart::Image
|
18
|
+
|
19
|
+
def self.generate( *values, patch: nil )
|
20
|
+
|
21
|
+
attributes = [] ## collect all attribute images (32x32, 24x24, etc.) to merge/paste here
|
22
|
+
|
23
|
+
|
24
|
+
archetype_name = values[0]
|
25
|
+
|
26
|
+
if archetype_name.is_a?( Pixelart::Image )
|
27
|
+
archetype = archetype_name
|
28
|
+
attributes << archetype
|
29
|
+
### for now assume (support only)
|
30
|
+
## large & male (l/m) for "inline/patch" archetypes - why? why not?
|
31
|
+
## change male to unisex - why? why not? (note: for now unisex is not doing a backup lookup using male/female)
|
32
|
+
attribute_gender = 'm'
|
33
|
+
attribute_size = 'l'
|
34
|
+
elsif patch && img=patch[ Sheet.normalize_key(archetype_name) ]
|
35
|
+
archetype = img
|
36
|
+
attributes << archetype
|
37
|
+
if archetype_name.downcase.index( 'female' )
|
38
|
+
## note: attribute lookup requires gender from archetype!!!!
|
39
|
+
## quick & dirty hack for now
|
40
|
+
## if name incl. female (automagically) switch to f(emale)/s(mall)
|
41
|
+
attribute_gender = 'f'
|
42
|
+
attribute_size = 's'
|
43
|
+
else
|
44
|
+
attribute_gender = 'm'
|
45
|
+
attribute_size = 'l'
|
46
|
+
end
|
47
|
+
else ## assume it's a string
|
48
|
+
### todo/fix: check for nil/not found!!!!
|
49
|
+
## todo/check/fix: assert meta record returned is archetype NOT attribute!!!!
|
50
|
+
archetype = Punk32::Sheet.find_meta_by( name: archetype_name )
|
51
|
+
if archetype.nil?
|
52
|
+
puts "!! ERROR - archetype >#{archetype}< not found; sorry"
|
53
|
+
exit 1
|
54
|
+
end
|
55
|
+
attributes << Punk32::Sheet.image[ archetype.id ]
|
56
|
+
attribute_gender = archetype.gender
|
57
|
+
attribute_size = archetype.size
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
attribute_names = values[1..-1]
|
62
|
+
attribute_names.each do |attribute_name|
|
63
|
+
## note: quick hack - allow "inline" raw images for now - why? why not?
|
64
|
+
## pass through as-is
|
65
|
+
if attribute_name.is_a?( Pixelart::Image )
|
66
|
+
attributes << attribute_name
|
67
|
+
elsif patch && img=patch[ Sheet.normalize_key(attribute_name) ]
|
68
|
+
attributes << img
|
69
|
+
else
|
70
|
+
attribute = Punk32::Sheet.find_by( name: attribute_name,
|
71
|
+
gender: attribute_gender,
|
72
|
+
size: attribute_size,
|
73
|
+
warn: false )
|
74
|
+
## try 24x24 punk attribute next
|
75
|
+
attribute = Punk::Sheet.find_by( name: attribute_name,
|
76
|
+
gender: attribute_gender,
|
77
|
+
size: attribute_size ) if attribute.nil?
|
78
|
+
|
79
|
+
if attribute.nil?
|
80
|
+
puts "!! ERROR - attribute >#{attribute_name}< for (#{attribute_gender}+#{attribute_size}) not found; sorry"
|
81
|
+
exit 1
|
82
|
+
end
|
83
|
+
|
84
|
+
attributes << attribute
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
punk = new( 40, 40 )
|
89
|
+
|
90
|
+
attributes.each do |attribute|
|
91
|
+
offset = if attribute.width == 24 && attribute.height == 24
|
92
|
+
[6,7] ## offset x/y for classic 24x24 attributes in 40x40 canvas
|
93
|
+
elsif attribute.width == 32 && attribute.height == 32
|
94
|
+
[0,8]
|
95
|
+
elsif attribute.width == 40 && attribute.height == 40
|
96
|
+
[0,0]
|
97
|
+
else
|
98
|
+
puts "!! ERROR - unsupported attribute size; got #{attribute.width}x#{attribute.height} - expected 40x40, 32x32 or 24x24; sorry"
|
99
|
+
exit 1
|
100
|
+
end
|
101
|
+
punk.compose!( attribute, *offset )
|
102
|
+
end
|
103
|
+
punk
|
104
|
+
end # method Image.generate
|
105
|
+
end # class Image
|
106
|
+
end # module Punk40
|
107
|
+
|
data/lib/punks/philips.rb
CHANGED
@@ -0,0 +1,134 @@
|
|
1
|
+
|
2
|
+
module Pixelart
|
3
|
+
class GeneratorEx
|
4
|
+
|
5
|
+
def self.read( image_path="./spritesheet.png",
|
6
|
+
meta_path="./spritesheet.csv",
|
7
|
+
width: 24,
|
8
|
+
height: 24,
|
9
|
+
image_class: Image )
|
10
|
+
|
11
|
+
sheet = SpritesheetEx.read( image_path,
|
12
|
+
meta_path,
|
13
|
+
width: width, height: height )
|
14
|
+
new( sheet, image_class: image_class )
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.use( sheet, image_class: Image ) ### check - allow more sheets - why? why not?
|
18
|
+
new( sheet, image_class: image_class )
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
def normalize_key( str ) SpritesheetEx.normalize_key( str ); end
|
24
|
+
def normalize_gender( str ) SpritesheetEx.normalize_gender( str ); end
|
25
|
+
def normalize_size( str ) SpritesheetEx.normalize_size( str ); end
|
26
|
+
def normalize_name( str ) SpritesheetEx.normalize_name( str ); end
|
27
|
+
|
28
|
+
|
29
|
+
def initialize( sheet, image_class: )
|
30
|
+
@sheet = sheet
|
31
|
+
@image_class = image_class
|
32
|
+
|
33
|
+
puts " [punkfactory] using image class >#{@image_class.name}< for #{@sheet.image.tile_width}x#{@sheet.image.tile_height} images"
|
34
|
+
end
|
35
|
+
|
36
|
+
def spritesheet() @sheet; end
|
37
|
+
alias_method :sheet, :spritesheet
|
38
|
+
|
39
|
+
|
40
|
+
def to_recs( *values, style: nil, patch: nil )
|
41
|
+
|
42
|
+
recs = []
|
43
|
+
|
44
|
+
archetype_name = values[0]
|
45
|
+
|
46
|
+
if archetype_name.is_a?( Image )
|
47
|
+
archetype = archetype_name
|
48
|
+
recs << archetype
|
49
|
+
### for now assume (support only)
|
50
|
+
## large & male (l/m) for "inline/patch" archetypes - why? why not?
|
51
|
+
## change male to unisex - why? why not? (note: for now unisex is not doing a backup lookup using male/female)
|
52
|
+
attribute_gender = 'm'
|
53
|
+
attribute_size = 'l'
|
54
|
+
elsif patch && img=patch[ normalize_key(archetype_name) ]
|
55
|
+
archetype = img
|
56
|
+
recs << archetype
|
57
|
+
if archetype_name.downcase.index( 'female' )
|
58
|
+
## note: attribute lookup requires gender from archetype!!!!
|
59
|
+
## quick & dirty hack for now
|
60
|
+
## if name incl. female (automagically) switch to f(emale)/s(mall)
|
61
|
+
attribute_gender = 'f'
|
62
|
+
attribute_size = 's'
|
63
|
+
else
|
64
|
+
## large & male (l/m) for "inline/patch" archetypes - why? why not?
|
65
|
+
## change male to unisex - why? why not? (note: for now unisex is not doing a backup lookup using male/female)
|
66
|
+
attribute_gender = 'm'
|
67
|
+
attribute_size = 'l'
|
68
|
+
end
|
69
|
+
else ## assume it's a string
|
70
|
+
### todo/fix: check for nil/not found!!!!
|
71
|
+
## todo/check/fix: assert meta record returned is archetype NOT attribute!!!!
|
72
|
+
archetype = @sheet.find_meta_by( name: archetype_name )
|
73
|
+
if archetype.nil?
|
74
|
+
puts "!! ERROR - archetype >#{archetype}< not found; sorry"
|
75
|
+
exit 1
|
76
|
+
end
|
77
|
+
recs << archetype
|
78
|
+
attribute_gender = archetype.gender
|
79
|
+
attribute_size = archetype.size
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
attribute_names = values[1..-1]
|
84
|
+
attribute_names.each do |attribute_name|
|
85
|
+
## note: quick hack - allow "inline" raw images for now - why? why not?
|
86
|
+
## pass through as-is
|
87
|
+
if attribute_name.is_a?( Image )
|
88
|
+
recs << attribute_name
|
89
|
+
elsif patch && img=patch[ normalize_key(attribute_name) ]
|
90
|
+
recs << img
|
91
|
+
else
|
92
|
+
rec = @sheet.find_meta_by( name: attribute_name,
|
93
|
+
gender: attribute_gender,
|
94
|
+
size: attribute_size,
|
95
|
+
style: style )
|
96
|
+
if rec.nil?
|
97
|
+
puts "!! ERROR - attribute >#{attribute_name}< for (#{attribute_gender}+#{attribute_size}) not found; sorry"
|
98
|
+
exit 1
|
99
|
+
end
|
100
|
+
|
101
|
+
recs << rec
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
recs
|
106
|
+
end
|
107
|
+
|
108
|
+
|
109
|
+
def generate_image( *values, style: nil, patch: nil )
|
110
|
+
## check: rename patch to more/extras/foreign or ... - why? why not?
|
111
|
+
|
112
|
+
recs = to_recs( *values, style: style, patch: patch )
|
113
|
+
|
114
|
+
punk = @image_class.new( @sheet.image.tile_width,
|
115
|
+
@sheet.image.tile_height )
|
116
|
+
|
117
|
+
recs.each do |rec|
|
118
|
+
## note: quick hack - allow "inline" raw images for now - why? why not?
|
119
|
+
## pass through as-is
|
120
|
+
img = if rec.is_a?( Image )
|
121
|
+
rec
|
122
|
+
else
|
123
|
+
@sheet.image[ rec.id ]
|
124
|
+
end
|
125
|
+
punk.compose!( img )
|
126
|
+
end
|
127
|
+
|
128
|
+
punk
|
129
|
+
end
|
130
|
+
alias_method :generate, :generate_image
|
131
|
+
|
132
|
+
end # class Generator
|
133
|
+
|
134
|
+
end # module Pixelart
|