rubygame 2.5.2 → 2.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/NEWS +18 -0
- data/Rakefile +10 -1
- data/ext/rubygame/rubygame_event2.c +4 -4
- data/lib/rubygame/clock.rb +6 -3
- data/samples/demo_rubygame.rb +1 -1
- data/samples/keys.rb +52 -0
- metadata +25 -16
    
        data/NEWS
    CHANGED
    
    | @@ -1,5 +1,23 @@ | |
| 1 1 | 
             
            = NEWS
         | 
| 2 2 |  | 
| 3 | 
            +
            == Rubygame 2.5.3
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            Release focus: Bug fixes.
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            === Fixes
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            - Updated gemspec to list (install-time) dependency on Rake. [#24]
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            - Fixed: MouseMoved and JoyBallMoved were wrongly using unsigned ints
         | 
| 12 | 
            +
              for relative x and y positions. [#26]
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            - Fixed: Clock#framerate returned Infinity under some conditions.
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            - Fixed: Panda demo used the wrong order of steps for redrawing sprites.
         | 
| 17 | 
            +
             | 
| 18 | 
            +
             | 
| 19 | 
            +
             | 
| 20 | 
            +
             | 
| 3 21 | 
             
            == Rubygame 2.5.2
         | 
| 4 22 |  | 
| 5 23 | 
             
            Release focus: Bug fixes.
         | 
    
        data/Rakefile
    CHANGED
    
    | @@ -6,7 +6,7 @@ | |
| 6 6 |  | 
| 7 7 |  | 
| 8 8 | 
             
            # The version number for Rubygame.
         | 
| 9 | 
            -
            RUBYGAME_VERSION = [2,5, | 
| 9 | 
            +
            RUBYGAME_VERSION = [2,5,3]
         | 
| 10 10 |  | 
| 11 11 |  | 
| 12 12 | 
             
            # 
         | 
| @@ -118,6 +118,15 @@ gem_spec = Gem::Specification.new do |s| | |
| 118 118 | 
             
                fl.include "doc/*.rdoc"
         | 
| 119 119 | 
             
                fl.include "README", "LICENSE", "CREDITS", "ROADMAP", "NEWS"
         | 
| 120 120 | 
             
              end
         | 
| 121 | 
            +
             | 
| 122 | 
            +
              s.required_ruby_version = ">= 1.8"
         | 
| 123 | 
            +
              s.add_dependency( "rake", ">=0.7.0" )
         | 
| 124 | 
            +
              s.requirements = ["SDL       >= 1.2.7",
         | 
| 125 | 
            +
                                "SDL_gfx   >= 2.0.10 (optional)",
         | 
| 126 | 
            +
                                "SDL_image >= 1.2.3  (optional)",
         | 
| 127 | 
            +
                                "SDL_mixer >= 1.2.7  (optional)",
         | 
| 128 | 
            +
                                "SDL_ttf   >= 2.0.6  (optional)"]
         | 
| 129 | 
            +
             | 
| 121 130 | 
             
            end
         | 
| 122 131 |  | 
| 123 132 | 
             
            task :binary do
         | 
| @@ -154,8 +154,8 @@ VALUE rg_convert_joyballevent( SDL_Event ev ) | |
| 154 154 | 
             
              VALUE ball = UINT2NUM( ev.jball.ball );
         | 
| 155 155 |  | 
| 156 156 | 
             
              VALUE rel = rb_ary_new();
         | 
| 157 | 
            -
              rb_ary_push( rel,  | 
| 158 | 
            -
              rb_ary_push( rel,  | 
| 157 | 
            +
              rb_ary_push( rel, INT2NUM( ev.jball.xrel ) );
         | 
| 158 | 
            +
              rb_ary_push( rel, INT2NUM( ev.jball.yrel ) );
         | 
| 159 159 |  | 
| 160 160 |  | 
| 161 161 | 
             
              VALUE args[] = { joystick_id, ball, rel };
         | 
| @@ -489,8 +489,8 @@ VALUE rg_convert_mousemotionevent( SDL_Event ev ) | |
| 489 489 |  | 
| 490 490 |  | 
| 491 491 | 
             
              VALUE rel = rb_ary_new();
         | 
| 492 | 
            -
              rb_ary_push( rel,  | 
| 493 | 
            -
              rb_ary_push( rel,  | 
| 492 | 
            +
              rb_ary_push( rel, INT2NUM( ev.motion.xrel ) );
         | 
| 493 | 
            +
              rb_ary_push( rel, INT2NUM( ev.motion.yrel ) );
         | 
| 494 494 |  | 
| 495 495 |  | 
| 496 496 | 
             
              VALUE args[] = { pos, rel, buttons };
         | 
    
        data/lib/rubygame/clock.rb
    CHANGED
    
    | @@ -222,9 +222,12 @@ module Rubygame | |
| 222 222 | 
             
                # Clock. See #tick.
         | 
| 223 223 | 
             
                # 
         | 
| 224 224 | 
             
                def framerate
         | 
| 225 | 
            -
                   | 
| 226 | 
            -
             | 
| 227 | 
            -
             | 
| 225 | 
            +
                  sum = @samples.inject(0){|sum, n| sum + n}
         | 
| 226 | 
            +
                  if sum == 0
         | 
| 227 | 
            +
                    return 0.0
         | 
| 228 | 
            +
                  else
         | 
| 229 | 
            +
                    1000.0 * @samples.length / sum
         | 
| 230 | 
            +
                  end
         | 
| 228 231 | 
             
                end
         | 
| 229 232 |  | 
| 230 233 |  | 
    
        data/samples/demo_rubygame.rb
    CHANGED
    
    | @@ -503,8 +503,8 @@ class Game | |
| 503 503 | 
             
            	def step
         | 
| 504 504 | 
             
            		@queue << UndrawSprites.new( @screen, @background )
         | 
| 505 505 | 
             
            		@queue.fetch_sdl_events
         | 
| 506 | 
            -
            		@queue << DrawSprites.new( @screen )
         | 
| 507 506 | 
             
            		@queue << $game.clock.tick
         | 
| 507 | 
            +
            		@queue << DrawSprites.new( @screen )
         | 
| 508 508 | 
             
            		@queue.each do |event|
         | 
| 509 509 | 
             
            			handle( event )
         | 
| 510 510 | 
             
            		end
         | 
    
        data/samples/keys.rb
    ADDED
    
    | @@ -0,0 +1,52 @@ | |
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # Quick and dirty test app to print out info about keys that are pressed.
         | 
| 4 | 
            +
             | 
| 5 | 
            +
             | 
| 6 | 
            +
            require "rubygame"
         | 
| 7 | 
            +
            include Rubygame
         | 
| 8 | 
            +
             | 
| 9 | 
            +
             | 
| 10 | 
            +
            def setup
         | 
| 11 | 
            +
              Rubygame.init
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              $queue = EventQueue.new
         | 
| 14 | 
            +
              $queue.enable_new_style_events
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              $screen = Screen.open([640,480])
         | 
| 17 | 
            +
             | 
| 18 | 
            +
              # We'll store the last $buffer_maxlen lines of the text buffer here.
         | 
| 19 | 
            +
              $buffer = []
         | 
| 20 | 
            +
              $buffer_maxlen = 20
         | 
| 21 | 
            +
             | 
| 22 | 
            +
              # Load the font
         | 
| 23 | 
            +
              TTF.setup
         | 
| 24 | 
            +
              ttf_file = File.join( File.dirname(__FILE__), "FreeSans.ttf" )
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              $font_size = 24
         | 
| 27 | 
            +
              $font = TTF.new( ttf_file, $font_size )
         | 
| 28 | 
            +
            end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
             | 
| 31 | 
            +
            def String.pad_to( length, padding=" " )
         | 
| 32 | 
            +
              extra = length < self.length ? length - self.length : 0
         | 
| 33 | 
            +
              return self + padding * extra
         | 
| 34 | 
            +
            end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
            def format_event( event )
         | 
| 37 | 
            +
              klass = (event.class.name+":").pad_to(7)
         | 
| 38 | 
            +
             | 
| 39 | 
            +
            end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
             | 
| 42 | 
            +
            def add_to_buffer( text )
         | 
| 43 | 
            +
              surface = $font.render_unicode(text, true, :white)
         | 
| 44 | 
            +
              $buffer.push( text )
         | 
| 45 | 
            +
              $buffer.shift if $buffer.length > $buffer_maxlen
         | 
| 46 | 
            +
            end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
             | 
| 49 | 
            +
            def redraw_buffer
         | 
| 50 | 
            +
              $screen.fill( :black )
         | 
| 51 | 
            +
              
         | 
| 52 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: rubygame
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              version: 2.5. | 
| 4 | 
            +
              version: 2.5.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors: 
         | 
| 7 7 | 
             
            - John Croisant
         | 
| @@ -9,10 +9,19 @@ autorequire: | |
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 11 |  | 
| 12 | 
            -
            date: 2009- | 
| 12 | 
            +
            date: 2009-07-23 00:00:00 -05:00
         | 
| 13 13 | 
             
            default_executable: 
         | 
| 14 | 
            -
            dependencies:  | 
| 15 | 
            -
             | 
| 14 | 
            +
            dependencies: 
         | 
| 15 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 16 | 
            +
              name: rake
         | 
| 17 | 
            +
              type: :runtime
         | 
| 18 | 
            +
              version_requirement: 
         | 
| 19 | 
            +
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 20 | 
            +
                requirements: 
         | 
| 21 | 
            +
                - - ">="
         | 
| 22 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 23 | 
            +
                    version: 0.7.0
         | 
| 24 | 
            +
                version: 
         | 
| 16 25 | 
             
            description: 
         | 
| 17 26 | 
             
            email: jacius@gmail.com
         | 
| 18 27 | 
             
            executables: []
         | 
| @@ -32,17 +41,13 @@ extra_rdoc_files: | |
| 32 41 | 
             
            - NEWS
         | 
| 33 42 | 
             
            files: 
         | 
| 34 43 | 
             
            - lib/rubygame.rb
         | 
| 35 | 
            -
            - lib/rubygame
         | 
| 36 44 | 
             
            - lib/rubygame/ftor.rb
         | 
| 37 45 | 
             
            - lib/rubygame/clock.rb
         | 
| 38 46 | 
             
            - lib/rubygame/constants.rb
         | 
| 39 | 
            -
            - lib/rubygame/color
         | 
| 40 | 
            -
            - lib/rubygame/color/models
         | 
| 41 47 | 
             
            - lib/rubygame/color/models/rgb.rb
         | 
| 42 48 | 
             
            - lib/rubygame/color/models/hsl.rb
         | 
| 43 49 | 
             
            - lib/rubygame/color/models/hsv.rb
         | 
| 44 50 | 
             
            - lib/rubygame/color/models/base.rb
         | 
| 45 | 
            -
            - lib/rubygame/color/palettes
         | 
| 46 51 | 
             
            - lib/rubygame/color/palettes/palette.rb
         | 
| 47 52 | 
             
            - lib/rubygame/color/palettes/css.rb
         | 
| 48 53 | 
             
            - lib/rubygame/color/palettes/x11.rb
         | 
| @@ -62,13 +67,11 @@ files: | |
| 62 67 | 
             
            - lib/rubygame/shared.rb
         | 
| 63 68 | 
             
            - lib/rubygame/event_hook.rb
         | 
| 64 69 | 
             
            - lib/rubygame/event_handler.rb
         | 
| 65 | 
            -
            - lib/rubygame/events
         | 
| 66 70 | 
             
            - lib/rubygame/events/keyboard_events.rb
         | 
| 67 71 | 
             
            - lib/rubygame/events/joystick_events.rb
         | 
| 68 72 | 
             
            - lib/rubygame/events/misc_events.rb
         | 
| 69 73 | 
             
            - lib/rubygame/events/mouse_events.rb
         | 
| 70 74 | 
             
            - lib/rubygame/events/clock_events.rb
         | 
| 71 | 
            -
            - ext/rubygame
         | 
| 72 75 | 
             
            - ext/rubygame/rubygame_event.h
         | 
| 73 76 | 
             
            - ext/rubygame/rubygame_mixer.c
         | 
| 74 77 | 
             
            - ext/rubygame/rubygame_ttf.h
         | 
| @@ -99,7 +102,6 @@ files: | |
| 99 102 | 
             
            - ext/rubygame/rubygame_gl.c
         | 
| 100 103 | 
             
            - ext/rubygame/rubygame_mixer.h
         | 
| 101 104 | 
             
            - ext/rubygame/rubygame_image.c
         | 
| 102 | 
            -
            - ext/body
         | 
| 103 105 | 
             
            - ext/body/rubygame_body.so
         | 
| 104 106 | 
             
            - samples/demo_utf8.rb
         | 
| 105 107 | 
             
            - samples/README
         | 
| @@ -115,6 +117,7 @@ files: | |
| 115 117 | 
             
            - samples/demo_draw.rb
         | 
| 116 118 | 
             
            - samples/chimp.rb
         | 
| 117 119 | 
             
            - samples/demo_ttf.rb
         | 
| 120 | 
            +
            - samples/keys.rb
         | 
| 118 121 | 
             
            - samples/panda.png
         | 
| 119 122 | 
             
            - samples/punch.wav
         | 
| 120 123 | 
             
            - samples/FreeSans.ttf
         | 
| @@ -135,6 +138,8 @@ files: | |
| 135 138 | 
             
            - NEWS
         | 
| 136 139 | 
             
            has_rdoc: true
         | 
| 137 140 | 
             
            homepage: http://rubygame.org/
         | 
| 141 | 
            +
            licenses: []
         | 
| 142 | 
            +
             | 
| 138 143 | 
             
            post_install_message: 
         | 
| 139 144 | 
             
            rdoc_options: []
         | 
| 140 145 |  | 
| @@ -146,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 146 151 | 
             
              requirements: 
         | 
| 147 152 | 
             
              - - ">="
         | 
| 148 153 | 
             
                - !ruby/object:Gem::Version 
         | 
| 149 | 
            -
                  version: " | 
| 154 | 
            +
                  version: "1.8"
         | 
| 150 155 | 
             
              version: 
         | 
| 151 156 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 152 157 | 
             
              requirements: 
         | 
| @@ -154,12 +159,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 154 159 | 
             
                - !ruby/object:Gem::Version 
         | 
| 155 160 | 
             
                  version: "0"
         | 
| 156 161 | 
             
              version: 
         | 
| 157 | 
            -
            requirements:  | 
| 158 | 
            -
             | 
| 162 | 
            +
            requirements: 
         | 
| 163 | 
            +
            - SDL       >= 1.2.7
         | 
| 164 | 
            +
            - SDL_gfx   >= 2.0.10 (optional)
         | 
| 165 | 
            +
            - SDL_image >= 1.2.3  (optional)
         | 
| 166 | 
            +
            - SDL_mixer >= 1.2.7  (optional)
         | 
| 167 | 
            +
            - SDL_ttf   >= 2.0.6  (optional)
         | 
| 159 168 | 
             
            rubyforge_project: rubygame
         | 
| 160 | 
            -
            rubygems_version: 1.3. | 
| 169 | 
            +
            rubygems_version: 1.3.4
         | 
| 161 170 | 
             
            signing_key: 
         | 
| 162 | 
            -
            specification_version:  | 
| 171 | 
            +
            specification_version: 3
         | 
| 163 172 | 
             
            summary: Clean and powerful library for game programming
         | 
| 164 173 | 
             
            test_files: []
         | 
| 165 174 |  |