chingu 0.5.8 → 0.5.8.1

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/Manifest.txt CHANGED
@@ -71,6 +71,7 @@ lib/chingu/helpers/gfx.rb
71
71
  lib/chingu/helpers/input_client.rb
72
72
  lib/chingu/helpers/input_dispatcher.rb
73
73
  lib/chingu/helpers/rotation_center.rb
74
+ lib/chingu/high_score.rb
74
75
  lib/chingu/inflector.rb
75
76
  lib/chingu/input.rb
76
77
  lib/chingu/named_resource.rb
data/README.rdoc CHANGED
@@ -12,7 +12,8 @@ Chingu has started to settle down, thouch core classes and naming can still chan
12
12
 
13
13
 
14
14
  == DESCRIPTION
15
- Game framework built on top of the OpenGL accelerated game lib Gosu.
15
+ OpenGL accelerated 2D game framework for Ruby.
16
+ Builds on the awesome Gosu (Ruby/C++) which provides all the core functionality.
16
17
  It adds simple yet powerful game states, prettier input handling, deployment safe asset-handling, a basic re-usable game object and automation of common task.
17
18
 
18
19
 
@@ -200,7 +201,8 @@ The basic ideas behind it are:
200
201
  * Keep naming close to Gosu, but add smart convenient methods / shortcuts and a more rubyish feeling
201
202
  * No game logic allowed in GameObject, since that's not likely to be useful for others.
202
203
 
203
- I've chose to base it around Image#draw_rot. So basically all the arguments that you pass to draw_rot can be passed to GameObject#new when creating a new object, an example using almost all arguments would be:
204
+ It's based around Image#draw_rot. So basically all the arguments that you pass to draw_rot can be passed to GameObject#new when creating a new object.
205
+ An example using almost all arguments would be:
204
206
 
205
207
  #
206
208
  # You probably recognize the arguments from http://www.libgosu.org/rdoc/classes/Gosu/Image.html#M000023
@@ -302,6 +304,10 @@ Game states aren't complicated. In Chingu a GameState is a class that behaves mo
302
304
  # A simple GameState-example
303
305
  class Intro < Chingu::GameState
304
306
 
307
+ def initialize(options)
308
+ # called as usual when class is created, load resources and simular here
309
+ end
310
+
305
311
  def update
306
312
  # game logic here
307
313
  end
@@ -310,7 +316,7 @@ Game states aren't complicated. In Chingu a GameState is a class that behaves mo
310
316
  # screen manipulation here
311
317
  end
312
318
 
313
- # Called when we enter the game state
319
+ # Called Each time when we enter the game state, use this to reset the gamestate to a "virgin state"
314
320
  def setup
315
321
  @player.angle = 0 # point player upwards
316
322
  end
@@ -379,10 +385,10 @@ Another example:
379
385
 
380
386
  A GameState in Chingu is just a class with the following instance methods:
381
387
 
382
- * initialize() - called only once with push_game_state(Intro) but every time with push_game_state(Intro.new)
383
- * setup() - called each time the game state becomes active.
384
- * button_down(id) - Called when a button is down
385
- * button_up(id) - Called when a button is released
388
+ * initialize() - as you might expect, called when GameState is created.
389
+ * setup() - called each time the game state becomes active.
390
+ * button_down(id) - called when a button is down.
391
+ * button_up(id) - called when a button is released.
386
392
  * update() - just as in your normal game loop, put your game logic here.
387
393
  * draw() - just as in your normal game loop, put your screen manipulation here.
388
394
  * finalize() - called when a game state de-activated (for example by pushing a new one on top with push_game_state)
@@ -415,7 +421,7 @@ Or Chingus shortcut:
415
421
  end
416
422
  end
417
423
 
418
- Chingus inputhandler will detect that Menu is a gamestate-class, create a new instance, cache it and activate it with push_game_state().
424
+ Chingus inputhandler will detect that Menu is a GameState-class, create a new instance and activate it with push_game_state().
419
425
 
420
426
  === Traits
421
427
  Traits (often called behaivors) is a way of adding logic to any class inheriting from BasicGameObject / GameObject.
