chingu 0.9rc8 → 0.9rc9

Sign up to get free protection for your applications and to get access to all the features.
@@ -411,21 +411,22 @@ Another example:
411
411
  class Game < Chingu::Window
412
412
  def initialize
413
413
  #
414
- # We start by pushing Menu to the game state stack, making it active as the only state on stack.
415
- # :setup => :false which will skip setup() from being called (standard when switching to a new state)
414
+ # We start by pushing Menu to the game state stack, making it active as it's the only state on stack.
415
+ #
416
+ # :setup => :false will skip setup() from being called (standard when switching to a new state)
416
417
  #
417
418
  push_game_state(Menu, :setup => false)
418
419
 
419
420
  #
420
421
  # We push another game state to the stack, Play. We now have 2 states, which active being first / active.
421
422
  #
422
- # :finalize => false will skip setup() from being called on game state
423
- # that's being pushed down the stack, in this case Intro.setup().
423
+ # :finalize => false will skip finalize() from being called on game state
424
+ # that's being pushed down the stack, in this case Menu.finalize().
424
425
  #
425
426
  push_game_state(Play, :finalize => false)
426
427
 
427
428
  #
428
- # This would remove Play state from the stack, going back to the Menu-state. But also:
429
+ # Next, we remove Play state from the stack, going back to the Menu-state. But also:
429
430
  # .. skipping the standard call to Menu#setup (the new game state)
430
431
  # .. skipping the standard call to Play#finalize (the current game state)
431
432
  #
@@ -435,7 +436,11 @@ Another example:
435
436
 
436
437
  #
437
438
  # Replace the current game state with a new one.
438
- # :setup and :finalize options are available here as well.
439
+ #
440
+ # :setup and :finalize options are available here as well but:
441
+ # .. setup and finalize are always skipped for Menu (the state under Play and Credits)
442
+ # .. the finalize option only affects the popped game state
443
+ # .. the setup option only affects the game state you're switching to
439
444
  #
440
445
  switch_game_state(Credits)
441
446
  end
@@ -36,11 +36,10 @@ require_all "#{CHINGU_ROOT}/chingu/traits"
36
36
  require_all "#{CHINGU_ROOT}/chingu/async"
37
37
  require_all "#{CHINGU_ROOT}/chingu/async_tasks"
38
38
  require_all "#{CHINGU_ROOT}/chingu"
39
+ require_all "#{CHINGU_ROOT}/chingu/version"
39
40
 
40
41
  module Chingu
41
- VERSION = "0.9rc8"
42
-
43
42
  DEBUG_COLOR = Gosu::Color.new(0xFFFF0000)
44
43
  DEBUG_ZORDER = 9999
45
44
  INFINITY = 1.0 / 0
46
- end
45
+ end
@@ -223,7 +223,10 @@ module Chingu
223
223
  # If the object isn't being managed by Chingu (ie. you're doing manual update/draw calls) the object is only frozen, not removed from any updae cycle (because you are controlling that).
224
224
  #
225
225
  def destroy
226
- @parent.remove_game_object(self) if @parent
226
+ if @parent
227
+ @parent.remove_game_object(self)
228
+ @parent.remove_input_client(self)
229
+ end
227
230
  self.class.instances.delete(self)
228
231
  end
229
232
  alias :destroy! :destroy
@@ -133,7 +133,8 @@ module Chingu
133
133
  def each_bounding_circle_collision(*klasses)
134
134
  Array(klasses).each do |klass|
135
135
  (klass.respond_to?(:all) ? klass.all : Array(klass)).each do |object|
136
- next unless self.collidable && object.collidable
136
+ next if object == self
137
+ next unless self.collidable && object.collidable
137
138
  yield(self, object) if Gosu.distance(self.x, self.y, object.x, object.y) < self.radius + object.radius
138
139
  end
139
140
  end
@@ -146,7 +147,8 @@ module Chingu
146
147
  def each_bounding_box_collision(*klasses)
147
148
  Array(klasses).each do |klass|
148
149
  (klass.respond_to?(:all) ? klass.all : Array(klass)).each do |object|
149
- return false unless self.collidable && object.collidable
150
+ next if object == self
151
+ next unless self.collidable && object.collidable
150
152
  yield(self, object) if self.bounding_box.collide_rect?(object.bounding_box)
151
153
  end
152
154
  end
@@ -259,4 +261,4 @@ module Chingu
259
261
  end
260
262
  end
261
263
  end
262
- end
264
+ end
@@ -0,0 +1,4 @@
1
+ module Chingu
2
+ VERSION = "0.9rc9"
3
+ end
4
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chingu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9rc8
4
+ version: 0.9rc9
5
5
  prerelease: 3
6
6
  platform: ruby
7
7
  authors:
@@ -9,33 +9,33 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-20 00:00:00.000000000 Z
12
+ date: 2012-09-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gosu
16
- requirement: &25541928 !ruby/object:Gem::Requirement
16
+ requirement: &26152668 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.7.43
21
+ version: 0.7.45
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *25541928
24
+ version_requirements: *26152668
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: gosu
27
- requirement: &25541628 !ruby/object:Gem::Requirement
27
+ requirement: &26152380 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
31
31
  - !ruby/object:Gem::Version
32
- version: 0.7.43
32
+ version: 0.7.45
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *25541628
35
+ version_requirements: *26152380
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &25541340 !ruby/object:Gem::Requirement
38
+ requirement: &26152092 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.1.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *25541340
46
+ version_requirements: *26152092
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: watchr
49
- requirement: &25541052 !ruby/object:Gem::Requirement
49
+ requirement: &26151804 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *25541052
57
+ version_requirements: *26151804
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rcov
60
- requirement: &25540716 !ruby/object:Gem::Requirement
60
+ requirement: &26151516 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *25540716
68
+ version_requirements: *26151516
69
69
  description: OpenGL accelerated 2D game framework for Ruby. Builds on Gosu (Ruby/C++)
70
70
  which provides all the core functionality. Chingu adds simple yet powerful game
71
71
  states, prettier input handling, deployment safe asset-handling, a basic re-usable
@@ -143,6 +143,7 @@ files:
143
143
  - lib/chingu/traits/timer.rb
144
144
  - lib/chingu/traits/velocity.rb
145
145
  - lib/chingu/traits/viewport.rb
146
+ - lib/chingu/version.rb
146
147
  - lib/chingu/viewport.rb
147
148
  - lib/chingu/window.rb
148
149
  - lib/chingu.rb