scorched_earth 5.0.5.pre-java → 5.0.6.pre-java

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: f5194b6a1289adc43e4d2e6a619f1f92919f1924
4
- data.tar.gz: 5a5a91fb6b9dbd47e948fdbb1934b70976242dae
3
+ metadata.gz: 7505d83d699906cd00a3bd4979b8baa64db2f0a3
4
+ data.tar.gz: b62088514c563231b8168f16c5d023906a92469f
5
5
  SHA512:
6
- metadata.gz: 6d2f4458c1e45261dd3000dd32d41d93f1583ea2e7deb5f45ad6b40af29b0553a9e308b9f872fcd7fc0ebde40b7427b68710e9af0a4f60ff76b97f5a89f19100
7
- data.tar.gz: e67a02cfd9786bef1a123bbdb8fdf5165961718652fcdd9842700d93bd89f49257760a212ab7e9e3ef0c5b3bf3c51eff91eeb5944b190dbcf6fc8091080c798d
6
+ metadata.gz: 439d7023baa8a40554279de123bc2c7ffdd7f7de8f6d5404593eaf1ef607b1778770da363f82a5ccadb05036fcbe94dcd39a59b2ba410802a446e76acc612557
7
+ data.tar.gz: 0d2539974b88f7c08bee4908017ecdd5a4d3b063638cca55a936f1e1d778331efd960a5164516bae3d1044ea58ce814ca2b98f14a02e3530f0dfef5656e4e8a3
@@ -15,13 +15,17 @@ module ScorchedEarth
15
15
  subscribers << [klass, block]
16
16
  end
17
17
 
18
+ def run(event)
19
+ subscribers.each do |klass, block|
20
+ block.call event if event.is_a? klass
21
+ end
22
+ end
23
+
18
24
  def process!
19
25
  processing = Array.new(queue.size) { queue.pop }
20
26
 
21
27
  processing.each do |event|
22
- subscribers.each do |klass, block|
23
- block.call event if event.is_a? klass
24
- end
28
+ run event
25
29
  end
26
30
  end
27
31
  end
@@ -0,0 +1,5 @@
1
+ module ScorchedEarth
2
+ module Events
3
+ GameRender = Struct.new(:graphics)
4
+ end
5
+ end
@@ -8,8 +8,11 @@ require 'scorched_earth/objects/explosion'
8
8
  require 'scorched_earth/objects/mouse'
9
9
  require 'scorched_earth/event_runner'
10
10
  require 'scorched_earth/events/game_update'
11
+ require 'scorched_earth/events/game_render'
11
12
  require 'scorched_earth/subscribers/game_over/timeout'
12
13
  require 'scorched_earth/subscribers/game_update/collisions'
14
+ require 'scorched_earth/subscribers/game_update/delta'
15
+ require 'scorched_earth/subscribers/game_render'
13
16
  require 'scorched_earth/subscribers/hit/deform'
14
17
  require 'scorched_earth/subscribers/hit/effect'
15
18
  require 'scorched_earth/subscribers/hit/radius'
@@ -47,24 +50,12 @@ module ScorchedEarth
47
50
  end
48
51
 
49
52
  def update(delta)
50
- @objects = objects
51
- .map { |object| object.update delta }
52
- .compact
53
-
54
53
  event_runner.publish Events::GameUpdate.new delta
55
54
  event_runner.process!
56
55
  end
57
56
 
58
57
  def render(graphics)
59
- graphics.set_color color_palette.get('sky')
60
- graphics.fill_rect 0, 0, width, height
61
-
62
- Renders::Mouse.new(mouse, current_player).call(graphics, color_palette)
63
-
64
- objects.each { |object| Renders.find(object).call(graphics, color_palette) }
65
- players.each { |player| Renders.find(player).call(graphics, color_palette) }
66
-
67
- Renders::Map.new(array).call(graphics, color_palette)
58
+ event_runner.run Events::GameRender.new graphics
68
59
  end
69
60
 
70
61
  def publish(event)
@@ -54,7 +54,7 @@ module ScorchedEarth
54
54
 
55
55
  image = graphics
56
56
  .get_device_configuration
57
- .create_compatible_image width, height, Transparency::TRANSLUCENT
57
+ .create_compatible_image width, height, java.awt.Transparency::TRANSLUCENT
58
58
 
59
59
  image.set_acceleration_priority 1
60
60
 
@@ -0,0 +1,23 @@
1
+ module ScorchedEarth
2
+ module Subscribers
3
+ module GameRender
4
+ def setup
5
+ super
6
+
7
+ event_runner.subscribe(Events::GameRender) do |event|
8
+ graphics = event.graphics
9
+
10
+ graphics.set_color color_palette.get('sky')
11
+ graphics.fill_rect 0, 0, width, height
12
+
13
+ Renders::Mouse.new(mouse, current_player).call(graphics, color_palette)
14
+
15
+ objects.each { |object| Renders.find(object).call(graphics, color_palette) }
16
+ players.each { |player| Renders.find(player).call(graphics, color_palette) }
17
+
18
+ Renders::Map.new(array).call(graphics, color_palette)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,13 @@
1
+ module ScorchedEarth
2
+ module Subscribers
3
+ module Delta
4
+ def setup
5
+ super
6
+
7
+ event_runner.subscribe(Events::GameUpdate) do |event|
8
+ @objects = objects.map { |object| object.update event.delta }.compact
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module ScorchedEarth
2
- VERSION = '5.0.5.pre'.freeze
2
+ VERSION = '5.0.6.pre'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scorched_earth
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.5.pre
4
+ version: 5.0.6.pre
5
5
  platform: java
6
6
  authors:
7
7
  - James Moriarty
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-18 00:00:00.000000000 Z
11
+ date: 2016-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -101,6 +101,7 @@ files:
101
101
  - lib/scorched_earth.rb
102
102
  - lib/scorched_earth/event_runner.rb
103
103
  - lib/scorched_earth/events/game_over.rb
104
+ - lib/scorched_earth/events/game_render.rb
104
105
  - lib/scorched_earth/events/game_update.rb
105
106
  - lib/scorched_earth/events/hit.rb
106
107
  - lib/scorched_earth/events/mouse_moved.rb
@@ -125,7 +126,9 @@ files:
125
126
  - lib/scorched_earth/services/deform.rb
126
127
  - lib/scorched_earth/services/wave.rb
127
128
  - lib/scorched_earth/subscribers/game_over/timeout.rb
129
+ - lib/scorched_earth/subscribers/game_render.rb
128
130
  - lib/scorched_earth/subscribers/game_update/collisions.rb
131
+ - lib/scorched_earth/subscribers/game_update/delta.rb
129
132
  - lib/scorched_earth/subscribers/hit/deform.rb
130
133
  - lib/scorched_earth/subscribers/hit/effect.rb
131
134
  - lib/scorched_earth/subscribers/hit/radius.rb