@@ -561,6 +567,8 @@ There's 1 zillion ways of naming stuff. As a general guideline I've tried to fol
561
567
  If Gosu didn't have a good name for a certain thing/method I've checked Ruby itself and then Rails since alot of Ruby-devs are familiar with Rails.
562
568
  GameObject.all is naming straight from rails for example. Most stuff in GameObject follow the naming from Gosus Image#draw_rot.
563
569
 
570
+ As far as possible, use correct rubyfied english game_objects, not gameobjects. class HighScore, not Highscore.
571
+
564
572
  == TODO:
565
573
  * add :padding and :align => :topleft etc to class Text
566
574
  * (skip) rename Chingu::Window so 'include Chingu' and 'include Gosu' wont make Window collide
data/chingu.gemspec CHANGED
@@ -2,22 +2,23 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{chingu}
5
- s.version = "0.5.8"
5
+ s.version = "0.5.8.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["ippa"]
9
- s.date = %q{2009-10-18}
10
- s.description = %q{Game framework built on top of the OpenGL accelerated game lib Gosu.
9
+ s.date = %q{2009-10-19}
10
+ s.description = %q{OpenGL accelerated 2D game framework for Ruby.
11
+ Builds on the awesome Gosu (Ruby/C++) which provides all the core functionality.
11
12
  It adds simple yet powerful game states, prettier input handling, deployment safe asset-handling, a basic re-usable game object and automation of common task.}
12
13
  s.email = ["ippa@rubylicio.us"]
13
14
  s.extra_rdoc_files = ["History.txt", "Manifest.txt", "benchmarks/README.txt"]
14
- s.files = ["History.txt", "LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "benchmarks/README.txt", "benchmarks/benchmark.rb", "benchmarks/benchmark3.rb", "benchmarks/benchmark4.rb", "benchmarks/benchmark5.rb", "benchmarks/benchmark6.rb", "benchmarks/meta_benchmark.rb", "benchmarks/meta_benchmark2.rb", "chingu.gemspec", "examples/example1.rb", "examples/example10.rb", "examples/example11.rb", "examples/example12.rb", "examples/example2.rb", "examples/example3.rb", "examples/example4.rb", "examples/example5.rb", "examples/example6.rb", "examples/example7.rb", "examples/example8.rb", "examples/example9.rb", "examples/game1.rb", "examples/media/Parallax-scroll-example-layer-0.png", "examples/media/Parallax-scroll-example-layer-1.png", "examples/media/Parallax-scroll-example-layer-2.png", "examples/media/Parallax-scroll-example-layer-3.png", "examples/media/background1.png", "examples/media/bullet.png", "examples/media/bullet_hit.wav", "examples/media/city1.csv", "examples/media/city1.png", "examples/media/city2.png", "examples/media/droid.bmp", "examples/media/enemy_bullet.png", "examples/media/explosion.wav", "examples/media/fire_bullet.png", "examples/media/fireball.png", "examples/media/laser.wav", "examples/media/particle.png", "examples/media/plane.csv", "examples/media/plane.png", "examples/media/ruby.png", "examples/media/saucer.csv", "examples/media/saucer.gal", "examples/media/saucer.png", "examples/media/spaceship.png", "examples/media/stickfigure.bmp", "examples/media/stickfigure.png", "examples/media/video_games.png", "lib/chingu.rb", "lib/chingu/animation.rb", "lib/chingu/assets.rb", "lib/chingu/basic_game_object.rb", "lib/chingu/core_extensions.rb", "lib/chingu/fpscounter.rb", "lib/chingu/game_object.rb", "lib/chingu/game_object_list.rb", "lib/chingu/game_state.rb", "lib/chingu/game_state_manager.rb", "lib/chingu/game_states/debug.rb", "lib/chingu/game_states/fade_to.rb", "lib/chingu/game_states/pause.rb", "lib/chingu/helpers/game_object.rb", "lib/chingu/helpers/game_state.rb", "lib/chingu/helpers/gfx.rb", "lib/chingu/helpers/input_client.rb", "lib/chingu/helpers/input_dispatcher.rb", "lib/chingu/helpers/rotation_center.rb", "lib/chingu/inflector.rb", "lib/chingu/input.rb", "lib/chingu/named_resource.rb", "lib/chingu/parallax.rb", "lib/chingu/particle.rb", "lib/chingu/rect.rb", "lib/chingu/require_all.rb", "lib/chingu/text.rb", "lib/chingu/traits/collision_detection.rb", "lib/chingu/traits/effect.rb", "lib/chingu/traits/retrofy.rb", "lib/chingu/traits/timer.rb", "lib/chingu/traits/velocity.rb", "lib/chingu/window.rb"]
15
+ s.files = ["History.txt", "LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "benchmarks/README.txt", "benchmarks/benchmark.rb", "benchmarks/benchmark3.rb", "benchmarks/benchmark4.rb", "benchmarks/benchmark5.rb", "benchmarks/benchmark6.rb", "benchmarks/meta_benchmark.rb", "benchmarks/meta_benchmark2.rb", "chingu.gemspec", "examples/example1.rb", "examples/example10.rb", "examples/example11.rb", "examples/example12.rb", "examples/example2.rb", "examples/example3.rb", "examples/example4.rb", "examples/example5.rb", "examples/example6.rb", "examples/example7.rb", "examples/example8.rb", "examples/example9.rb", "examples/game1.rb", "examples/media/Parallax-scroll-example-layer-0.png", "examples/media/Parallax-scroll-example-layer-1.png", "examples/media/Parallax-scroll-example-layer-2.png", "examples/media/Parallax-scroll-example-layer-3.png", "examples/media/background1.png", "examples/media/bullet.png", "examples/media/bullet_hit.wav", "examples/media/city1.csv", "examples/media/city1.png", "examples/media/city2.png", "examples/media/droid.bmp", "examples/media/enemy_bullet.png", "examples/media/explosion.wav", "examples/media/fire_bullet.png", "examples/media/fireball.png", "examples/media/laser.wav", "examples/media/particle.png", "examples/media/plane.csv", "examples/media/plane.png", "examples/media/ruby.png", "examples/media/saucer.csv", "examples/media/saucer.gal", "examples/media/saucer.png", "examples/media/spaceship.png", "examples/media/stickfigure.bmp", "examples/media/stickfigure.png", "examples/media/video_games.png", "lib/chingu.rb", "lib/chingu/animation.rb", "lib/chingu/assets.rb", "lib/chingu/basic_game_object.rb", "lib/chingu/core_extensions.rb", "lib/chingu/fpscounter.rb", "lib/chingu/game_object.rb", "lib/chingu/game_object_list.rb", "lib/chingu/game_state.rb", "lib/chingu/game_state_manager.rb", "lib/chingu/game_states/debug.rb", "lib/chingu/game_states/fade_to.rb", "lib/chingu/game_states/pause.rb", "lib/chingu/helpers/game_object.rb", "lib/chingu/helpers/game_state.rb", "lib/chingu/helpers/gfx.rb", "lib/chingu/helpers/input_client.rb", "lib/chingu/helpers/input_dispatcher.rb", "lib/chingu/helpers/rotation_center.rb", "lib/chingu/high_score.rb", "lib/chingu/inflector.rb", "lib/chingu/input.rb", "lib/chingu/named_resource.rb", "lib/chingu/parallax.rb", "lib/chingu/particle.rb", "lib/chingu/rect.rb", "lib/chingu/require_all.rb", "lib/chingu/text.rb", "lib/chingu/traits/collision_detection.rb", "lib/chingu/traits/effect.rb", "lib/chingu/traits/retrofy.rb", "lib/chingu/traits/timer.rb", "lib/chingu/traits/velocity.rb", "lib/chingu/window.rb"]
15
16
  s.homepage = %q{http://github.com/ippa/chingu/tree/master}
16
17
  s.rdoc_options = ["--main", "README.rdoc"]
17
18
  s.require_paths = ["lib"]
18
19
  s.rubyforge_project = %q{chingu}
19
20
  s.rubygems_version = %q{1.3.5}
20
- s.summary = %q{Game framework built on top of the OpenGL accelerated game lib Gosu}
21
+ s.summary = %q{OpenGL accelerated 2D game framework for Ruby}
21
22
 
22
23
  if s.respond_to? :specification_version then
23
24
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
data/lib/chingu.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -26,7 +26,8 @@ require 'rubygems' unless RUBY_VERSION =~ /1\.9/
26
26
  require 'gosu'
27
27
  require File.join(CHINGU_ROOT,"chingu","require_all") # Thanks to http://github.com/tarcieri/require_all !
28
28
  require_all "#{CHINGU_ROOT}/chingu"
29
+ #autoload :OpenStruct, "ostruct"
29
30
 
30
31
  module Chingu
31
- VERSION = "0.5.8"
32
+ VERSION = "0.5.8.1"
32
33
  end
@@ -3,7 +3,11 @@ module Chingu
3
3
  # The Animation-class helps you load and manage a tileanimation.
4
4
  # A Tileanimation is a file where all the frames are put after eachother.
5
5
  #
6
- # An easy to use program to create tileanimations is http://tilestudio.sourceforge.net/
6
+ # An easy to use program to create tileanimations is http://tilestudio.sourceforge.net/ or http://www.humanbalance.net/gale/us/
7
+ #
8
+ # TODO:
9
+ # Support frames in invidual image-files?
10
+ # Is autodetection of width / height possible?
7
11
  #
8
12
  class Animation
9
13
  attr_accessor :frames, :delay
@@ -13,7 +17,7 @@ module Chingu
13
17
  #
14
18
  # - loop: [true|false]. After the last frame is used, start from the beginning.
15
19
  # - bounce: [true|false]. After the last frame is used, play it backwards untill the first frame is used again, then start playing forwards again.
16
- # - file: Tile-file to cut up animation frames from.
20
+ # - file: Tile-file to cut up animation frames from. Could be a full path or just a name -- then it will look for media_path(file)
17
21
  # - width: width of each frame in the tileanimation
18
22
  # - height: width of each frame in the tileanimation
19
23
  # - size: [x,y] specify width/height with 1 argument (an array)
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -108,11 +108,13 @@ module Chingu
108
108
  # Make sure the game state knows about the manager
109
109
  new_state.game_state_manager = self
110
110
 
111
-
112
111
  # Give the soon-to-be-disabled state a chance to clean up by calling finalize() on it.
113
112
  @previous_game_state = current_game_state
114
113
  current_game_state.finalize if current_game_state.respond_to?(:finalize) && options[:finalize]
115
114
 
115
+ # So BasicGameObject#create connects object to new state in its setup()
116
+ self.inside_state = new_state
117
+
116
118
  # Call setup
117
119
  new_state.setup if new_state.respond_to?(:setup) && options[:setup]
118
120
 
@@ -128,7 +130,7 @@ module Chingu
128
130
  @game_states[-1] = new_state
129
131
  end
130
132
  end
131
- self.inside_state = current_game_state
133
+ ## MOVEDE: self.inside_state = current_game_state
132
134
  end
133
135
  end
134
136
  alias :switch :switch_game_state
@@ -144,6 +146,10 @@ module Chingu
144
146
  new_state = game_state_instance(state)
145
147
 
146
148
  if new_state
149
+
150
+ # So BasicGameObject#create connects object to new state in its setup()
151
+ self.inside_state = new_state
152
+
147
153
  # Call setup
148
154
  new_state.setup if new_state.respond_to?(:setup) && options[:setup]
149
155
 
@@ -162,7 +168,7 @@ module Chingu
162
168
  # Push new state on top of stack and therefore making it active
163
169
  @game_states.push(new_state)
164
170
  end
165
- self.inside_state = current_game_state
171
+ ## MOVED: self.inside_state = current_game_state
166
172
  end
167
173
  end
168
174
  alias :push :push_game_state
@@ -185,7 +191,10 @@ module Chingu
185
191
  # Activate the game state "bellow" current one with a simple Array.pop
186
192
  #
187
193
  @game_states.pop
188
-
194
+
195
+ # So BasicGameObject#create connects object to new state in its setup()
196
+ self.inside_state = current_game_state
197
+
189
198
  # Call setup on the new current state
190
199
  current_game_state.setup if current_game_state.respond_to?(:setup) && options[:setup]
191
200
 
@@ -194,7 +203,7 @@ module Chingu
194
203
  transitional_game_state = @transitional_game_state.new(current_game_state, @transitional_game_state_options)
195
204
  self.switch_game_state(transitional_game_state, :transitional => false)
196
205
  end
197
- self.inside_state = current_game_state
206
+ ## MOVED: self.inside_state = current_game_state
198
207
  end
199
208
  alias :pop :pop_game_state
200
209
 
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -19,12 +19,12 @@
19
19
  #
20
20
  #++
21
21
 
22
-
23
- #
24
- # Debug game state (F1 is default key to start/exit debug win, 'p' to pause game)
25
- #
26
- module Chingu
22
+ module Chingu
27
23
  module GameStates
24
+
25
+ #
26
+ # Debug game state (F1 is default key to start/exit debug win, 'p' to pause game)
27
+ #
28
28
  class Debug < Chingu::GameState
29
29
  def initialize(options)
30
30
  super
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -20,18 +20,19 @@
20
20
  #++
21
21
 
22
22
 
23
- #
24
- # Premade game state for chingu - Fade between two game states
25
- # Fade from the current game state to a new one whenever with:
26
- #
27
- # push_game_state(Chingu::GameStates::FadeTo.new(new_game_state, :speed => 3))
28
- #
29
- # .. Or make your whole game look better with 1 line:
30
- #
31
- # transitional_game_state(Chingu::GameStates::FadeTo, :speed => 10)
32
- #
33
23
  module Chingu
34
24
  module GameStates
25
+
26
+ #
27
+ # Premade game state for chingu - Fade between two game states
28
+ # Fade from the current game state to a new one whenever with:
29
+ #
30
+ # push_game_state(Chingu::GameStates::FadeTo.new(new_game_state, :speed => 3))
31
+ #
32
+ # .. Or make your whole game look better with 1 line:
33
+ #
34
+ # transitional_game_state(Chingu::GameStates::FadeTo, :speed => 10)
35
+ #
35
36
  class FadeTo < Chingu::GameState
36
37
 
37
38
  def initialize(new_game_state, options = {})
@@ -65,7 +66,7 @@ module Chingu
65
66
  end
66
67
 
67
68
  def draw
68
- # Stop endless loops
69
+ # Stop possible endless loops
69
70
  if @drawn == false
70
71
  @drawn = true
71
72
 
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -19,17 +19,16 @@
19
19
  #
20
20
  #++
21
21
 
22
-
23
-
24
- #
25
- # Premade game state for chingu - A simple pause state.
26
- # Pause whenever with:
27
- # push_game_state(Chingu::GameStates::Pause)
28
- #
29
- # requires global $window
30
- #
31
22
  module Chingu
32
23
  module GameStates
24
+
25
+ #
26
+ # Premade game state for chingu - A simple pause state.
27
+ # Pause whenever with:
28
+ # push_game_state(Chingu::GameStates::Pause)
29
+ #
30
+ # requires the global $window set to the instance of Gosu::Window (automaticly handled if you use Chingu::Window)
31
+ #
33
32
  class Pause < Chingu::GameState
34
33
  def initialize(options = {})
35
34
  super
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -19,7 +19,6 @@
19
19
  #
20
20
  #++
21
21
 
22
-
23
22
  module Chingu
24
23
  module Helpers
25
24
 
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -19,7 +19,6 @@
19
19
  #
20
20
  #++
21
21
 
22
-
23
22
  module Chingu
24
23
  module Helpers
25
24
 
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -19,7 +19,6 @@
19
19
  #
20
20
  #++
21
21
 
22
-
23
22
  module Chingu
24
23
  module Helpers
25
24
 
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -19,7 +19,6 @@
19
19
  #
20
20
  #++
21
21
 
22
-
23
22
  module Chingu
24
23
  module Helpers
25
24
 
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -19,7 +19,6 @@
19
19
  #
20
20
  #++
21
21
 
22
-
23
22
  module Chingu
24
23
  module Helpers
25
24
  module RotationCenter
@@ -0,0 +1,60 @@
1
+ #--
2
+ #
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
+ # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
+ #
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2.1 of the License, or (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the Free Software
18
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ #
20
+ #++
21
+
22
+
23
+ module Chingu
24
+
25
+ #
26
+ # Highscore-class
27
+ #
28
+ # - Keeps a local YAML file with highscores, default highscores.yml in root game dir.
29
+ # - Add, delete, clear highscores
30
+ # - Iterate through highscores with simple Highscore#each
31
+ #
32
+ class HighScore
33
+ def initialize(options = {})
34
+ @file = options[:file] || "high_scores.yml"
35
+ @high_scores = Array.new
36
+
37
+ #OpenStruct.new()
38
+ end
39
+
40
+ #
41
+ #
42
+ #
43
+ def add(name, score)
44
+
45
+ end
46
+ alias << add
47
+
48
+ def each
49
+ @highscores.each { |highscore| yield highscore }
50
+ end
51
+
52
+ def save
53
+ end
54
+
55
+ def self.all
56
+
57
+ end
58
+ end
59
+
60
+ end
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
data/lib/chingu/input.rb CHANGED
@@ -1,3 +1,24 @@
1
+ #--
2
+ #
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
+ # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
+ #
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2.1 of the License, or (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the Free Software
18
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ #
20
+ #++
21
+
1
22
  module Chingu
2
23
  module Input
3
24
  include Gosu::Button
@@ -1,9 +1,35 @@
1
+ #--
1
2
  #
2
- # Class for simple parallaxscrolling
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
+ # Copyright (C) 2009 ippa / ippa@rubylicio.us
3
5
  #
4
- # See: http://en.wikipedia.org/wiki/Parallax_scrolling
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2.1 of the License, or (at your option) any later version.
5
10
  #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the Free Software
18
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ #
20
+ #++
21
+
6
22
  module Chingu
23
+ #
24
+ # Class for simple parallaxscrolling
25
+ #
26
+ # See http://en.wikipedia.org/wiki/Parallax_scrolling for information about parallaxscrolling.
27
+ #
28
+ # Basic usage:
29
+ # @parallax = Chingu::Parallax.create(:x => 0, :y => 0)
30
+ # @parallax << Chingu::ParallaxLayer.new(:image => "far_away_mountins.png", :damping => 20, :center => 0)
31
+ # @parallax << Chingu::ParallaxLayer.new(:image => "trees.png", :damping => 5, :center => 0)
32
+ #
7
33
  class Parallax < Chingu::GameObject
8
34
  attr_reader :layers
9
35
 
data/lib/chingu/text.rb CHANGED
@@ -1,3 +1,24 @@
1
+ #--
2
+ #
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
+ # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
+ #
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2.1 of the License, or (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the Free Software
18
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ #
20
+ #++
21
+
1
22
  module Chingu
2
23
  #
3
24
  # Text is a class to give the use of Gosu::Font more rubyish feel and fit it better into Chingu.
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -19,7 +19,6 @@
19
19
  #
20
20
  #++
21
21
 
22
-
23
22
  module Chingu
24
23
  module Traits
25
24
  #
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -19,7 +19,6 @@
19
19
  #
20
20
  #++
21
21
 
22
-
23
22
  module Chingu
24
23
  module Traits
25
24
 
@@ -30,9 +29,9 @@ module Chingu
30
29
  # fade(amount) # modifies @color.alpha
31
30
  #
32
31
  # Also adds attributes
33
- # rotation_rate=amount # adds amount to @angle each game loop
34
- # scale_rate=amount # adds amount to @factor_x and @factor_y each game loop
35
- # fade_rate=amount # adds amount to @color.alpha each game loop
32
+ # rotation_rate = amount # adds amount to @angle each game loop
33
+ # scale_rate = amount # adds amount to @factor_x and @factor_y each game loop
34
+ # fade_rate = amount # adds amount to @color.alpha each game loop
36
35
  #
37
36
  #
38
37
  # WARNING, I'm very close to deprecating this trait, it doesn't do much and still introduces new names to learn.
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -19,7 +19,6 @@
19
19
  #
20
20
  #++
21
21
 
22
-
23
22
  module Chingu
24
23
  module Traits
25
24
  #
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -19,9 +19,9 @@
19
19
  #
20
20
  #++
21
21
 
22
-
23
22
  module Chingu
24
23
  module Traits
24
+
25
25
  #
26
26
  # A chingu trait providing timer-methods to its includer, examples:
27
27
  # during(300) { @color = Color.new(0xFFFFFFFF) } # forces @color to white ever update for 300 ms
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  #
3
- # Chingu -- Game framework built on top of the opengl accelerated gamelib Gosu
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
4
  # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -19,7 +19,6 @@
19
19
  #
20
20
  #++
21
21
 
22
-
23
22
  module Chingu
24
23
  module Traits
25
24
  #
data/lib/chingu/window.rb CHANGED
@@ -1,5 +1,37 @@
1
+ #--
2
+ #
3
+ # Chingu -- OpenGL accelerated 2D game framework for Ruby
4
+ # Copyright (C) 2009 ippa / ippa@rubylicio.us
5
+ #
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2.1 of the License, or (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the Free Software
18
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ #
20
+ #++
21
+
1
22
  module Chingu
2
23
 
24
+ #
25
+ # See http://www.libgosu.org/rdoc/classes/Gosu/Window.html
26
+ #
27
+ # On top of that we add:
28
+ # - Default widht / height, --fullscreen option from console
29
+ # - Sets a global variable $window = self, which is then used throughout Chingu
30
+ # - Defaultd #update which updates all game_objects which are not pasued
31
+ # - Default #draw which draws all game_objects which are visible
32
+ # - Default Asset-directories media/, sfx/, gfx/ etc.
33
+ # - Tracking of button_up/button_down etc to enable Chingus pretty inputhandling
34
+ #
3
35
  class Window < Gosu::Window
4
36
  include Chingu::Helpers::GFX # Adds fill(), fade() etc to each game state
5
37
  include Chingu::Helpers::GameState # Easy access to the global game state-queue
@@ -9,16 +41,6 @@ module Chingu
9
41
 
10
42
  attr_reader :root, :game_state_manager, :game_objects, :milliseconds_since_last_tick
11
43
 
12
- #
13
- # See http://www.libgosu.org/rdoc/classes/Gosu/Window.html
14
- #
15
- # On top of that we add:
16
- # - Default widht / height, --fullscreen option from console
17
- # - Global variable $window
18
- # - Standard #update which updates all Chingu::GameObject's
19
- # - Standard #draw which goes through
20
- # - Assethandling with Image["picture.png"] and Sample["shot.wav"]
21
- #
22
44
  def initialize(width = 800, height = 600, fullscreen = false, update_interval = 16.666666)
23
45
  fullscreen ||= ARGV.include?("--fullscreen")
24
46
  $window = super(width, height, fullscreen, update_interval)
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.5.8
4
+ version: 0.5.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ippa
@@ -30,7 +30,7 @@ cert_chain:
30
30
  hxtMlw==
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2009-10-18 00:00:00 +02:00
33
+ date: 2009-10-19 00:00:00 +02:00
34
34
  default_executable:
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
@@ -44,7 +44,8 @@ dependencies:
44
44
  version: 2.3.3
45
45
  version:
46
46
  description: |-
47
- Game framework built on top of the OpenGL accelerated game lib Gosu.
47
+ OpenGL accelerated 2D game framework for Ruby.
48
+ Builds on the awesome Gosu (Ruby/C++) which provides all the core functionality.
48
49
  It adds simple yet powerful game states, prettier input handling, deployment safe asset-handling, a basic re-usable game object and automation of common task.
49
50
  email:
50
51
  - ippa@rubylicio.us
@@ -130,6 +131,7 @@ files:
130
131
  - lib/chingu/helpers/input_client.rb
131
132
  - lib/chingu/helpers/input_dispatcher.rb
132
133
  - lib/chingu/helpers/rotation_center.rb
134
+ - lib/chingu/high_score.rb
133
135
  - lib/chingu/inflector.rb
134
136
  - lib/chingu/input.rb
135
137
  - lib/chingu/named_resource.rb
@@ -172,6 +174,6 @@ rubyforge_project: chingu
172
174
  rubygems_version: 1.3.5
173
175
  signing_key:
174
176
  specification_version: 3
175
- summary: Game framework built on top of the OpenGL accelerated game lib Gosu
177
+ summary: OpenGL accelerated 2D game framework for Ruby
176
178
  test_files: []
177
179
 
metadata.gz.sig CHANGED
Binary file