readymades 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7966c323b642e9b8f573de77f3da48c96f1b06ac0934ce97fb8e84ce4a262897
4
- data.tar.gz: 2f32892edec469334c959940b3a118530049b04b1657b3d963e922c7bb4fff87
3
+ metadata.gz: 7e42abcd56dde93dcb37257a6e6ed55f1e715a53853465401612ee8b84ee074d
4
+ data.tar.gz: 2299276d0d16290888c82063f34e0241a8e20ac409e8bbe7fb8acdd5f3c0659a
5
5
  SHA512:
6
- metadata.gz: e80a0d5edf8cfcf17eef9b5d1dadbeac421e847ae7aa286413828b7841900c704251c1ce8b46898841e4697d43c9ed91b0464b671b4566049f2b512604ec165f
7
- data.tar.gz: 504126e69b94ba6cd7a051b76eb65af8dd338ae238956fe82c74555a9311869182ef633591c5ba4b909d012d7dae38fbd1c2c5535f64ac8da5a69179ab16ec15
6
+ metadata.gz: d56fb208a42307865f3c9495805cc3eb9d6536a3b436b7ca0e2da7c3630e5b53b06f609e24c6d40622e1562d24d47d0bd95d8716890c89907fc1f1bc5ae67886
7
+ data.tar.gz: a368e175eb5757ba179c5ae05d0e399a3a091a124dabb6b4c63603b9c475fdf6036f2fe5a7667d62cec70227c68fb68e9df8fe19fb5df94f4c514fdb47b2440a
data/Manifest.txt CHANGED
@@ -2,5 +2,7 @@ CHANGELOG.md
2
2
  Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
+ config/spritesheet.csv
6
+ config/spritesheet.png
5
7
  lib/readymades.rb
6
8
  lib/readymades/version.rb
@@ -0,0 +1,11 @@
1
+ id, category, name, more_names
2
+ 0, , William Shakespeare, Will | Will Shakespeare | Shakespeare
3
+ 1, , Dante Alighieri, Dante
4
+ 2, , Galileo Galilei, Galileo | Galilei
5
+ 3, , Mao Zedong, Mao
6
+ 4, , Snoop Dogg, Snoop
7
+ 5, , Bart Simpson, Bart | Simpson
8
+ 6, , Terminator,
9
+ 7, , The Grinch, Grinch
10
+ 8, , The Joker, Joker
11
+ 9, , The Mask, Mask
Binary file
@@ -3,8 +3,8 @@
3
3
  module Readymades
4
4
 
5
5
  MAJOR = 0
6
- MINOR = 0
7
- PATCH = 1
6
+ MINOR = 1
7
+ PATCH = 0
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.version
data/lib/readymades.rb CHANGED
@@ -13,6 +13,77 @@ module Readymades
13
13
  end
14
14
 
15
15
 
16
+
17
+ ###
18
+ ## todo/fix:
19
+ ## use only a spritesheet class
20
+ ## not generator for sprite lookup - why? why not?
21
+ ## rework generator and break up in
22
+ ## two classes (generator + spritesheet) - why? why not?
23
+
24
+ ###
25
+ ## add convenience pre-configurated generatored with build-in spritesheet (see config)
26
+
27
+ module Readymades
28
+
29
+ def self.generator
30
+ @generator ||= Pixelart::Generator.new( "#{root}/config/spritesheet.png",
31
+ "#{root}/config/spritesheet.csv",
32
+ width: 24,
33
+ height: 24 )
34
+ end
35
+
36
+
37
+ class Spritesheet
38
+ ## note: for now class used for "namespace" only
39
+ def self.find_by( name: ) ## return archetype/attribute image by name
40
+ # note: pass along name as q (query string)
41
+ Readymades.generator.find( name )
42
+ end
43
+ end # class Spritesheet
44
+ ## add convenience (alternate spelling) alias - why? why not?
45
+ SpriteSheet = Spritesheet
46
+ Sheet = Spritesheet
47
+ Sprite = Spritesheet
48
+
49
+
50
+
51
+ class Image
52
+ def self.generate( *values, background: nil )
53
+
54
+ name = values[0]
55
+ attribute_names = values[1..-1]
56
+
57
+ base = Readymade::Sheet.find_by( name: name )
58
+
59
+ img = Image.new( 24, 24 )
60
+ img.compose!( base )
61
+
62
+ attribute_names.each do |attribute_name|
63
+ attribute = Punk::Sheet.find_by( name: attribute_name,
64
+ gender: 'm' )
65
+ img.compose!( attribute )
66
+ end
67
+
68
+ if background
69
+ img = if background.is_a?(String) && ['ua', 'ukraine'].include?( background.downcase )
70
+ img.ukraine
71
+ else
72
+ img2 = Image.new( 24, 24, background )
73
+ img2.compose!( img )
74
+ img2
75
+ end
76
+ end
77
+
78
+ ## note: unwrap inner image before passing on to c'tor (requires ChunkyPNG image for now)
79
+ new( 24, 24, img.image )
80
+ end # method Image.generate
81
+ end # class Image
82
+ end # module Readymades
83
+
84
+
85
+
86
+
16
87
  ### add some convenience shortcuts
17
88
  ReadyMades = Readymades
18
89
  ## add singular too -why? why not?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: readymades
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
@@ -74,6 +74,8 @@ files:
74
74
  - Manifest.txt
75
75
  - README.md
76
76
  - Rakefile
77
+ - config/spritesheet.csv
78
+ - config/spritesheet.png
77
79
  - lib/readymades.rb
78
80
  - lib/readymades/version.rb
79
81
  homepage: https://github.com/pixelartexchange/pixelart