chingu 0.7.0 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/History.txt +1 -1
  2. data/README.rdoc +110 -49
  3. data/benchmarks/game_objects_benchmark.rb +50 -0
  4. data/chingu.gemspec +24 -12
  5. data/examples/example10_traits_retrofy.rb +6 -4
  6. data/examples/example11_animation.rb +14 -23
  7. data/examples/example12_trait_timer.rb +1 -1
  8. data/examples/example13_high_scores.rb +1 -1
  9. data/examples/example14_bounding_box_circle.rb +6 -10
  10. data/examples/example15_trait_timer2.rb +1 -1
  11. data/examples/example16_online_high_scores.rb +1 -1
  12. data/examples/example17_gosu_tutorial.rb +4 -4
  13. data/examples/example18_animation_trait.rb +98 -0
  14. data/examples/example19_edit_viewport.rb +223 -0
  15. data/examples/example19_game_objects.yml +1591 -0
  16. data/examples/example20_trait_inheritence_test.rb +58 -0
  17. data/examples/example3_parallax.rb +1 -1
  18. data/examples/example4_gamestates.rb +1 -1
  19. data/examples/example7_gfx_helpers.rb +14 -9
  20. data/examples/example8_traits.rb +4 -4
  21. data/examples/example9_collision_detection.rb +1 -1
  22. data/examples/game1.rb +33 -38
  23. data/examples/game_of_life.rb +291 -0
  24. data/examples/media/droid_11x15.bmp +0 -0
  25. data/examples/media/droid_11x15.gal +0 -0
  26. data/examples/media/heli.bmp +0 -0
  27. data/examples/media/heli.gal +0 -0
  28. data/examples/media/star_25x25_default.png +0 -0
  29. data/examples/media/star_25x25_explode.gal +0 -0
  30. data/examples/media/star_25x25_explode.png +0 -0
  31. data/examples/media/stone_wall.bmp +0 -0
  32. data/lib/chingu.rb +1 -1
  33. data/lib/chingu/animation.rb +78 -9
  34. data/lib/chingu/basic_game_object.rb +16 -8
  35. data/lib/chingu/game_object.rb +36 -7
  36. data/lib/chingu/game_object_list.rb +20 -3
  37. data/lib/chingu/game_state.rb +8 -7
  38. data/lib/chingu/game_states/edit.rb +177 -90
  39. data/lib/chingu/helpers/class_inheritable_accessor.rb +12 -5
  40. data/lib/chingu/helpers/game_object.rb +45 -4
  41. data/lib/chingu/helpers/gfx.rb +150 -172
  42. data/lib/chingu/helpers/input_client.rb +7 -0
  43. data/lib/chingu/inflector.rb +16 -2
  44. data/lib/chingu/traits/animation.rb +84 -0
  45. data/lib/chingu/traits/bounding_box.rb +16 -3
  46. data/lib/chingu/traits/bounding_circle.rb +18 -4
  47. data/lib/chingu/traits/collision_detection.rb +10 -1
  48. data/lib/chingu/traits/velocity.rb +26 -3
  49. data/lib/chingu/traits/viewport.rb +10 -9
  50. data/lib/chingu/viewport.rb +103 -22
  51. data/lib/chingu/window.rb +8 -2
  52. metadata +46 -16
  53. data/examples/example18_viewport.rb +0 -173
  54. data/examples/media/city1.csv +0 -2
  55. data/examples/media/plane.csv +0 -2
  56. data/examples/media/saucer.csv +0 -4
  57. data/examples/media/stickfigure.bmp +0 -0
  58. data/examples/media/stickfigure.png +0 -0
@@ -1,6 +1,6 @@
1
1
  === 0.6 / 2009-11-21
2
2
  More traits, better input, fixes
3
- See github commithistory.
3
+ This file is kind of deprecated -- see github commit-history instead!
4
4
 
5
5
  === 0.5.7 / 2009-10-15
6
6
  See github commithistory.
@@ -14,7 +14,7 @@ Chingu has started to settle down, thouch core classes and naming can still chan
14
14
  == DESCRIPTION
15
15
  OpenGL accelerated 2D game framework for Ruby.
