Skip to content
Browse files

got rid of unneeded rubygame references

  • Loading branch information...
1 parent 5b9e3b0 commit a4cc1ad21b07e3e37229e0e865836062fadd4bcd @bgoodspeed committed Nov 7, 2010
View
2 lib/battle/battle_hud.rb
@@ -1,6 +1,4 @@
class BattleHud
- include Rubygame
-
def initialize(screen, text_rendering_helper, layer, surface_factory=SurfaceFactory.new)
@screen = screen
@text_rendering_helper = text_rendering_helper
View
13 lib/game_requirements.rb
@@ -1,6 +1,14 @@
# To change this template, choose Tools | Templates
# and open the template in the editor.
+
+
+require 'lib/facades/surface_facade'
+require 'lib/facades/music_facade'
+require 'lib/facades/sound_facade'
+require 'lib/facades/font_facade'
+
+
require 'lib/event_system/event_system'
require 'lib/tile_system/sdl_coordinate'
require 'lib/tile_system/positioned_tile_coordinate'
@@ -45,11 +53,6 @@
require 'lib/items/equipment/equipment_holder'
-require 'lib/facades/surface_facade'
-require 'lib/facades/music_facade'
-require 'lib/facades/sound_facade'
-require 'lib/facades/font_facade'
-
require 'lib/factories/music_factory'
require 'lib/factories/surface_factory'
require 'lib/factories/monster_factory'
View
10 lib/helpers/animated_sprite_helper.rb
@@ -1,12 +1,10 @@
class AnimatedSpriteHelper
- include Rubygame
attr_reader :image, :rect, :px, :py
include ColorKeyHelper
- include ResourceLoader
-
+
def initialize(filename, position, surface_factory=SurfaceFactory.new)
- @all_char_postures = load_surface(filename)
+ @all_char_postures = surface_factory.load_surface(filename)
set_colorkey_from_corner(@all_char_postures)
@all_char_postures.alpha = 255
@@ -21,12 +19,12 @@ def initialize(filename, position, surface_factory=SurfaceFactory.new)
@image.fill(@all_char_postures.colorkey)
@image.colorkey = @all_char_postures.colorkey
@image.alpha = 255
- @all_char_postures.blit(@image, [0,0], Rect.new(0,0,@avatar_x_dim,@avatar_y_dim))
@rect = @image.make_rect
@rect.center = [px, py]
set_frame(0)
+ replace_avatar(0)
end
@@ -49,7 +47,7 @@ def set_frame(last_dir=0)
def replace_avatar(animation_frame)
@image.fill(@all_char_postures.colorkey)
- @all_char_postures.blit(@image, [0,0], Rect.new(animation_frame * @avatar_x_dim, @last_direction_offset,@avatar_x_dim, @avatar_y_dim))
+ @all_char_postures.blit(@image, [0,0], [animation_frame * @avatar_x_dim, @last_direction_offset,@avatar_x_dim, @avatar_y_dim])
end
View
5 lib/helpers/resource_loader.rb
@@ -2,8 +2,7 @@ class MissingResourceError < RuntimeError
end
module ResourceLoader
- @@DEPTH = 24
- include Rubygame
+ @@FONT_DEPTH = 24
def font_path
File.join(Dir.pwd, 'resources', 'fonts')
@@ -12,7 +11,7 @@ def load_font(name)
filename = File.join(font_path, name)
raise MissingResourceError.new unless File.exists?(filename)
- FontFacade.new(filename, @@DEPTH)
+ FontFacade.new(filename, @@FONT_DEPTH)
end
def surface_path
View
4 lib/layers/hud.rb
@@ -1,8 +1,6 @@
class Hud
-include Rubygame
-include Rubygame::Events
-include ResourceLoader
+ include ResourceLoader
# construct the HUD
def initialize options
View
20 lib/menu/cursor_helper.rb
@@ -2,8 +2,6 @@
# and open the template in the editor.
class CursorHelper
- include Rubygame
-
attr_reader :position, :depth, :path, :currently_selected
def initialize(dims, surface_factory=SurfaceFactory.new)
@cursor = surface_factory.make_surface(dims)
@@ -60,18 +58,6 @@ def activate(menu)
@currently_selected.drop_last
drop_last_path_element
end
-# if path.size > 1 && !menu.element_at(path.first, @currently_selected).ready_with?(path.size - 1)
-# rv = menu.navigate_path(path, @position, @currently_selected)
-# add_currently_selected rv
-# end
-#
-# if menu.ready_for_activation_with?(path, @position, @currently_selected)
-#
-# action = menu.element_at(path.first, @currently_selected).action
-# action.invoke(@currently_selected)
-# reset_indices
-# end
-
end
def current_selected_menu_entry_name(menu)
@@ -82,9 +68,6 @@ def current_menu_entries(menu)
menu.navigate_path(path).element_names(@currently_selected)
end
-
-
-
def reduce_only_to_zero(v)
rv = v - 1
rv < 0 ? 0 : rv
@@ -115,13 +98,11 @@ def add_currently_selected(s)
@currently_selected << s
end
-
def path_element_at_index(idx)
#([@position] + @path)[idx]
([@position] + @path)[idx]
end
-
def should_display_submenu_for?(index, depth)
(depth < @path.size) && @path.first == index
end
@@ -133,6 +114,7 @@ def selections_made
def selector_menus_to_draw_at_depth(depth, needed)
needed - selections_made
end
+
def color_for_current_section_cursor
@current_color
end
View
2 lib/palettes/surface_backed_pallette.rb
@@ -1,8 +1,6 @@
class SurfaceBackedPallette < Pallette
- include Rubygame
- include ResourceLoader
attr_reader :tile_x, :tile_y
def initialize(filename, x, y, pal=nil, surface_factory=SurfaceFactory.new)
super(nil,pal)
View
3 lib/sound/sound_effect_set.rb
@@ -1,7 +1,4 @@
class SoundEffectSet
- include Rubygame
- include ResourceLoader
-
def initialize(filenames, music_factory=MusicFactory.new)
@effects = {}
filenames.each do |filename|
View
6 lib/tile_system/json_loadable_surface.rb
@@ -1,14 +1,12 @@
class JsonLoadableSurface
- include Rubygame
- include ResourceLoader
extend Forwardable
def_delegators :@surface, :blit
- def initialize(filename, blocking)
+ def initialize(filename, blocking, surface_factory=SurfaceFactory.new)
@filename = filename
@blocking = blocking
- @surface = load_surface(filename)
+ @surface = surface_factory.load_surface(filename)
end
def is_blocking?
View
2 lib/tile_system/json_surface.rb
@@ -1,5 +1,5 @@
-class JsonSurface < Rubygame::Surface
+class JsonSurface < SurfaceFacade
def initialize(size)

0 comments on commit a4cc1ad

Please sign in to comment.
Something went wrong with that request. Please try again.