Class: PandaCanvas::DrawingCanvas
- Inherits:
-
Gosu::Window
- Object
- Gosu::Window
- PandaCanvas::DrawingCanvas
- Includes:
- DrawingMethods, DrawingWithCleanRoom, DrawingWithFibers
- Defined in:
- lib/panda_canvas/drawing_canvas.rb
Overview
DrawingCanvas is a subclassed Gosu::Window that is used for drawing.
Constant Summary
Constants included from DrawingMethods
PandaCanvas::DrawingMethods::CANVAS_CALLS, PandaCanvas::DrawingMethods::CANVAS_UPDATE
Instance Attribute Summary collapse
-
#image ⇒ Object
readonly
TexPlay image, which is drawn in the window.
Instance Method Summary collapse
-
#draw ⇒ Object
Draws the image in memory.
-
#initialize(width, height, &block) ⇒ DrawingCanvas
constructor
Creates a new canvas window with dimensions
widthandheight.
Methods included from DrawingWithFibers
Methods included from DrawingWithCleanRoom
Methods included from DrawingMethods
#font, #sym_color, #text, #text_rel
Constructor Details
#initialize(width, height, &block) ⇒ DrawingCanvas
Creates a new canvas window with dimensions width and height. A block is passed to be executed.
23 24 25 26 27 28 29 |
# File 'lib/panda_canvas/drawing_canvas.rb', line 23 def initialize(width, height, &block) super(width, height, false) self.caption = 'Panda Canvas' @image = TexPlay.create_image(self, width, height) @canvas_calls = [] prepare &block end |
Instance Attribute Details
#image ⇒ Object (readonly)
TexPlay image, which is drawn in the window.
19 20 21 |
# File 'lib/panda_canvas/drawing_canvas.rb', line 19 def image @image end |
Instance Method Details
#draw ⇒ Object
Draws the image in memory.
32 33 34 35 |
# File 'lib/panda_canvas/drawing_canvas.rb', line 32 def draw @image.draw(0, 0, 0) @canvas_calls.each {|call| send call[0], *call[1..-1] } end |