16
16
  Builds on the awesome Gosu (Ruby/C++) which provides all the core functionality.
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
+ It adds simple yet powerful game states, pretty input handling, deployment safe asset-handling, a basic re-usable game object and automation of common task.
18
18
 
19
19
 
20
20
  == THE STORY
@@ -33,9 +33,10 @@ Borrowing ideas from Rubygame this has now become @player.keyboard(:left => :mov
33
33
  Chingu consists of the following core classes / concepts:
34
34
 
35
35
  === Chingu::Window
36
- The main window, use it at you use Gosu::Window now. Calcs the framerate, takes care of states,
37
- handles chingu-formated input, updates and draws BasicGameObject / GameObjects automaticly.
38
- Available thoughout your source as $window (Yes, that's the only global Chingu has).
36
+ The main window, use it at you use Gosu::Window now. Calculates the framerate, takes care of states,
37
+ handles chingu-formated input, updates and draws BasicGameObject / GameObjects automatically.
38
+ Available throughout your source as $window (Yes, that's the only global Chingu has).
39
+ You can also set various global settings. For example, self.factor=3, will make all fortcomming GameObjects scale 3 times.
39
40
 
40
41
  === Chingu::GameObject
41
42
  Use this for all your in game objects. The player, the enemies, the bullets, the powerups, the loot laying around.
@@ -47,8 +48,8 @@ Has either Chingu::Window or a Chingu::GameState as "parent".
47
48
  === Chingu::BasicGameObject
48
49
  For those who think GameObject is a too little fat, there's BasicGameObject (GameObject inherits from BasicGameObject).
49
50
  BasicGameObject is just an empty frame (no x,y,image accessors or draw-logic) for you to build on.
50
- It _can_ be extended with Chingus trait-system though. The new() vs create() behaivor of GameObject comes from BasicGameObject.
51
- BasicGameObject#parent points to either $window or a game state and is automaticly set on creation time.
51
+ It _can_ be extended with Chingus trait-system though. The new() vs create() behavior of GameObject comes from BasicGameObject.
52
+ BasicGameObject#parent points to either $window or a game state and is automatically set on creation time.
52
53
 
53
54
  === Chingu::GameStateManager
54
55
  Keeps track of the game states. Implements a stack-based system with push_game_state and pop_game_state.
@@ -63,8 +64,8 @@ Chingu::Window --> Chingu::GameStateManager --> Chingu::GameState.
63
64
  For example, inside game state Menu you call push_game_state(Level). When Level exists, it will go back to Menu.
64
65
 
65
66
  === Traits
66
- Traits are extensions (or plugins if you so will) to BasicGameObjects.
67
- The aim is so encapsulate common behaivor into modules for easy inclusion in your game classes.
67
+ Traits are extensions (or plugins if you so will) to BasicGameObjects included on the class-level.
68
+ The aim is so encapsulate common behavior into modules for easy inclusion in your game classes.
68
69
  Making a trait is easy, just an ordinary module with the methods setup_trait(), update_trait() and/or draw_trait().
69
70
  It currently has to be namespaced to Chingu::Traits for "has_traits" to work inside GameObject-classes.
70
71
 
@@ -159,9 +160,9 @@ Chingu doesn't change the fundamental concept/flow of Gosu, but it will make the
159
160
  #
160
161
  class Game < Chingu::Window
161
162
  def initialize
162
- super # This is always needed if you want to take advantage of what chingu offers
163
+ super # This is always needed if you override Window#initialize
163
164
  #
164
- # Player will automaticly be updated and drawn since it's a Chingu::GameObject
165
+ # Player will automatically be updated and drawn since it's a Chingu::GameObject
165
166
  # You'll need your own Chingu::Window#update and Chingu::Window#draw after a while, but just put #super there and Chingu can do its thing.
166
167
  #
167
168
  @player = Player.create
@@ -234,7 +235,7 @@ An example using almost all arguments would be:
234
235
  #
235
236
  # A shortcut for the above line would be
236
237
  #
237
- @player = Player.new(:image => Image["player.png"], :x=>100, :y=>100, :zorder=>100, :angle=>45, :factor=>10, :center=>0)
238
+ @player = Player.new(:image => "player.png", :x=>100, :y=>100, :zorder=>100, :angle=>45, :factor=>10, :center=>0)
238
239
 
239
240
  #
240
241
  # I've tried doing sensible defaults:
@@ -445,8 +446,31 @@ Or Chingus shortcut:
445
446
 
446
447
  Chingus inputhandler will detect that Menu is a GameState-class, create a new instance and activate it with push_game_state().
447
448
 
449
+ === WorkFlow
450
+ (This text is under development)
451
+
452
+ == The setup-method
453
+ If a setup() is available in a instance of Chingu::GameObject, Chingu::Window and Chingu::GameState it will automatically be called.
454
+ This is the perfect spot to include various setup/init-tasks like setting colors or loading animations (if you're not using the animation-trait).
455
+ You could also override initialize() for this purpose but it's been proven prone to errors again and again.
456
+ Compare the 2 snippets below:
457
+
458
+ # Easy to mess up, forgetting options or super
459
+ def initialize(options = {})
460
+ super
461
+ @color = Color::WHITE
462
+ end
463
+
464
+ # Less code, easier to get right and works in GameObject, Window and GameState
465
+ # Feel free to call setup() anytime, there's no magic about ut except it's autocalled once on object creation time.
466
+ def setup
467
+ @color = Color::WHITE
468
+ end
469
+
470
+
471
+
448
472
  === Traits
449
- Traits (often called behaivors) is a way of adding logic to any class inheriting from BasicGameObject / GameObject.
473
+ Traits (sometimes called behaviors in other frameworks) is a way of adding logic to any class inheriting from BasicGameObject / GameObject.
450
474
  Chingus trait-implementation is just ordinary ruby modules with 3 special methods:
451
475
  - setup_trait
452
476
  - update_trait
@@ -462,6 +486,10 @@ A simple trait could be:
462
486
  module Chingu
463
487
  module Trait
464
488
  module Inspect
489
+
490
+ #
491
+ # methods namespaced to ClassMethods get's extended as ... class methods!
492
+ #
465
493
  module ClassMethods
466
494
  def initialize_trait(options)
467
495
  # possible initialize stuff here
@@ -470,6 +498,15 @@ module Chingu
470
498
  def inspect
471
499
  "There's {self.size} active instances of class {self.to_s}"
472
500
  end
501
+ end
502
+
503
+ #
504
+ # Namespaced outside ClassMethods get's included as normal instance-methods
505
+ #
506
+ def inspect
507
+ "Hello I'm an #{self.class.to_s}"
508
+ end
509
+
473
510
  end
474
511
  end
475
512
  end
@@ -478,7 +515,8 @@ class Enemy < GameObject
478
515
  has_trait :inspect # includes Chingu::Trait::Inspect and extends Chingu::Trait::Inspect::ClassMethods
479
516
  end
480
517
  10.times { Enemy.create }
481
- Enemy.inspect # => There's 10 active instances of class Enemy
518
+ Enemy.inspect # => "There's 10 active instances of class Enemy"
519
+ Enemy.all.first.inspect # => "Hello I'm a Enemy"
482
520
 
483
521
 
484
522
  Example of using traits :velocity and :timer:
@@ -527,10 +565,10 @@ There's a couple of traits included as default in Chingu:
527
565
 
528
566
  ==== Trait "timer"
529
567
  Adds timer functionality to your game object
530
- during(300) { self.color = Color.new(0xFFFFFFFF) } # forces @color to white every update for 300 ms
531
- after(400) { self.destroy } # destroy object after 400 ms
532
- between(1000,2000) { self.rotate(10) } # starting after 1 second, call rotate(10) every update during 1 second
533
- every(2000) { Sound["bleep.wav"].play } # play bleep.wav every 2 seconds
568
+ during(300) { self.color = Color.new(0xFFFFFFFF) } # forces @color to white every update for 300 ms
569
+ after(400) { self.destroy } # destroy object after 400 ms
570
+ between(1000,2000) { self.angle += 10 } # starting after 1 second, modify angleevery update during 1 second
571
+ every(2000) { Sound["bleep.wav"].play } # play bleep.wav every 2 seconds
534
572
 
535
573
  ==== Trait "velocity"
536
574
  Adds accessors velocity_x, velocity_y, acceleration_x, acceleration_y, max_velocity to game object.
@@ -558,10 +596,34 @@ You can also scale the calculated radius with has_trait-options:
558
596
  # :debug => true shows the actual circle in red on the screen
559
597
  has_trait :bounding_circle, :debug => true
560
598
 
599
+ ==== Trait "animation"
600
+ Automatically load animations depending on the class-name.
601
+ Useful when having a lot of simple classes thats mainpurpose is displaying an animation.
602
+ Assuming the below code is included in a class FireBall.
603
+
604
+ #
605
+ # If a fire_ball_10x10.png/bmp exists, it will be loaded as a tileanimation.
606
+ # 10x10 would indicate the width and height of each tile so Chingu knows hows to cut it up into single frames.
607
+ # The animation will then be available in animations[:default] as an Animation-instance.
608
+ #
609
+ # If more then 1 animation exist, they'll will be loaded at the same time, for example:
610
+ # fire_ball_10x10_fly.png # Will be available in animations[:fly] as an Animation-instance
611
+ # fire_ball_10x10_explode.png # Will be available in animations[:explode] as an Animation-instance
612
+ #
613
+ # The below example will set the 200ms delay between each frame on all animations loaded.
614
+ #
615
+ has_trait :automatic_assets, :delay => 200
616
+
561
617
  ==== Trait "effect"
562
618
  Adds accessors rotation_rate, fade_rate and scale_rate to game object.
563
619
  They modify angle, alpha and factor_x/factor_y each update. Since this is pretty easy to do yourself this trait might be up for deprecation.
564
-
620
+
621
+ ==== (IN DEVELOPMENT) Trait "viewport"
622
+ A game state trait. Adds accessor *viewport*. Set viewport.x and viewport.y to.
623
+ Basically what viewport.x = 10 will do is draw all game objects 10 pixels to the left of their ordinary position.
624
+ Since the viewport has moved 10 pixels to the right, the game objects will be seen "moving" 10 pixels to the left.
625
+ This is great for scrolling games.
626
+
565
627
  ==== (IN DEVELOPMENT) Trait "collision_detection"
566
628
  Adds class and instance methods for basic collision detection.
567
629
 
@@ -638,7 +700,7 @@ Text is a class to give the use of Gosu::Font more rubyish feel and fit it bette
638
700
  @text = Chingu::Text.create("A Text", :x => 200, :y => 50, :zorder => 55, :factor_x => 2.0)
639
701
  @text.draw
640
702
 
641
- @text.draw is usually not needed as Text is a GameObject and therefore automaticly updated/drawn (it #create is used instead of #new)
703
+ @text.draw is usually not needed as Text is a GameObject and therefore automatically updated/drawn (it #create is used instead of #new)
642
704
  It's not only that the second example is readable by ppl now even familiar with Gosu, @text comes with a number of changeable properties, x,y,zorder,angle,factor_x,color,mode etc.
643
705
  Set a new x or angle or color and it will instantly update on screen.
644
706
 
@@ -656,7 +718,34 @@ GameObject.all is naming straight from rails for example. Most stuff in GameObje
656
718
 
657
719
  As far as possible, use correct rubyfied english game_objects, not gameobjects. class HighScore, not Highscore.
658
720
 
659
- == TODO - this list is discontinued and no longer updated
721
+
722
+ == WHY?
723
+ * Plain Gosu is very minimalistic, perfect to build some higher level logic on!
724
+ * Deployment and asset handling should be simple
725
+ * Managing game states/scenes (intros, menus, levels etc) should be simple
726
+ * There are patterns in game development
727
+
728
+ == OPINIONS
729
+ * Less code is usually better
730
+ * Hash arguments FTW. And it becomes even better in 1.9.
731
+ * Don't separate too much from Gosus core-naming
732
+
733
+ == CREDITS:
734
+ * Jacius of Rubygame (For doing cool stuff that's well documented as re-usable). So far rect.rb and named_resource.rb is straight outta Rubygame.
735
+ * Banister (of texplay fame) for general feedeback and help with ruby-internals and building the trait-system
736
+ * Jduff for input / commits
737
+ * Jlnr,Philymore,Shawn24,JamesKilton for constructive feedback/discussions
738
+ * Ariel Pillet for codesuggestions and cleanups
739
+ * Deps for making the first real full game with Chingu (and making it better in the process)
740
+ * Thanks to http://github.com/tarcieri for require_all code, good stuff
741
+
742
+ == REQUIREMENTS:
743
+ * Gosu latest version
744
+ * Ruby 1.9.1+ or 1.8.7+
745
+ * gem 'opengl' if you want to use Image#retrofy, not needed otherwise
746
+ * gem 'texplay' for some bonus Image-pixel operations, not needed otherwise
747
+
748
+ == TODO - this list is Discontinued and no longer updated!
660
749
  * add :padding and :align => :topleft etc to class Text
661
750
  * (skip) rename Chingu::Window so 'include Chingu' and 'include Gosu' wont make Window collide
662
751
  * (done) BasicObject vs GameObject vs ScreenObject => Became BasicGameObject and GameObject
@@ -689,37 +778,9 @@ As far as possible, use correct rubyfied english game_objects, not gameobjects.
689
778
  * A more robust game state <-> game_object system to connect them together.
690
779
  * FIX example4: :p => Pause.new would Change the "inside_game_state" to Pause and make @player belong to Pause.
691
780
 
692
- == WHY?
693
- * Plain Gosu is very minimalistic, perfect to build some higher level logic on!
694
- * Deployment and asset handling should be simple
695
- * Managing game states/scenes (intros, menus, levels etc) should be simple
696
- * There are patterns in game development
697
-
698
- == OPINIONS
699
- * Less code is usually better
700
- * Hash arguments FTW. And it becomes even better in 1.9.
701
- * Don't separate too much from Gosus core-naming
702
-
703
- == CREDITS:
704
- * Jacius of Rubygame (For doing cool stuff that's well documented as re-usable). So far rect.rb and named_resource.rb is straight outta Rubygame.
705
- * Banister (of texplay fame) for general feedeback and help with ruby-internals and building the trait-system
706
- * Jduff for input / commits
707
- * Jlnr,Philymore,Shawn24,JamesKilton for constructive feedback/discussions
708
- * Ariel Pillet for codesuggestions and cleanups
709
- * Deps for making the first real full game with Chingu (and making it better in the process)
710
- * Thanks to http://github.com/tarcieri for require_all code, good stuff
711
-
712
- == REQUIREMENTS:
713
- * Gosu latest version
714
- * Ruby 1.9.1+ or 1.8.7+
715
- * gem 'opengl' if you want to use Image#retrofy, not needed otherwise
716
- * gem 'texplay' for some bonus Image-pixel operations, not needed otherwise
717
-
718
-
719
-
720
781
 
721
782
 
722
783
  "If you program and want any longevity to your work, make a game.
723
784
  All else recycles, but people rewrite architectures to keep games alive.", _why
724
785
 
725
-
786
+
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ require 'benchmark'
4
+ require File.join(File.dirname($0), "..", "lib", "chingu")
5
+ include Gosu
6
+
7
+
8
+ class Game < Chingu::Window
9
+ def initialize
10
+ super(600,200)
11
+ self.input = { :esc => :exit }
12
+ @iterations = 10
13
+ end
14
+
15
+ def update
16
+ if @iterations > 0
17
+ create_objects
18
+ @iterations -= 1
19
+ end
20
+ end
21
+
22
+ def create_objects
23
+ Benchmark.bm(22) do |x|
24
+ x.report('create') do
25
+ 100000.times do
26
+ MyGameObject.create
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ class MyGameObject < Chingu::GameObject
34
+ end
35
+
36
+ Game.new.show
37
+
38
+
39
+ # 100000 MyGameObject.create with add_game_objects / remove_game_objects -arrays
40
+ # user system total real
41
+ #create 0.951000 0.047000 0.998000 ( 0.998057)
42
+ #create 1.139000 0.031000 1.170000 ( 1.155066)
43
+ #create 1.186000 0.047000 1.233000 ( 1.239071)
44
+ #create 1.528000 0.000000 1.528000 ( 1.520087)
45
+ #create 1.451000 0.031000 1.482000 ( 1.488085)
46
+ #create 1.654000 0.016000 1.670000 ( 1.662095)
47
+ #create 1.794000 0.015000 1.809000 ( 1.819104)
48
+ #create 1.997000 0.000000 1.997000 ( 1.986114)
49
+ #create 1.934000 0.000000 1.934000 ( 1.930110)
50
+ #create 2.075000 0.000000 2.075000 ( 2.087119)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{chingu}
8
- s.version = "0.7.0"
8
+ s.version = "0.7.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["ippa"]
12
- s.date = %q{2010-01-14}
12
+ s.date = %q{2010-06-13}
13
13
  s.description = %q{OpenGL accelerated 2D game framework for Ruby. Builds on Gosu (Ruby/C++) which provides all the core functionality. Chingu adds simple yet powerful game states, prettier input handling, deployment safe asset-handling, a basic re-usable game object and stackable game logic.}
14
14
  s.email = %q{ippa@rubylicio.us}
15
15
  s.extra_rdoc_files = [
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
28
28
  "benchmarks/benchmark4.rb",
29
29
  "benchmarks/benchmark5.rb",
30
30
  "benchmarks/benchmark6.rb",
31
+ "benchmarks/game_objects_benchmark.rb",
31
32
  "benchmarks/meta_benchmark.rb",
32
33
  "benchmarks/meta_benchmark2.rb",
33
34
  "chingu.gemspec",
@@ -39,8 +40,11 @@ Gem::Specification.new do |s|
39
40
  "examples/example15_trait_timer2.rb",
40
41
  "examples/example16_online_high_scores.rb",
41
42
  "examples/example17_gosu_tutorial.rb",
42
- "examples/example18_viewport.rb",
43
+ "examples/example18_animation_trait.rb",
44
+ "examples/example19_edit_viewport.rb",
45
+ "examples/example19_game_objects.yml",
43
46
  "examples/example1_basics.rb",
47
+ "examples/example20_trait_inheritence_test.rb",
44
48
  "examples/example2_gamestate_basics.rb",
45
49
  "examples/example3_parallax.rb",
46
50
  "examples/example4_gamestates.rb",
@@ -50,6 +54,7 @@ Gem::Specification.new do |s|
50
54
  "examples/example8_traits.rb",
51
55
  "examples/example9_collision_detection.rb",
52
56
  "examples/game1.rb",
57
+ "examples/game_of_life.rb",
53
58
  "examples/high_score_list.yml",
54
59
  "examples/media/Parallax-scroll-example-layer-0.png",
55
60
  "examples/media/Parallax-scroll-example-layer-1.png",
@@ -61,26 +66,29 @@ Gem::Specification.new do |s|
61
66
  "examples/media/bullet.png",
62
67
  "examples/media/bullet_hit.wav",
63
68
  "examples/media/circle.png",
64
- "examples/media/city1.csv",
65
69
  "examples/media/city1.png",
66
70
  "examples/media/city2.png",
67
71
  "examples/media/droid.bmp",
72
+ "examples/media/droid_11x15.bmp",
73
+ "examples/media/droid_11x15.gal",
68
74
  "examples/media/enemy_bullet.png",
69
75
  "examples/media/explosion.wav",
70
76
  "examples/media/fire_bullet.png",
71
77
  "examples/media/fireball.png",
78
+ "examples/media/heli.bmp",
79
+ "examples/media/heli.gal",
72
80
  "examples/media/laser.wav",
73
81
  "examples/media/particle.png",
74
- "examples/media/plane.csv",
75
82
  "examples/media/plane.png",
76
83
  "examples/media/rect.png",
77
84
  "examples/media/ruby.png",
78
- "examples/media/saucer.csv",
79
85
  "examples/media/saucer.gal",
80
86
  "examples/media/saucer.png",
81
87
  "examples/media/spaceship.png",
82
- "examples/media/stickfigure.bmp",
83
- "examples/media/stickfigure.png",
88
+ "examples/media/star_25x25_default.png",
89
+ "examples/media/star_25x25_explode.gal",
90
+ "examples/media/star_25x25_explode.png",
91
+ "examples/media/stone_wall.bmp",
84
92
  "examples/media/video_games.png",
85
93
  "examples/media/wood.png",
86
94
  "lib/chingu.rb",
@@ -115,6 +123,7 @@ Gem::Specification.new do |s|
115
123
  "lib/chingu/rect.rb",
116
124
  "lib/chingu/require_all.rb",
117
125
  "lib/chingu/text.rb",
126
+ "lib/chingu/traits/animation.rb",
118
127
  "lib/chingu/traits/bounding_box.rb",
119
128
  "lib/chingu/traits/bounding_circle.rb",
120
129
  "lib/chingu/traits/collision_detection.rb",
@@ -130,7 +139,7 @@ Gem::Specification.new do |s|
130
139
  s.rdoc_options = ["--charset=UTF-8"]
131
140
  s.require_paths = ["lib"]
132
141
  s.rubyforge_project = %q{chingu}
133
- s.rubygems_version = %q{1.3.5}
142
+ s.rubygems_version = %q{1.3.7}
134
143
  s.summary = %q{OpenGL accelerated 2D game framework for Ruby}
135
144
  s.test_files = [
136
145
  "examples/example10_traits_retrofy.rb",
@@ -141,8 +150,10 @@ Gem::Specification.new do |s|
141
150
  "examples/example15_trait_timer2.rb",
142
151
  "examples/example16_online_high_scores.rb",
143
152
  "examples/example17_gosu_tutorial.rb",
144
- "examples/example18_viewport.rb",
153
+ "examples/example18_animation_trait.rb",
154
+ "examples/example19_edit_viewport.rb",
145
155
  "examples/example1_basics.rb",
156
+ "examples/example20_trait_inheritence_test.rb",
146
157
  "examples/example2_gamestate_basics.rb",
147
158
  "examples/example3_parallax.rb",
148
159
  "examples/example4_gamestates.rb",
@@ -151,14 +162,15 @@ Gem::Specification.new do |s|
151
162
  "examples/example7_gfx_helpers.rb",
152
163
  "examples/example8_traits.rb",
153
164
  "examples/example9_collision_detection.rb",
154
- "examples/game1.rb"
165
+ "examples/game1.rb",
166
+ "examples/game_of_life.rb"
155
167
  ]
156
168
 
157
169
  if s.respond_to? :specification_version then
158
170
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
159
171
  s.specification_version = 3
160
172
 
161
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
173
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
162
174
  s.add_runtime_dependency(%q<gosu>, [">= 0.7.18"])
163
175
  else
164
176
  s.add_dependency(%q<gosu>, [">= 0.7.18"])
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
- require 'opengl'
4
3
  require File.join(File.dirname($0), "..", "lib", "chingu")
5
4
  include Gosu
6
5
  include Chingu
@@ -14,6 +13,7 @@ class Game < Chingu::Window
14
13
  super(600,400)
15
14
  self.caption = "Testing out new module-based traits (SPACE for more spaceships)"
16
15
  self.input = { :space => :create_thing, :esc => :exit }
16
+ Gosu::enable_undocumented_retrofication
17
17
  create_thing(200,200)
18
18
  end
19
19
 
@@ -33,8 +33,8 @@ class Game < Chingu::Window
33
33
  end
34
34
 
35
35
  class Thing < Chingu::GameObject
36
- has_trait :effect
37
- has_trait :velocity
36
+ trait :effect
37
+ trait :velocity
38
38
 
39
39
  def initialize(options)
40
40
  super
@@ -49,7 +49,9 @@ class Thing < Chingu::GameObject
49
49
  #
50
50
  # The above code has been merged into chingu as @image.retrofy
51
51
  #
52
- @image.retrofy
52
+ # @image.retrofy
53
+ #
54
+ # Use Gosu::enable_undocumented_retrofication instead!
53
55
 
54
56
 
55
57
  self.scale = 8