kawaii 0.1.0 → 0.1.1
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/.gitignore +4 -0
 - data/README.md +16 -22
 - data/backlog.md +10 -7
 - data/changelog.md +18 -0
 - data/lib/kawaii.rb +2 -0
 - data/lib/kawaii/camera.rb +24 -0
 - data/lib/kawaii/command.rb +34 -34
 - data/lib/kawaii/game.rb +22 -46
 - data/lib/kawaii/input_manager.rb +4 -0
 - data/lib/kawaii/intro.rb +44 -1
 - data/lib/kawaii/logo.png +0 -0
 - data/lib/kawaii/scene.rb +54 -2
 - data/lib/kawaii/scene_manager.rb +29 -5
 - data/lib/kawaii/tmx_tile_map.rb +6 -2
 - data/lib/kawaii/version.rb +1 -1
 - data/spec/kawaii/tmx_tile_map_spec.rb +4 -1
 - metadata +10 -7
 
    
        data/.gitignore
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,42 +1,36 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Kawaii <3
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            [ 
     | 
| 
      
 3 
     | 
    
         
            +
            * [Change log](https://github.com/eriksk/kawaii/blob/master/changelog.md)
         
     | 
| 
      
 4 
     | 
    
         
            +
            * [Feature list and development progress](https://github.com/eriksk/kawaii/blob/master/backlog.md)
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
       5 
6 
     | 
    
         
             
            ## What is Kawaii?
         
     | 
| 
       6 
7 
     | 
    
         
             
            Kawaii is a tiny game library for ruby built on top of gosu. It makes it quick and easy to create 2D games.
         
     | 
| 
       7 
8 
     | 
    
         | 
| 
       8 
9 
     | 
    
         
             
            ## How do I use it?
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
            To create a basic kawaii game, just install the gem
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            	gem install kawaii
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            And then run the following command
         
     | 
| 
       10 
15 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
            	kawaii new  
     | 
| 
      
 16 
     | 
    
         
            +
            	kawaii new mysuperawesomefirstgame
         
     | 
| 
       12 
17 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
            This will create a new game  
     | 
| 
       14 
     | 
    
         
            -
            To run the game just run the command:
         
     | 
| 
       15 
     | 
    
         
            -
            	
         
     | 
| 
       16 
     | 
    
         
            -
            	ruby my_awesome_game.rb
         
     | 
| 
      
 18 
     | 
    
         
            +
            This will create a new basic game with a default resolution set to 800 x 600.
         
     | 
| 
       17 
19 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
      
 20 
     | 
    
         
            +
            To change the configuration for the game simply edit the config.yml file that is created along with the game file. The config file itself is rather self-explanatory.
         
     | 
| 
       19 
21 
     | 
    
         | 
| 
       20 
22 
     | 
    
         
             
            ## Why does Kawaii exist?
         
     | 
| 
       21 
23 
     | 
    
         
             
            I wanted a way of quickly prototyping games for iPhone and iPad without Objective-C. Being pretty comfy with Ruby, I thought, why not!? 
         
     | 
| 
       22 
24 
     | 
    
         | 
| 
       23 
25 
     | 
    
         
             
            ## Will this be distributed as a gem?
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
      
 26 
     | 
    
         
            +
            It is! Just run this command to install it!
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            	gem install kawaii
         
     | 
| 
       25 
29 
     | 
    
         | 
| 
       26 
30 
     | 
    
         
             
            ## What kind of features will it have?
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
            	* Sharing sprites with nodes
         
     | 
| 
       31 
     | 
    
         
            -
            	* Tiling made easy
         
     | 
| 
       32 
     | 
    
         
            -
            * Animated sprites
         
     | 
| 
       33 
     | 
    
         
            -
            * Node management, a tree of nodes can be easily created and managed.
         
     | 
| 
       34 
     | 
    
         
            -
            * Menu system
         
     | 
| 
       35 
     | 
    
         
            -
            * Input management
         
     | 
| 
       36 
     | 
    
         
            -
            * Helper functions/math
         
     | 
| 
       37 
     | 
    
         
            -
            * Lots of tweenings & other juicyness
         
     | 
| 
       38 
     | 
    
         
            -
            * Tiled importer (<del>xml</del> & json)
         
     | 
| 
       39 
     | 
    
         
            -
            	* Imports maps from Tiled and draws them
         
     | 
| 
      
 31 
     | 
    
         
            +
            A lot! Check out the full list of implemented & to be implemented features 
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            [Feature list and development progress](https://github.com/eriksk/kawaii/blob/master/backlog.md)
         
     | 
| 
       40 
34 
     | 
    
         | 
| 
       41 
35 
     | 
    
         
             
            ##  Dependencies
         
     | 
| 
       42 
36 
     | 
    
         
             
            * [gosu '0.7.43'](https://github.com/jlnr/gosu)
         
     | 
    
        data/backlog.md
    CHANGED
    
    | 
         @@ -1,19 +1,17 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Kawaii backlog
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            ## Next up
         
     | 
| 
       4 
     | 
    
         
            -
            * Camera
         
     | 
| 
       5 
     | 
    
         
            -
            * Animated entities/sprites
         
     | 
| 
       6 
4 
     | 
    
         
             
            * Audio
         
     | 
| 
       7 
5 
     | 
    
         
             
            * Tweenings & juice
         
     | 
| 
       8 
     | 
    
         
            -
            * Make a super cute awesome kawaii logo
         
     | 
| 
       9 
     | 
    
         
            -
            * gem commands
         
     | 
| 
       10 
6 
     | 
    
         
             
            * Platform example game
         
     | 
| 
      
 7 
     | 
    
         
            +
            * Create a few video tutorials on how to use Kawaii
         
     | 
| 
       11 
8 
     | 
    
         | 
| 
       12 
9 
     | 
    
         
             
            ## Working on
         
     | 
| 
       13 
     | 
    
         
            -
            *  
     | 
| 
       14 
     | 
    
         
            -
            *  
     | 
| 
      
 10 
     | 
    
         
            +
            * Physics integration with chipmunk
         
     | 
| 
      
 11 
     | 
    
         
            +
            * Animated entities/sprites
         
     | 
| 
       15 
12 
     | 
    
         | 
| 
       16 
13 
     | 
    
         
             
            ## Completed
         
     | 
| 
      
 14 
     | 
    
         
            +
            * Make a super cute awesome kawaii logo
         
     | 
| 
       17 
15 
     | 
    
         
             
            * Tiled importer
         
     | 
| 
       18 
16 
     | 
    
         
             
            	* JSON importer
         
     | 
| 
       19 
17 
     | 
    
         
             
            	* <del>XML importer</del> (removed, don't want more dependencies. Besides, json works just fine)
         
     | 
| 
         @@ -22,5 +20,10 @@ 
     | 
|
| 
       22 
20 
     | 
    
         
             
            * Entity management
         
     | 
| 
       23 
21 
     | 
    
         
             
            * Content manager
         
     | 
| 
       24 
22 
     | 
    
         
             
            * Scene management
         
     | 
| 
      
 23 
     | 
    
         
            +
            	* Default intro and better scene handling
         
     | 
| 
       25 
24 
     | 
    
         
             
            * Input
         
     | 
| 
       26 
     | 
    
         
            -
            * Tiled maps usage
         
     | 
| 
      
 25 
     | 
    
         
            +
            * Tiled maps usage
         
     | 
| 
      
 26 
     | 
    
         
            +
            * gem commands
         
     | 
| 
      
 27 
     | 
    
         
            +
            * Camera
         
     | 
| 
      
 28 
     | 
    
         
            +
            * Vectors/Math
         
     | 
| 
      
 29 
     | 
    
         
            +
            * Config file
         
     | 
    
        data/changelog.md
    ADDED
    
    | 
         @@ -0,0 +1,18 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Kawaii change log
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            ## 0.1.1
         
     | 
| 
      
 4 
     | 
    
         
            +
            * New scripts for creating basic game
         
     | 
| 
      
 5 
     | 
    
         
            +
            * Minor bug fixes
         
     | 
| 
      
 6 
     | 
    
         
            +
            * Configuration file added when generating game
         
     | 
| 
      
 7 
     | 
    
         
            +
            * Scene manager now handles the entire flow of games
         
     | 
| 
      
 8 
     | 
    
         
            +
            	* Scene now contains all managers:
         
     | 
| 
      
 9 
     | 
    
         
            +
            		* Node manager
         
     | 
| 
      
 10 
     | 
    
         
            +
            		* Input manager
         
     | 
| 
      
 11 
     | 
    
         
            +
            		* Content manager
         
     | 
| 
      
 12 
     | 
    
         
            +
            		* TmxTileMap
         
     | 
| 
      
 13 
     | 
    
         
            +
            * TmxTileMaps now automatically load textures based on what's specified in Tiled.
         
     | 
| 
      
 14 
     | 
    
         
            +
            * Super awesome logo
         
     | 
| 
      
 15 
     | 
    
         
            +
            * Splash screen (can easily be removed)
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            ## 0.1.0
         
     | 
| 
      
 18 
     | 
    
         
            +
            * First release
         
     | 
    
        data/lib/kawaii.rb
    CHANGED
    
    
| 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Kawaii
         
     | 
| 
      
 2 
     | 
    
         
            +
            	class Camera
         
     | 
| 
      
 3 
     | 
    
         
            +
            		
         
     | 
| 
      
 4 
     | 
    
         
            +
            		def initialize game
         
     | 
| 
      
 5 
     | 
    
         
            +
            			@game = game
         
     | 
| 
      
 6 
     | 
    
         
            +
            			@pos = Vector2.new
         
     | 
| 
      
 7 
     | 
    
         
            +
            			@origin = Vector2.new(@game.width / 2, @game.height / 2)
         
     | 
| 
      
 8 
     | 
    
         
            +
            			@destination = Vector2.new
         
     | 
| 
      
 9 
     | 
    
         
            +
            			@speed = 0.05
         
     | 
| 
      
 10 
     | 
    
         
            +
            		end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            		def move x, y
         
     | 
| 
      
 13 
     | 
    
         
            +
            			@destination.x, @destination.y = x - @origin.x, y - @origin.y
         
     | 
| 
      
 14 
     | 
    
         
            +
            			@pos.x = Kawaii::lerp(@pos.x, @destination.x, @speed)
         
     | 
| 
      
 15 
     | 
    
         
            +
            			@pos.y = Kawaii::lerp(@pos.y, @destination.y, @speed)	
         
     | 
| 
      
 16 
     | 
    
         
            +
            		end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            		def translate(&block)
         
     | 
| 
      
 19 
     | 
    
         
            +
            			@game.translate(@pos.x, @pos.y) do
         
     | 
| 
      
 20 
     | 
    
         
            +
            				block.call()
         
     | 
| 
      
 21 
     | 
    
         
            +
            			end
         
     | 
| 
      
 22 
     | 
    
         
            +
            		end
         
     | 
| 
      
 23 
     | 
    
         
            +
            	end
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/kawaii/command.rb
    CHANGED
    
    | 
         @@ -34,53 +34,53 @@ module Kawaii 
     | 
|
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
            		private
         
     | 
| 
       36 
36 
     | 
    
         
             
            			def self.new_game_template args
         
     | 
| 
       37 
     | 
    
         
            -
            				width = 800
         
     | 
| 
       38 
     | 
    
         
            -
            				height = 600
         
     | 
| 
       39 
     | 
    
         
            -
            				fullscreen = false
         
     | 
| 
       40 
37 
     | 
    
         
             
            				game_class_name = args.first.capitalize 
         
     | 
| 
       41 
38 
     | 
    
         
             
            				File.open(args.first + ".rb", "w+") do |f|
         
     | 
| 
       42 
39 
     | 
    
         
             
            					f.write <<-EOF
         
     | 
| 
       43 
40 
     | 
    
         
             
            require 'kawaii'
         
     | 
| 
       44 
41 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
      
 42 
     | 
    
         
            +
            module #{game_class_name}
         
     | 
| 
      
 43 
     | 
    
         
            +
            	class Game < Kawaii::Game
         
     | 
| 
      
 44 
     | 
    
         
            +
            	  
         
     | 
| 
      
 45 
     | 
    
         
            +
            	  def initialize
         
     | 
| 
      
 46 
     | 
    
         
            +
            	    super
         
     | 
| 
      
 47 
     | 
    
         
            +
            	    load_game
         
     | 
| 
      
 48 
     | 
    
         
            +
            	  end
         
     | 
| 
      
 49 
     | 
    
         
            +
            	  
         
     | 
| 
      
 50 
     | 
    
         
            +
            	  def load_game
         
     | 
| 
      
 51 
     | 
    
         
            +
            	  	# TODO: create and load a scene
         
     | 
| 
      
 52 
     | 
    
         
            +
            	  	# example:	
         
     | 
| 
      
 53 
     | 
    
         
            +
            	    # @scene_manager.on_scene_activated lambda {
         
     | 
| 
      
 54 
     | 
    
         
            +
            	   	#	  @scene_manager.push_scene(MySceneClass.new(@scene_manager)) 
         
     | 
| 
      
 55 
     | 
    
         
            +
            	    # }	    	
         
     | 
| 
      
 56 
     | 
    
         
            +
            	  end
         
     | 
| 
       60 
57 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
              end
         
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
              def before_update
         
     | 
| 
       69 
     | 
    
         
            -
              	# TODO: game logic goes here
         
     | 
| 
       70 
     | 
    
         
            -
                input
         
     | 
| 
       71 
     | 
    
         
            -
              end
         
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
              def after_update
         
     | 
| 
       74 
     | 
    
         
            -
              	# TODO: game logic goes here	
         
     | 
| 
       75 
     | 
    
         
            -
              end
         
     | 
| 
      
 58 
     | 
    
         
            +
            	  def before_update
         
     | 
| 
      
 59 
     | 
    
         
            +
            	  	# allows the game to exit
         
     | 
| 
      
 60 
     | 
    
         
            +
            	    exit() if button_down?(Gosu::KbEscape)
         
     | 
| 
      
 61 
     | 
    
         
            +
            	  end
         
     | 
| 
      
 62 
     | 
    
         
            +
            	end
         
     | 
| 
       76 
63 
     | 
    
         
             
            end
         
     | 
| 
       77 
64 
     | 
    
         | 
| 
       78 
65 
     | 
    
         
             
            # entry point
         
     | 
| 
       79 
     | 
    
         
            -
            game = #{game_class_name}.new
         
     | 
| 
      
 66 
     | 
    
         
            +
            game = #{game_class_name}::Game.new
         
     | 
| 
       80 
67 
     | 
    
         
             
            game.show
         
     | 
| 
       81 
68 
     | 
    
         
             
            				EOF
         
     | 
| 
       82 
69 
     | 
    
         
             
            				end
         
     | 
| 
       83 
70 
     | 
    
         | 
| 
      
 71 
     | 
    
         
            +
            				# write config file
         
     | 
| 
      
 72 
     | 
    
         
            +
            				File.open("config.yml", "w+") do |f|
         
     | 
| 
      
 73 
     | 
    
         
            +
            					f.write <<-EOF
         
     | 
| 
      
 74 
     | 
    
         
            +
            # kawaii configuration
         
     | 
| 
      
 75 
     | 
    
         
            +
            resolution:
         
     | 
| 
      
 76 
     | 
    
         
            +
              width: 800
         
     | 
| 
      
 77 
     | 
    
         
            +
              height: 600
         
     | 
| 
      
 78 
     | 
    
         
            +
            fullscreen: false
         
     | 
| 
      
 79 
     | 
    
         
            +
            content_root: content
         
     | 
| 
      
 80 
     | 
    
         
            +
            debug: true
         
     | 
| 
      
 81 
     | 
    
         
            +
            					EOF
         
     | 
| 
      
 82 
     | 
    
         
            +
            				end
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
       84 
84 
     | 
    
         
             
            				puts "Successfully created new game '#{game_class_name}'".green
         
     | 
| 
       85 
85 
     | 
    
         
             
            				puts "Run it with the command: " + "ruby #{args.first}.rb".yellow
         
     | 
| 
       86 
86 
     | 
    
         
             
            			end
         
     | 
    
        data/lib/kawaii/game.rb
    CHANGED
    
    | 
         @@ -1,62 +1,46 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'gosu'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'yaml'
         
     | 
| 
       2 
3 
     | 
    
         | 
| 
       3 
4 
     | 
    
         
             
            module Kawaii
         
     | 
| 
       4 
5 
     | 
    
         
             
              class Game < Gosu::Window
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
                 
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
                   
     | 
| 
      
 7 
     | 
    
         
            +
                CONFIG_PATH = File.expand_path(".") +'/config.yml'
         
     | 
| 
      
 8 
     | 
    
         
            +
                CONFIG = YAML.load_file(CONFIG_PATH) if File.exist?(CONFIG_PATH)
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                attr_accessor :width, :height, :fullscreen, :show_fps, :font, :content_root
         
     | 
| 
      
 11 
     | 
    
         
            +
                  
         
     | 
| 
      
 12 
     | 
    
         
            +
                def initialize
         
     | 
| 
      
 13 
     | 
    
         
            +
                  super CONFIG['resolution']['width'], CONFIG['resolution']['height'], CONFIG['fullscreen']
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @width, @height, @fullscreen = CONFIG['resolution']['width'], CONFIG['resolution']['height'], CONFIG['fullscreen']
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @content_root = CONFIG['content_root']
         
     | 
| 
       11 
16 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                   
     | 
| 
       13 
     | 
    
         
            -
                   
     | 
| 
       14 
     | 
    
         
            -
                  @ 
     | 
| 
       15 
     | 
    
         
            -
                  @audio_manager = Kawaii::AudioManager.new(self)
         
     | 
| 
       16 
     | 
    
         
            -
                  @input_manager = Kawaii::InputManager.new(self)
         
     | 
| 
       17 
     | 
    
         
            -
                  @physics_manager = Kawaii::PhysicsManager.new
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @scene_manager = Kawaii::SceneManager.new(self) 
         
     | 
| 
      
 18 
     | 
    
         
            +
                  # load intro scene
         
     | 
| 
      
 19 
     | 
    
         
            +
                  @scene_manager.push_scene Kawaii::Intro.new @scene_manager
         
     | 
| 
       18 
20 
     | 
    
         | 
| 
       19 
21 
     | 
    
         
             
                  # stats
         
     | 
| 
       20 
22 
     | 
    
         
             
                  @top_color = Gosu::Color.new(0xFF1EB1FA)
         
     | 
| 
       21 
23 
     | 
    
         
             
                  @bottom_color = Gosu::Color.new(0xFF1D4DB5)
         
     | 
| 
       22 
24 
     | 
    
         
             
                  @font = Gosu::Font.new(self, Gosu::default_font_name, 18)
         
     | 
| 
       23 
     | 
    
         
            -
                  @debug = debug
         
     | 
| 
      
 25 
     | 
    
         
            +
                  @debug = CONFIG['debug']
         
     | 
| 
       24 
26 
     | 
    
         | 
| 
       25 
27 
     | 
    
         
             
                  if @debug
         
     | 
| 
       26 
28 
     | 
    
         
             
                    puts "Game settings:"
         
     | 
| 
       27 
29 
     | 
    
         
             
                    puts "\tResolution: #{width}:#{height}"
         
     | 
| 
       28 
30 
     | 
    
         
             
                    puts "\tFullscreen: #{fullscreen}"
         
     | 
| 
       29 
31 
     | 
    
         
             
                    puts "\tContent root: #{content_root}"
         
     | 
| 
       30 
     | 
    
         
            -
                    print_stats
         
     | 
| 
       31 
32 
     | 
    
         
             
                  end
         
     | 
| 
       32 
33 
     | 
    
         
             
                end
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
                def  
     | 
| 
       35 
     | 
    
         
            -
                   
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
                def remove_child node
         
     | 
| 
       39 
     | 
    
         
            -
                  @node_manager.nodes.delete node
         
     | 
| 
      
 34 
     | 
    
         
            +
              
         
     | 
| 
      
 35 
     | 
    
         
            +
                def update
         
     | 
| 
      
 36 
     | 
    
         
            +
                  before_update()
         
     | 
| 
      
 37 
     | 
    
         
            +
                  @dt = delta()
         
     | 
| 
      
 38 
     | 
    
         
            +
                  @scene_manager.update @dt
         
     | 
| 
       40 
39 
     | 
    
         
             
                end
         
     | 
| 
       41 
40 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
                def  
     | 
| 
       43 
     | 
    
         
            -
                  puts "Statistics:"
         
     | 
| 
       44 
     | 
    
         
            -
                  puts "Nodes: #{node_manager.count}"
         
     | 
| 
      
 41 
     | 
    
         
            +
                def before_update
         
     | 
| 
       45 
42 
     | 
    
         
             
                end
         
     | 
| 
       46 
     | 
    
         
            -
                
         
     | 
| 
       47 
     | 
    
         
            -
                def update
         
     | 
| 
       48 
     | 
    
         
            -
                  if self.class.method_defined? :before_update
         
     | 
| 
       49 
     | 
    
         
            -
                    before_update
         
     | 
| 
       50 
     | 
    
         
            -
                  end
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
                  @dt = delta()
         
     | 
| 
       53 
     | 
    
         
            -
                  @node_manager.update @dt
         
     | 
| 
       54 
43 
     | 
    
         | 
| 
       55 
     | 
    
         
            -
                  if self.class.method_defined? :after_update
         
     | 
| 
       56 
     | 
    
         
            -
                    after_update
         
     | 
| 
       57 
     | 
    
         
            -
                  end
         
     | 
| 
       58 
     | 
    
         
            -
                end
         
     | 
| 
       59 
     | 
    
         
            -
              
         
     | 
| 
       60 
44 
     | 
    
         
             
                def delta
         
     | 
| 
       61 
45 
     | 
    
         
             
                  16.0 # TODO: real delta
         
     | 
| 
       62 
46 
     | 
    
         
             
                end
         
     | 
| 
         @@ -65,12 +49,6 @@ module Kawaii 
     | 
|
| 
       65 
49 
     | 
    
         
             
                  1000.0 / delta
         
     | 
| 
       66 
50 
     | 
    
         
             
                end
         
     | 
| 
       67 
51 
     | 
    
         | 
| 
       68 
     | 
    
         
            -
                def before_draw
         
     | 
| 
       69 
     | 
    
         
            -
                end
         
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
                def after_draw
         
     | 
| 
       72 
     | 
    
         
            -
                end
         
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
52 
     | 
    
         
             
                def draw
         
     | 
| 
       75 
53 
     | 
    
         
             
                  draw_quad(
         
     | 
| 
       76 
54 
     | 
    
         
             
                    0, 0, @top_color,
         
     | 
| 
         @@ -78,12 +56,10 @@ module Kawaii 
     | 
|
| 
       78 
56 
     | 
    
         
             
                    @width, @height, @bottom_color,
         
     | 
| 
       79 
57 
     | 
    
         
             
                    0, @height, @bottom_color,
         
     | 
| 
       80 
58 
     | 
    
         
             
                  )
         
     | 
| 
       81 
     | 
    
         
            -
                   
     | 
| 
       82 
     | 
    
         
            -
                  @node_manager.draw
         
     | 
| 
      
 59 
     | 
    
         
            +
                  @scene_manager.draw
         
     | 
| 
       83 
60 
     | 
    
         
             
                  if @debug
         
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
      
 61 
     | 
    
         
            +
                      @font.draw("FPS: #{get_fps}", 14, 14, 0)
         
     | 
| 
       85 
62 
     | 
    
         
             
                  end
         
     | 
| 
       86 
     | 
    
         
            -
                  after_draw
         
     | 
| 
       87 
63 
     | 
    
         
             
                end 
         
     | 
| 
       88 
64 
     | 
    
         
             
              end
         
     | 
| 
       89 
65 
     | 
    
         
             
            end
         
     | 
    
        data/lib/kawaii/input_manager.rb
    CHANGED
    
    
    
        data/lib/kawaii/intro.rb
    CHANGED
    
    | 
         @@ -1,4 +1,47 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Kawaii
         
     | 
| 
       2 
     | 
    
         
            -
            	class Intro
         
     | 
| 
      
 2 
     | 
    
         
            +
            	class Intro < Scene
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            		def load
         
     | 
| 
      
 5 
     | 
    
         
            +
            			@logo = Gosu::Image.new(game(), File.dirname(__FILE__) + '/logo.png', false)	
         
     | 
| 
      
 6 
     | 
    
         
            +
            			@rotation = 0
         
     | 
| 
      
 7 
     | 
    
         
            +
            			@position = Vector2.new(game().width / 2, game().height / 2)
         
     | 
| 
      
 8 
     | 
    
         
            +
            			@scale = 1
         
     | 
| 
      
 9 
     | 
    
         
            +
            			@transition_duration = 2500
         
     | 
| 
      
 10 
     | 
    
         
            +
            			@color = Gosu::Color::WHITE
         
     | 
| 
      
 11 
     | 
    
         
            +
            			@color.alpha = 0
         
     | 
| 
      
 12 
     | 
    
         
            +
            		end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            		def transition_in current, duration
         
     | 
| 
      
 15 
     | 
    
         
            +
            			fake_duration = 750
         
     | 
| 
      
 16 
     | 
    
         
            +
            			dead_zone = 1200
         
     | 
| 
      
 17 
     | 
    
         
            +
            			if current <= fake_duration
         
     | 
| 
      
 18 
     | 
    
         
            +
            				@rotation = Kawaii::clerp(0, (360 * 2) - 145, current / (fake_duration * 0.7))
         
     | 
| 
      
 19 
     | 
    
         
            +
            				@scale = Kawaii::clerp(0.1, 1.0, current / (fake_duration * 0.8))
         
     | 
| 
      
 20 
     | 
    
         
            +
            			elsif current <= dead_zone
         
     | 
| 
      
 21 
     | 
    
         
            +
            			else
         
     | 
| 
      
 22 
     | 
    
         
            +
            				@rotation = Kawaii::clerp(@rotation, 0, (current - dead_zone) / ((duration - dead_zone) * 1.4))
         
     | 
| 
      
 23 
     | 
    
         
            +
            				@scale = Kawaii::clerp(@scale, 0, (current - dead_zone) / ((duration - dead_zone) * 1.4))
         
     | 
| 
      
 24 
     | 
    
         
            +
            				@position.x = Kawaii::clerp(game().width / 2, game().width + 400, (current - dead_zone) / ((duration - dead_zone) * 1.3))
         
     | 
| 
      
 25 
     | 
    
         
            +
            				@position.y += 5
         
     | 
| 
      
 26 
     | 
    
         
            +
            				@color.alpha = Kawaii::clerp(0, 255, (current - dead_zone) / ((duration - dead_zone)))
         
     | 
| 
      
 27 
     | 
    
         
            +
            			end
         
     | 
| 
      
 28 
     | 
    
         
            +
            		end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            		def transition_out current, duration
         
     | 
| 
      
 31 
     | 
    
         
            +
            		end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            		def update dt
         
     | 
| 
      
 34 
     | 
    
         
            +
            		end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            		def draw
         
     | 
| 
      
 37 
     | 
    
         
            +
            			@logo.draw_rot(@position.x, @position.y, 0, @rotation, 0.5, 0.5, @scale, @scale)
         
     | 
| 
      
 38 
     | 
    
         
            +
            		
         
     | 
| 
      
 39 
     | 
    
         
            +
            			game.draw_quad(
         
     | 
| 
      
 40 
     | 
    
         
            +
            		        0, 0, @color,
         
     | 
| 
      
 41 
     | 
    
         
            +
            		        game.width, 0, @color,
         
     | 
| 
      
 42 
     | 
    
         
            +
            		        game.width, game.height, @color,
         
     | 
| 
      
 43 
     | 
    
         
            +
            		        0, game.height, @color,
         
     | 
| 
      
 44 
     | 
    
         
            +
            		      )
         
     | 
| 
      
 45 
     | 
    
         
            +
            		end
         
     | 
| 
       3 
46 
     | 
    
         
             
            	end
         
     | 
| 
       4 
47 
     | 
    
         
             
            end
         
     | 
    
        data/lib/kawaii/logo.png
    ADDED
    
    | 
         Binary file 
     | 
    
        data/lib/kawaii/scene.rb
    CHANGED
    
    | 
         @@ -1,9 +1,39 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Kawaii
         
     | 
| 
       2 
2 
     | 
    
         
             
            	class Scene
         
     | 
| 
       3 
     | 
    
         
            -
            		attr_accessor :name, :scene_manager
         
     | 
| 
      
 3 
     | 
    
         
            +
            		attr_accessor :name, :scene_manager, :transition_duration
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            		def initialize scene_manager
         
     | 
| 
       6 
6 
     | 
    
         
             
            			@scene_manager = scene_manager
         
     | 
| 
      
 7 
     | 
    
         
            +
            			
         
     | 
| 
      
 8 
     | 
    
         
            +
            			# managers
         
     | 
| 
      
 9 
     | 
    
         
            +
            			@node_manager = Kawaii::NodeManager.new
         
     | 
| 
      
 10 
     | 
    
         
            +
            			@content = Kawaii::ContentManager.new(scene_manager.game, scene_manager.game.content_root)  
         
     | 
| 
      
 11 
     | 
    
         
            +
            			@audio = Kawaii::AudioManager.new(scene_manager.game)
         
     | 
| 
      
 12 
     | 
    
         
            +
            			@input = Kawaii::InputManager.new(scene_manager.game)
         
     | 
| 
      
 13 
     | 
    
         
            +
            			@physics = Kawaii::PhysicsManager.new
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            			# cam
         
     | 
| 
      
 16 
     | 
    
         
            +
            			@cam = Kawaii::Camera.new(scene_manager.game)
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            			# set default duration
         
     | 
| 
      
 19 
     | 
    
         
            +
            			@transition_duration = SCENE_TRANSITION_DURATION
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            			load()
         
     | 
| 
      
 22 
     | 
    
         
            +
            		end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            		def add_child node
         
     | 
| 
      
 25 
     | 
    
         
            +
            			@node_manager.nodes.push node
         
     | 
| 
      
 26 
     | 
    
         
            +
            		end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            		def remove_child node
         
     | 
| 
      
 29 
     | 
    
         
            +
            			@node_manager.nodes.delete node
         
     | 
| 
      
 30 
     | 
    
         
            +
            		end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            		def load
         
     | 
| 
      
 33 
     | 
    
         
            +
            		end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            		def game
         
     | 
| 
      
 36 
     | 
    
         
            +
            			@scene_manager.game
         
     | 
| 
       7 
37 
     | 
    
         
             
            		end
         
     | 
| 
       8 
38 
     | 
    
         | 
| 
       9 
39 
     | 
    
         
             
            		def transition_in current, duration
         
     | 
| 
         @@ -13,9 +43,31 @@ module Kawaii 
     | 
|
| 
       13 
43 
     | 
    
         
             
            		end
         
     | 
| 
       14 
44 
     | 
    
         | 
| 
       15 
45 
     | 
    
         
             
            		def update dt
         
     | 
| 
      
 46 
     | 
    
         
            +
            			@input.update
         
     | 
| 
      
 47 
     | 
    
         
            +
            			before_update()
         
     | 
| 
      
 48 
     | 
    
         
            +
                  		@node_manager.update dt
         
     | 
| 
      
 49 
     | 
    
         
            +
                  		after_update()
         
     | 
| 
       16 
50 
     | 
    
         
             
            		end
         
     | 
| 
       17 
51 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            		def  
     | 
| 
      
 52 
     | 
    
         
            +
            		def before_update
         
     | 
| 
      
 53 
     | 
    
         
            +
            		end
         
     | 
| 
      
 54 
     | 
    
         
            +
            		def after_update
         
     | 
| 
       19 
55 
     | 
    
         
             
            		end
         
     | 
| 
      
 56 
     | 
    
         
            +
            		def before_draw
         
     | 
| 
      
 57 
     | 
    
         
            +
            		end
         
     | 
| 
      
 58 
     | 
    
         
            +
            		def draw_hud
         
     | 
| 
      
 59 
     | 
    
         
            +
            		end
         
     | 
| 
      
 60 
     | 
    
         
            +
            	    def after_draw
         
     | 
| 
      
 61 
     | 
    
         
            +
            	    end
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            	    def draw
         
     | 
| 
      
 64 
     | 
    
         
            +
            	      @cam.translate do 
         
     | 
| 
      
 65 
     | 
    
         
            +
            	        before_draw
         
     | 
| 
      
 66 
     | 
    
         
            +
            	        @node_manager.draw  
         
     | 
| 
      
 67 
     | 
    
         
            +
            	        after_draw
         
     | 
| 
      
 68 
     | 
    
         
            +
            	      end
         
     | 
| 
      
 69 
     | 
    
         
            +
            	      
         
     | 
| 
      
 70 
     | 
    
         
            +
            	      draw_hud
         
     | 
| 
      
 71 
     | 
    
         
            +
            	    end
         
     | 
| 
       20 
72 
     | 
    
         
             
            	end
         
     | 
| 
       21 
73 
     | 
    
         
             
            end
         
     | 
    
        data/lib/kawaii/scene_manager.rb
    CHANGED
    
    | 
         @@ -1,34 +1,58 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Kawaii
         
     | 
| 
       2 
2 
     | 
    
         
             
            	class SceneManager
         
     | 
| 
       3 
     | 
    
         
            -
            		attr_accessor :scene
         
     | 
| 
      
 3 
     | 
    
         
            +
            		attr_accessor :game, :scene
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
            		def initialize scene = nil
         
     | 
| 
      
 5 
     | 
    
         
            +
            		def initialize game, scene = nil
         
     | 
| 
      
 6 
     | 
    
         
            +
            			@game = game
         
     | 
| 
       6 
7 
     | 
    
         
             
            			@scene = scene
         
     | 
| 
       7 
8 
     | 
    
         
             
            			@old_scene = nil
         
     | 
| 
       8 
9 
     | 
    
         
             
            			@current_transition = 0.0
         
     | 
| 
       9 
10 
     | 
    
         
             
            			@state = :none
         
     | 
| 
       10 
11 
     | 
    
         
             
            			@state = :transition if @scene != nil
         
     | 
| 
      
 12 
     | 
    
         
            +
            			@on_scene_activated = []
         
     | 
| 
       11 
13 
     | 
    
         
             
            		end
         
     | 
| 
       12 
14 
     | 
    
         | 
| 
      
 15 
     | 
    
         
            +
            		# switches to a new scene and loads it
         
     | 
| 
       13 
16 
     | 
    
         
             
            		def push_scene scene
         
     | 
| 
       14 
17 
     | 
    
         
             
            			@old_scene = @scene
         
     | 
| 
       15 
18 
     | 
    
         
             
            			@scene = scene		
         
     | 
| 
      
 19 
     | 
    
         
            +
            			@scene.load
         
     | 
| 
      
 20 
     | 
    
         
            +
            			@current_transition = 0.0
         
     | 
| 
      
 21 
     | 
    
         
            +
            			@state = :transition
         
     | 
| 
      
 22 
     | 
    
         
            +
            		end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            		# removes the current scene
         
     | 
| 
      
 25 
     | 
    
         
            +
            		def pop_scene
         
     | 
| 
      
 26 
     | 
    
         
            +
            			@state = :none
         
     | 
| 
      
 27 
     | 
    
         
            +
            			@old_scene = nil
         
     | 
| 
      
 28 
     | 
    
         
            +
            			@scene = nil
         
     | 
| 
      
 29 
     | 
    
         
            +
            		end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            		def on_scene_activated(lmbda)
         
     | 
| 
      
 32 
     | 
    
         
            +
            			@on_scene_activated << lmbda
         
     | 
| 
       16 
33 
     | 
    
         
             
            		end
         
     | 
| 
       17 
34 
     | 
    
         | 
| 
       18 
35 
     | 
    
         
             
            		def update dt
         
     | 
| 
       19 
36 
     | 
    
         
             
            			case @state
         
     | 
| 
       20 
37 
     | 
    
         
             
            				when :none
         
     | 
| 
      
 38 
     | 
    
         
            +
            					@scene.update dt
         
     | 
| 
       21 
39 
     | 
    
         
             
            				when :transition
         
     | 
| 
       22 
40 
     | 
    
         
             
            					if @scene != nil
         
     | 
| 
       23 
     | 
    
         
            -
            						@scene.transition_in @current_transition,  
     | 
| 
      
 41 
     | 
    
         
            +
            						@scene.transition_in @current_transition, @scene.transition_duration
         
     | 
| 
       24 
42 
     | 
    
         
             
            					end
         
     | 
| 
       25 
43 
     | 
    
         
             
            					if @old_scene != nil
         
     | 
| 
       26 
     | 
    
         
            -
            						@old_scene.transition_out @current_transition,  
     | 
| 
      
 44 
     | 
    
         
            +
            						@old_scene.transition_out @current_transition, @old_scene.transition_duration
         
     | 
| 
       27 
45 
     | 
    
         
             
            					end
         
     | 
| 
       28 
46 
     | 
    
         | 
| 
       29 
47 
     | 
    
         
             
            					@current_transition += dt
         
     | 
| 
       30 
     | 
    
         
            -
            					if @current_transition >  
     | 
| 
      
 48 
     | 
    
         
            +
            					if @current_transition > @scene.transition_duration
         
     | 
| 
       31 
49 
     | 
    
         
             
            						@state = :transition_done
         
     | 
| 
      
 50 
     | 
    
         
            +
            						@current_transition = 0.0
         
     | 
| 
      
 51 
     | 
    
         
            +
            						@on_scene_activated.each do |l|
         
     | 
| 
      
 52 
     | 
    
         
            +
            							l.call()
         
     | 
| 
      
 53 
     | 
    
         
            +
            						end
         
     | 
| 
      
 54 
     | 
    
         
            +
            						# remove jobs
         
     | 
| 
      
 55 
     | 
    
         
            +
            						@on_scene_activated.clear
         
     | 
| 
       32 
56 
     | 
    
         
             
            					end
         
     | 
| 
       33 
57 
     | 
    
         
             
            				when :transition_done
         
     | 
| 
       34 
58 
     | 
    
         
             
            					@current_transition = 0.0
         
     | 
    
        data/lib/kawaii/tmx_tile_map.rb
    CHANGED
    
    | 
         @@ -8,6 +8,7 @@ module Kawaii 
     | 
|
| 
       8 
8 
     | 
    
         
             
            		def initialize
         
     | 
| 
       9 
9 
     | 
    
         
             
            			@layers = []
         
     | 
| 
       10 
10 
     | 
    
         
             
            			@properties = {}
         
     | 
| 
      
 11 
     | 
    
         
            +
            			@tilesets = []
         
     | 
| 
       11 
12 
     | 
    
         
             
            		end
         
     | 
| 
       12 
13 
     | 
    
         | 
| 
       13 
14 
     | 
    
         
             
            		def draw
         
     | 
| 
         @@ -20,7 +21,7 @@ module Kawaii 
     | 
|
| 
       20 
21 
     | 
    
         
             
            			if path.end_with? ".json"
         
     | 
| 
       21 
22 
     | 
    
         
             
            				load_json path
         
     | 
| 
       22 
23 
     | 
    
         
             
            				@layers.each do |layer|
         
     | 
| 
       23 
     | 
    
         
            -
            					layer.textures = content_manager.load_tiled_images( 
     | 
| 
      
 24 
     | 
    
         
            +
            					layer.textures = content_manager.load_tiled_images(@tilesets.first.gsub(/\.\.\//, ""), 32)
         
     | 
| 
       24 
25 
     | 
    
         
             
            				end
         
     | 
| 
       25 
26 
     | 
    
         
             
            			else
         
     | 
| 
       26 
27 
     | 
    
         
             
            				raise UnsupportedFormatError, "only json is supported"
         
     | 
| 
         @@ -46,7 +47,7 @@ module Kawaii 
     | 
|
| 
       46 
47 
     | 
    
         
             
            			end
         
     | 
| 
       47 
48 
     | 
    
         
             
            		end
         
     | 
| 
       48 
49 
     | 
    
         | 
| 
       49 
     | 
    
         
            -
            		 
     | 
| 
      
 50 
     | 
    
         
            +
            		protected
         
     | 
| 
       50 
51 
     | 
    
         
             
            			def load_json path
         
     | 
| 
       51 
52 
     | 
    
         
             
            				File.open(path) do |f|
         
     | 
| 
       52 
53 
     | 
    
         
             
            					populate JSON.parse(f.read)
         
     | 
| 
         @@ -65,6 +66,9 @@ module Kawaii 
     | 
|
| 
       65 
66 
     | 
    
         
             
            				hash['properties'].each do |property|
         
     | 
| 
       66 
67 
     | 
    
         
             
            					@properties[property['key']] = property['value']
         
     | 
| 
       67 
68 
     | 
    
         
             
            				end
         
     | 
| 
      
 69 
     | 
    
         
            +
            				hash['tilesets'].each do|tileset|
         
     | 
| 
      
 70 
     | 
    
         
            +
            					@tilesets.push tileset['image']
         
     | 
| 
      
 71 
     | 
    
         
            +
            				end
         
     | 
| 
       68 
72 
     | 
    
         
             
            			end
         
     | 
| 
       69 
73 
     | 
    
         
             
            	end
         
     | 
| 
       70 
74 
     | 
    
         
             
            end
         
     | 
    
        data/lib/kawaii/version.rb
    CHANGED
    
    
| 
         @@ -21,10 +21,13 @@ module Kawaii 
     | 
|
| 
       21 
21 
     | 
    
         
             
            		it "should contain properties" do
         
     | 
| 
       22 
22 
     | 
    
         
             
            			@tile_map.should respond_to :properties
         
     | 
| 
       23 
23 
     | 
    
         
             
            		end
         
     | 
| 
      
 24 
     | 
    
         
            +
            		it "should contain tilesets" do
         
     | 
| 
      
 25 
     | 
    
         
            +
            			@tile_map.should respond_to :tilesets
         
     | 
| 
      
 26 
     | 
    
         
            +
            		end
         
     | 
| 
       24 
27 
     | 
    
         | 
| 
       25 
28 
     | 
    
         
             
            		describe "#load" do
         
     | 
| 
       26 
29 
     | 
    
         
             
            			it "should be able to load a tmx.json file" do
         
     | 
| 
       27 
     | 
    
         
            -
            				@tile_map.load(' 
     | 
| 
      
 30 
     | 
    
         
            +
            				@tile_map.load('content/maps/test_map.json')
         
     | 
| 
       28 
31 
     | 
    
         
             
            				@tile_map.width.should == 32
         
     | 
| 
       29 
32 
     | 
    
         
             
            				@tile_map.height.should == 32
         
     | 
| 
       30 
33 
     | 
    
         
             
            				@tile_map.layers.size.should be(1)
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: kawaii
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.1
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -13,7 +13,7 @@ date: 2012-07-11 00:00:00.000000000 Z 
     | 
|
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: gosu
         
     | 
| 
       16 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 16 
     | 
    
         
            +
              requirement: &70350239722340 !ruby/object:Gem::Requirement
         
     | 
| 
       17 
17 
     | 
    
         
             
                none: false
         
     | 
| 
       18 
18 
     | 
    
         
             
                requirements:
         
     | 
| 
       19 
19 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -21,10 +21,10 @@ dependencies: 
     | 
|
| 
       21 
21 
     | 
    
         
             
                    version: 0.7.43
         
     | 
| 
       22 
22 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       23 
23 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       24 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 24 
     | 
    
         
            +
              version_requirements: *70350239722340
         
     | 
| 
       25 
25 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       26 
26 
     | 
    
         
             
              name: chipmunk
         
     | 
| 
       27 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 27 
     | 
    
         
            +
              requirement: &70350239721740 !ruby/object:Gem::Requirement
         
     | 
| 
       28 
28 
     | 
    
         
             
                none: false
         
     | 
| 
       29 
29 
     | 
    
         
             
                requirements:
         
     | 
| 
       30 
30 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -32,10 +32,10 @@ dependencies: 
     | 
|
| 
       32 
32 
     | 
    
         
             
                    version: 5.3.4.5
         
     | 
| 
       33 
33 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       34 
34 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       35 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 35 
     | 
    
         
            +
              version_requirements: *70350239721740
         
     | 
| 
       36 
36 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       37 
37 
     | 
    
         
             
              name: rspec
         
     | 
| 
       38 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 38 
     | 
    
         
            +
              requirement: &70350239721180 !ruby/object:Gem::Requirement
         
     | 
| 
       39 
39 
     | 
    
         
             
                none: false
         
     | 
| 
       40 
40 
     | 
    
         
             
                requirements:
         
     | 
| 
       41 
41 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -43,7 +43,7 @@ dependencies: 
     | 
|
| 
       43 
43 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       44 
44 
     | 
    
         
             
              type: :development
         
     | 
| 
       45 
45 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       46 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 46 
     | 
    
         
            +
              version_requirements: *70350239721180
         
     | 
| 
       47 
47 
     | 
    
         
             
            description: kawaii provides a tiny game library that extends gosu
         
     | 
| 
       48 
48 
     | 
    
         
             
            email: erikskoglund88@gmail.com
         
     | 
| 
       49 
49 
     | 
    
         
             
            executables:
         
     | 
| 
         @@ -64,6 +64,7 @@ files: 
     | 
|
| 
       64 
64 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       65 
65 
     | 
    
         
             
            - backlog.md
         
     | 
| 
       66 
66 
     | 
    
         
             
            - bin/kawaii
         
     | 
| 
      
 67 
     | 
    
         
            +
            - changelog.md
         
     | 
| 
       67 
68 
     | 
    
         
             
            - doc/Kawaii.html
         
     | 
| 
       68 
69 
     | 
    
         
             
            - doc/Kawaii/Animation.html
         
     | 
| 
       69 
70 
     | 
    
         
             
            - doc/Kawaii/AudioManager.html
         
     | 
| 
         @@ -101,6 +102,7 @@ files: 
     | 
|
| 
       101 
102 
     | 
    
         
             
            - lib/kawaii.rb
         
     | 
| 
       102 
103 
     | 
    
         
             
            - lib/kawaii/animation.rb
         
     | 
| 
       103 
104 
     | 
    
         
             
            - lib/kawaii/audio_manager.rb
         
     | 
| 
      
 105 
     | 
    
         
            +
            - lib/kawaii/camera.rb
         
     | 
| 
       104 
106 
     | 
    
         
             
            - lib/kawaii/command.rb
         
     | 
| 
       105 
107 
     | 
    
         
             
            - lib/kawaii/constants.rb
         
     | 
| 
       106 
108 
     | 
    
         
             
            - lib/kawaii/content_manager.rb
         
     | 
| 
         @@ -110,6 +112,7 @@ files: 
     | 
|
| 
       110 
112 
     | 
    
         
             
            - lib/kawaii/helpers.rb
         
     | 
| 
       111 
113 
     | 
    
         
             
            - lib/kawaii/input_manager.rb
         
     | 
| 
       112 
114 
     | 
    
         
             
            - lib/kawaii/intro.rb
         
     | 
| 
      
 115 
     | 
    
         
            +
            - lib/kawaii/logo.png
         
     | 
| 
       113 
116 
     | 
    
         
             
            - lib/kawaii/math.rb
         
     | 
| 
       114 
117 
     | 
    
         
             
            - lib/kawaii/node.rb
         
     | 
| 
       115 
118 
     | 
    
         
             
            - lib/kawaii/node_manager.rb
         
     |