Skip to content
This repository has been archived by the owner on Oct 9, 2018. It is now read-only.

Commit

Permalink
Renamed variables
Browse files Browse the repository at this point in the history
  • Loading branch information
disolovyov committed Oct 18, 2010
1 parent 3cb1fed commit e8219e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions lib/panda_canvas/canvas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ def initialize(width, height, calls)
self.caption = 'Panda Canvas'
@image = TexPlay.create_image(self, width, height)
@calls = calls
@canvas_update_calls = CleanRoom::CANVAS_UPDATE
@canvas_draw_calls = []
@update_calls = CleanRoom::CANVAS_UPDATE
@draw_calls = []
@used_fonts = {}
end

# Draws the image in memory.
def draw
@image.draw(0, 0, 0)
@canvas_draw_calls.each {|call| send call[0], *call[1..-1] }
@draw_calls.each {|call| send call[0], *call[1..-1] }
end

# Sets the font with name +font_name+ and +height+ in pixels to be used when drawing text.
Expand All @@ -40,17 +40,17 @@ def text(s, x, y, color)
def update
unless @calls.empty?
@calls.slice!(0...@calls.index(CleanRoom::FLUSH)).each do |call|
if CleanRoom::CANVAS_UPDATE_CALLS.include? call[0]
@canvas_update_calls << call
elsif CleanRoom::CANVAS_DRAW_CALLS.include? call[0]
@canvas_draw_calls << call
if CleanRoom::UPDATE_CALLS.include? call[0]
@update_calls << call
elsif CleanRoom::DRAW_CALLS.include? call[0]
@draw_calls << call
else
@image.send call[0], *call[1..-1]
end
end
@calls.shift
end
@canvas_update_calls.each {|call| send call[0], *call[1..-1] }
@update_calls.each {|call| send call[0], *call[1..-1] }
end

end # Canvas
Expand Down
4 changes: 2 additions & 2 deletions lib/panda_canvas/clean_room.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ class CleanRoom
CANVAS_UPDATE = [[:font, Gosu::default_font_name, 12]]

# Names of calls that need to be sent directly to Canvas instead of the TexPlay image on update.
CANVAS_UPDATE_CALLS = [:font].freeze
UPDATE_CALLS = [:font].freeze

# Names of calls that need to be sent directly to Canvas instead of the TexPlay image on draw.
CANVAS_DRAW_CALLS = [:text].freeze
DRAW_CALLS = [:text].freeze

# Returns an array of captured method calls.
# A +flush+ is appended at the end.
Expand Down

0 comments on commit e8219e4

Please sign in to comment.