<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>.gitignore</filename>
    </added>
    <added>
      <filename>behaviour.rb</filename>
    </added>
    <added>
      <filename>behaviours/physical.rb</filename>
    </added>
    <added>
      <filename>conditional_trigger.rb</filename>
    </added>
    <added>
      <filename>config.rb</filename>
    </added>
    <added>
      <filename>drawer.rb</filename>
    </added>
    <added>
      <filename>drawing_manager.rb</filename>
    </added>
    <added>
      <filename>events/draw_event.rb</filename>
    </added>
    <added>
      <filename>events/game_start_event.rb</filename>
    </added>
    <added>
      <filename>events/object_added_event.rb</filename>
    </added>
    <added>
      <filename>events/resize_event.rb</filename>
    </added>
    <added>
      <filename>events/second_passed_event.rb</filename>
    </added>
    <added>
      <filename>events/tick_event.rb</filename>
    </added>
    <added>
      <filename>game_object.rb</filename>
    </added>
    <added>
      <filename>gosu_game.rb</filename>
    </added>
    <added>
      <filename>gosu_graphics_driver.rb</filename>
    </added>
    <added>
      <filename>main.rb</filename>
    </added>
    <added>
      <filename>objects/box.rb</filename>
    </added>
    <added>
      <filename>physics_manager.rb</filename>
    </added>
    <added>
      <filename>rubygame_game.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -13,10 +13,10 @@ class Dispatcher
     @types &lt;&lt; type
   end
 
-  def remove(callable, type=nil)
-    if type
+  def remove(callable, options={})
+    if options[:for]
       # Delete specific reference
-      @map[type].delete callable
+      @map[options[:for]].delete callable
     else
       # Delete all references
       @map.values.each do |a|
@@ -26,6 +26,8 @@ class Dispatcher
   end
   
   def dispatch(event)
+    raise &quot;Event must be an event!&quot; unless event.is_a? Event
+    
     matching_types = @types.select {|type| type.match event }
     
     matching_types.each do |type|</diff>
      <filename>dispatcher.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,11 @@
+require 'conditional_trigger' 
+
 class Event
-  def self.match(other)
-    other == self or other.class == self
+  def self.match(event)
+    event.is_a? self
   end
 
-  alias :match :==
+  def self.where(&amp;blk)
+    ConditionalTrigger.new(self, blk)
+  end
 end</diff>
      <filename>event.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,16 +1,11 @@
-require 'queue'
-require 'tick_event'
-require 'world'
+require 'config'
+require 'rubygame_game'
+require 'gosu_game'
 
-class Game
-  def initialize
-    @world = World.new
-  end
+Game = case Config::Engine
+       when :gosu
+         GosuGame.new
+       when :rubygame
+         RubygameGame.new
+       end
   
-  def run
-    loop do
-      Queue &lt;&lt; TickEvent.new(@world)
-      Queue.resolve_all
-    end
-  end
-end</diff>
      <filename>game.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,15 +13,14 @@ class EventQueue
   alias :add :&lt;&lt;
   
   def connect(hash={})
-    # FUCK YEAH
-    hash.each(&amp;@dispatcher.method(:add))
+    hash.each {|k, v| @dispatcher.add(k, v) }
   end
     
   def resolve_all
     # Not sure about adding to an array while looping through it.
-    @dispatcher.dispatch(@queue.shift) while not @queue.empty?
+    @dispatcher.dispatch(@queue.shift) until @queue.empty?
   end
 end
 
-Object.send(:remove_const, :Queue) # Whatever.
+Object.send(:remove_const, :Queue) if Object.const_defined? :Queue # Whatever.
 Queue = EventQueue.new</diff>
      <filename>queue.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,11 @@
+$: &lt;&lt; File.expand_path(File.dirname(__FILE__)) + &quot;/../jiggle/lib&quot;
+
 require 'game'
 require 'time_manager'
+require 'objects/box'
 
 Queue.connect SecondPassedEvent =&gt; lambda { puts &quot;TICK!&quot; }
 
-Game.new.run 
+Queue.connect GameStartEvent =&gt; lambda { World.add Box.new }
+
+Game.run </diff>
      <filename>test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
 require 'queue'
-require 'second_passed_event'
+require 'events/second_passed_event'
 
 class TimeManager
   def initialize</diff>
      <filename>time_manager.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,18 @@
 require 'time_manager'
+require 'physics_manager'
 
-class World
+class WorldClass
   def initialize
     @time_manager = TimeManager.new
+    @physics_manager = PhysicsManager.new
+
+    @objects = []
+  end
+
+  def add(object)
+    @objects &lt;&lt; object
+    Queue &lt;&lt; ObjectAddedEvent.new(object)
   end
 end
+
+World = WorldClass.new</diff>
      <filename>world.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>second_passed_event.rb</filename>
    </removed>
    <removed>
      <filename>tick_event.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>5d39251cdbde92b1679c8ddbf818e2695b0e0c38</id>
    </parent>
  </parents>
  <author>
    <name>Mitchell Riley</name>
    <email>mitchell.v.riley@gmail.com</email>
  </author>
  <url>http://github.com/mvr/upsurge/commit/1dcd9982b27039736eee14f13862e63ca3159b6d</url>
  <id>1dcd9982b27039736eee14f13862e63ca3159b6d</id>
  <committed-date>2009-10-26T23:27:08-07:00</committed-date>
  <authored-date>2009-10-26T23:27:08-07:00</authored-date>
  <message>A number of changes, too lazy to split them out:

Add &quot;behaviours&quot;, which game objects can use.
Add conditional events
Move events, objects and behaviours into their own directory
Use gosu instead of rubygame, but make it so you can switch
Give a more sensible Event#match</message>
  <tree>404f159e905a25b77fd48c39e4b71898503d7f8d</tree>
  <committer>
    <name>Mitchell Riley</name>
    <email>mitchell.v.riley@gmail.com</email>
  </committer>
</commit>
