Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
extracted more rubygame/sdl facades
  • Loading branch information
bgoodspeed committed Nov 7, 2010
1 parent ff42d2d commit 9584e23
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
5 changes: 5 additions & 0 deletions lib/facades/clock_facade.rb
@@ -0,0 +1,5 @@
# To change this template, choose Tools | Templates
# and open the template in the editor.

class ClockFacade < Rubygame::Clock
end
9 changes: 9 additions & 0 deletions lib/facades/event_queue_facade.rb
@@ -0,0 +1,9 @@
# To change this template, choose Tools | Templates
# and open the template in the editor.

class EventQueueFacade < Rubygame::EventQueue

def ignore_mouse_movement
self.ignore = [Rubygame::Events::MouseMoved]
end
end
6 changes: 6 additions & 0 deletions lib/facades/screen_facade.rb
@@ -0,0 +1,6 @@
# To change this template, choose Tools | Templates
# and open the template in the editor.

class ScreenFacade < Rubygame::Screen

end
13 changes: 4 additions & 9 deletions lib/factories/game_internals_factory.rb
@@ -1,34 +1,29 @@

class GameInternalsFactory
include Rubygame
include Rubygame::Events
include Rubygame::EventActions
include Rubygame::EventTriggers

def make_event_system(game, always_on_hooks, menu_killed_hooks, menu_active_hooks, battle_hooks, battle_layer_hooks, player_hooks, npc_hooks)
EventSystem.new(make_clock, make_queue, make_event_hooks(game, always_on_hooks, menu_killed_hooks, menu_active_hooks, battle_hooks, battle_layer_hooks, player_hooks, npc_hooks))
end


def make_screen
#@screen = Screen.open( [640, 480] )
screen = Screen.new([@@SCREEN_X, @@SCREEN_Y])
screen = ScreenFacade.new([@@SCREEN_X, @@SCREEN_Y])
screen.title = @@GAME_TITLE
screen
end
def make_clock
clock = Clock.new()
clock = ClockFacade.new()
clock.target_framerate = 50
clock.calibrate
clock.enable_tick_events
clock
end

def make_queue
queue = EventQueue.new()
queue = EventQueueFacade.new()
queue.enable_new_style_events
queue.ignore_mouse_movement

queue.ignore = [MouseMoved]
queue
end

Expand Down
3 changes: 3 additions & 0 deletions lib/game_requirements.rb
Expand Up @@ -3,6 +3,9 @@



require 'lib/facades/screen_facade'
require 'lib/facades/clock_facade'
require 'lib/facades/event_queue_facade'
require 'lib/facades/surface_facade'
require 'lib/facades/music_facade'
require 'lib/facades/sound_facade'
Expand Down

0 comments on commit 9584e23

Please sign in to comment.