bricks_meet_balls 0.0.1 → 0.0.2

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
  SHA1:
3
- metadata.gz: 04d8256c3c29fe4b65ea916c07079c87ad8ed070
4
- data.tar.gz: 09801514716fb838c0765a618768c00199c43cfe
3
+ metadata.gz: dc30d72016b6b37442e2d9f47007c413d86bd82d
4
+ data.tar.gz: c036dfe4feceb8298a920c7eac307b8f1cce9f69
5
5
  SHA512:
6
- metadata.gz: b2fe7c53b3860494587b747b3fce19d837c5fd2148c6a5e4456e73ead36925547dd8c4165b48c3da89bdcc204afd478aa435ad8938fe1e10f12f696cd5454c62
7
- data.tar.gz: 7e7631034d55fe5912003b218e8c1f5cf52e25320378a164a3393cb2979d03a2b26d2a2da2d0bb2a789922755533bd41bdb2f92e475c565c695e6a8a33909eb5
6
+ metadata.gz: 678d5057c642c67f6b96aaad88925230dd786157881f517895de5a4982ed0b7b2605ae39a1d77698f37fee8fe4aac17a279773f621d0262bd6f77a35e82f9e02
7
+ data.tar.gz: 1d1adb3c67df3c98983fdcbfe768482f120e48b0f153d45ecf5ff92e98eb08e4fe552916930997f9edb2ac49cbd09c8e17c2e2a591a3d51796029ac0d8640125
data/NEWS.md ADDED
@@ -0,0 +1,15 @@
1
+ # NEWS
2
+
3
+ ## 0.0.2: 2014-03-25
4
+
5
+ Support multiple images for bricks and balls!
6
+
7
+ ### Changes
8
+
9
+ * Improvements
10
+ * Support multiple images for bricks
11
+ * Support multiple images for balls
12
+
13
+ ## 0.0.1: 2014-03-25
14
+
15
+ Initial release!
Binary file
@@ -3,9 +3,37 @@
3
3
  # groonga-logo.png, groonga-icon-full-size.png:
4
4
  # CC BY 3.0 - (c) The Groonga Project
5
5
  #
6
+ # mroonga-logo.png, mroonga-icon-full-size.png:
7
+ # CC BY 3.0 - (c) The Mroonga Project
8
+ #
9
+ # rroonga-logo.png, rroonga-icon-full-size.png:
10
+ # CC BY 3.0 - (c) The Ranguba Project
11
+ #
12
+ # nroonga-logo.png, nroonga-icon-full-size.png:
13
+ # CC BY 3.0 - (c) The Nroonga Project
14
+ #
15
+ # droonga-logo.png, droonga-icon-full-size.png:
16
+ # CC BY 3.0 - (c) The Droonga Project
17
+ #
6
18
 
7
19
  require "bricks_meet_balls"
8
20
 
21
+ BRICK_IMAGES = [
22
+ "groonga-logo.png",
23
+ "mroonga-logo.png",
24
+ "rroonga-logo.png",
25
+ "nroonga-logo.png",
26
+ "droonga-logo.png",
27
+ ]
28
+
29
+ BALL_IMAGES = [
30
+ "groonga-icon-full-size.png",
31
+ "mroonga-icon-full-size.png",
32
+ "rroonga-icon-full-size.png",
33
+ "nroonga-icon-full-size.png",
34
+ "droonga-icon-full-size.png",
35
+ ]
36
+
9
37
  width = 640
10
38
  height = 480
11
39
  num_of_rows = 10
@@ -13,15 +41,19 @@ num_of_columns = 8
13
41
  num_of_balls = 29
14
42
 
15
43
  base_dir = File.expand_path(File.dirname(__FILE__))
16
- ball_image = File.join(base_dir, "groonga-icon-full-size.png")
17
- brick_image = File.join(base_dir, "groonga-logo.png")
44
+ ball_images = BALL_IMAGES.collect do |ball_image|
45
+ File.join(base_dir, ball_image)
46
+ end
47
+ brick_images = BRICK_IMAGES.collect do |brick_image|
48
+ File.join(base_dir, brick_image)
49
+ end
18
50
 
