punks 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- 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/lib/punks/punks.rb
CHANGED
@@ -1,15 +1,45 @@
|
|
1
1
|
|
2
|
-
|
3
2
|
module Punk
|
4
3
|
|
4
|
+
class Spritesheet
|
5
|
+
def self.builtin
|
6
|
+
@builtin ||= SpritesheetEx.read( "#{Pixelart::Module::Punks.root}/config/punks-24x24.png",
|
7
|
+
"#{Pixelart::Module::Punks.root}/config/punks-24x24.csv",
|
8
|
+
width: 24,
|
9
|
+
height: 24 )
|
10
|
+
end
|
11
|
+
|
12
|
+
## note: for now class used for "namespace" only
|
13
|
+
def self.find_by( name:, gender: nil, size: nil, warn: true ) ## return archetype/attribute image by name
|
14
|
+
# note: pass along name as q (query string)
|
15
|
+
builtin.find_by( name: name,
|
16
|
+
gender: gender,
|
17
|
+
size: size,
|
18
|
+
warn: warn )
|
19
|
+
end
|
20
|
+
def self.find( name, gender: nil, size: nil ) ## return archetype/attribute image by name
|
21
|
+
puts "!!! [WARN] deprecated method call Punk::Spritesheet.find use find_by( name: ) !!!!"
|
22
|
+
builtin.find_by( name: name,
|
23
|
+
gender: gender,
|
24
|
+
size: size )
|
25
|
+
end
|
26
|
+
## helpers
|
27
|
+
def self.normalize_key( str ) Pixelart::SpritesheetEx.normalize_key( str ); end
|
28
|
+
end # class Spritesheet
|
29
|
+
|
30
|
+
|
31
|
+
## add convenience (alternate spelling) alias - why? why not?
|
32
|
+
SpriteSheet = Spritesheet
|
33
|
+
Sheet = Spritesheet
|
34
|
+
Sprite = Spritesheet
|
35
|
+
|
36
|
+
|
37
|
+
|
5
38
|
class Image < Pixelart::Image
|
6
39
|
def self.generator
|
7
|
-
|
8
|
-
@generator ||= Generator.new( "#{Pixelart::Module::Punks.root}/config/punks-24x24.png",
|
9
|
-
"#{Pixelart::Module::Punks.root}/config/punks-24x24.csv", image_class: Image )
|
40
|
+
@generator ||= GeneratorEx.use( Sheet.builtin, image_class: Image )
|
10
41
|
end
|
11
42
|
|
12
|
-
|
13
43
|
def self.generate( *values, style: nil, patch: nil )
|
14
44
|
|
15
45
|
if values[0].is_a?( String )
|
@@ -31,7 +61,7 @@ module Punk
|
|
31
61
|
## Eyes => Eyes B&W
|
32
62
|
## Smile => Smile B&W
|
33
63
|
## ....
|
34
|
-
archetype_key =
|
64
|
+
archetype_key = Sheet.normalize_key( values[0] )
|
35
65
|
if archetype_key.end_with?( 'bw' ) || ## e.g. B&W
|
36
66
|
archetype_key.end_with?( '1bit') ## e.g. 1-Bit or 1Bit
|
37
67
|
|
@@ -39,7 +69,7 @@ module Punk
|
|
39
69
|
if attribute.is_a?( Pixelart::Image )
|
40
70
|
attribute
|
41
71
|
else
|
42
|
-
attribute_key =
|
72
|
+
attribute_key = Sheet.normalize_key( attribute )
|
43
73
|
if ['wildhair'].include?( attribute_key ) ## pass through known b&w attributes by "default"
|
44
74
|
attribute
|
45
75
|
elsif attribute_key.index( "black" )
|
@@ -73,7 +103,7 @@ module Punk
|
|
73
103
|
if attribute.is_a?( Pixelart::Image )
|
74
104
|
attribute
|
75
105
|
else
|
76
|
-
attribute_key =
|
106
|
+
attribute_key = Sheet.normalize_key( attribute )
|
77
107
|
|
78
108
|
if attribute_key == 'smile' || attribute_key == 'frown'
|
79
109
|
attribute += if archetype_key.index( 'zombiefemale' ) then ' Zombie'
|
@@ -96,28 +126,6 @@ module Punk
|
|
96
126
|
generator.generate( *values, style: style, patch: patch )
|
97
127
|
end # method Image.generate
|
98
128
|
end # class Image
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
class Spritesheet
|
103
|
-
def self.builtin
|
104
|
-
## for now get spritesheet via generator
|
105
|
-
Image.generator
|
106
|
-
end
|
107
|
-
## note: for now class used for "namespace" only
|
108
|
-
def self.find_by( name:, gender: nil, size: nil ) ## return archetype/attribute image by name
|
109
|
-
# note: pass along name as q (query string)
|
110
|
-
builtin.find( name,
|
111
|
-
gender: gender,
|
112
|
-
size: size )
|
113
|
-
end
|
114
|
-
end # class Spritesheet
|
115
|
-
## add convenience (alternate spelling) alias - why? why not?
|
116
|
-
SpriteSheet = Spritesheet
|
117
|
-
Sheet = Spritesheet
|
118
|
-
Sprite = Spritesheet
|
119
129
|
end # module Punk
|
120
130
|
|
121
131
|
|
122
|
-
|
123
|
-
|
data/lib/punks/version.rb
CHANGED
data/lib/punks.rb
CHANGED
@@ -7,7 +7,9 @@ require 'artfactory/base'
|
|
7
7
|
## our own code
|
8
8
|
require 'punks/version' # note: let version always go first
|
9
9
|
|
10
|
-
|
10
|
+
|
11
|
+
require 'punks/pixelart/spritesheet'
|
12
|
+
require 'punks/pixelart/generator'
|
11
13
|
|
12
14
|
|
13
15
|
## --- 24x24 series
|
@@ -18,7 +20,9 @@ require 'punks/philips'
|
|
18
20
|
require 'punks/saudis'
|
19
21
|
## --- 32x32 series
|
20
22
|
require 'punks/punks_xl'
|
21
|
-
|
23
|
+
require 'punks/bodies_32'
|
24
|
+
## --- 40x40 series
|
25
|
+
require 'punks/bodies_40'
|
22
26
|
|
23
27
|
|
24
28
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: punks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pixelart
|
@@ -104,15 +104,20 @@ files:
|
|
104
104
|
- config/philip-24x24.png
|
105
105
|
- config/punks-24x24.csv
|
106
106
|
- config/punks-24x24.png
|
107
|
+
- config/punks-32x32.csv
|
108
|
+
- config/punks-32x32.png
|
107
109
|
- config/punks_xl-32x32.csv
|
108
110
|
- config/punks_xl-32x32.png
|
109
111
|
- config/saudis-24x24.csv
|
110
112
|
- config/saudis-24x24.png
|
111
113
|
- lib/punks.rb
|
112
|
-
- lib/punks/
|
114
|
+
- lib/punks/bodies_32.rb
|
115
|
+
- lib/punks/bodies_40.rb
|
113
116
|
- lib/punks/marilyns.rb
|
114
117
|
- lib/punks/philips.rb
|
115
118
|
- lib/punks/phunks.rb
|
119
|
+
- lib/punks/pixelart/generator.rb
|
120
|
+
- lib/punks/pixelart/spritesheet.rb
|
116
121
|
- lib/punks/punks.rb
|
117
122
|
- lib/punks/punks_xl.rb
|
118
123
|
- lib/punks/saudis.rb
|