19
51
  window = BricksMeetBalls::Window.new(width,
20
52
  height,
21
53
  num_of_rows,
22
54
  num_of_columns,
23
55
  num_of_balls,
24
- ball_image,
25
- brick_image)
56
+ ball_images,
57
+ brick_images)
26
58
 
27
59
  window.show
Binary file
Binary file
Binary file
@@ -1,3 +1,3 @@
1
1
  module BricksMeetBalls
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -12,7 +12,7 @@ module BricksMeetBalls
12
12
 
13
13
  def initialize(width=240, height=480,
14
14
  num_of_rows=2, num_of_columns=3, num_of_balls=1,
15
- ball_image=nil, brick_image=nil)
15
+ ball_images=nil, brick_images=nil)
16
16
  super(width, height, false)
17
17
  self.caption = "Bricks meet Balls"
18
18
  @x1 = 0
@@ -23,8 +23,8 @@ module BricksMeetBalls
23
23
  @balls = []
24
24
  @bar = Bar.new(self)
25
25
  @message = nil
26
- @ball_image = ball_image
27
- @brick_image = brick_image
26
+ @ball_images = ball_images
27
+ @brick_images = brick_images
28
28
  create_bricks(num_of_columns, num_of_rows)
29
29
  create_balls(num_of_balls)
30
30
  end
@@ -106,12 +106,17 @@ module BricksMeetBalls
106
106
  def create_bricks(num_of_columns, num_of_rows)
107
107
  1.upto(num_of_columns) do |column|
108
108
  1.upto(num_of_rows) do |row|
109
+ if @brick_images.is_a?(Array)
110
+ brick_image = @brick_images.sample
111
+ else
112
+ brick_image = @brick_images
113
+ end
109
114
  @bricks << Brick.new(self,
110
115
  column,
111
116
  row,
112
117
  self.width / num_of_columns,
113
118
  self.width / num_of_columns / 3,
114
- @brick_image)
119
+ brick_image)
115
120
  end
116
121
  end
117
122
  end
@@ -123,7 +128,12 @@ module BricksMeetBalls
123
128
  end
124
129
 
125
130
  def create_ball
126
- ball = Ball.new(self, @ball_image)
131
+ if @ball_images.is_a?(Array)
132
+ ball_image = @ball_images.sample
133
+ else
134
+ ball_image = @ball_images
135
+ end
136
+ ball = Ball.new(self, ball_image)
127
137
  ball.warp(self.width * 0.5,
128
138
  self.height * 0.8)
129
139
  @balls << ball
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bricks_meet_balls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masafumi Yokoyama
@@ -106,13 +106,22 @@ files:
106
106
  - ".gitignore"
107
107
  - Gemfile
108
108
  - LICENSE.txt
109
+ - NEWS.md
109
110
  - README.md
110
111
  - Rakefile
111
112
  - bin/bricks_meet_balls
112
113
  - bricks_meet_balls.gemspec
114
+ - examples/groonga/droonga-icon-full-size.png
115
+ - examples/groonga/droonga-logo.png
113
116
  - examples/groonga/groonga-icon-full-size.png
114
117
  - examples/groonga/groonga-logo.png
115
118
  - examples/groonga/main.rb
119
+ - examples/groonga/mroonga-icon-full-size.png
120
+ - examples/groonga/mroonga-logo.png
121
+ - examples/groonga/nroonga-icon-full-size.png
122
+ - examples/groonga/nroonga-logo.png
123
+ - examples/groonga/rroonga-icon-full-size.png
124
+ - examples/groonga/rroonga-logo.png
116
125
  - lib/bricks_meet_balls.rb
117
126
  - lib/bricks_meet_balls/ball.rb
118
127
  - lib/bricks_meet_balls/bar.rb