Class: EduDraw::Sheet

Inherits:
Gosu::Window
  • Object
show all
Defined in:
lib/edu_draw/sheet.rb

Overview

A Sheet is a 2D-Canvas that can be drawn on using Pen

Instance Method Summary collapse

Constructor Details

#initialize(x: 100, y: 100, title: "A blank sheet") ⇒ Sheet

Creates a new Sheet



15
16
17
18
19
# File 'lib/edu_draw/sheet.rb', line 15

def initialize(x: 100, y: 100, title: "A blank sheet")
	super x, y, false
	self.caption = title
	@pens = []
end

Instance Method Details

#new_animation_pen(x: 0, y: 0, angle: 0, color: Gosu::Color::GREEN) ⇒ Object

Create a new AnimationPen that draws something different each frame

See Also:



41
42
43
44
45
# File 'lib/edu_draw/sheet.rb', line 41

def new_animation_pen(x: 0, y: 0, angle: 0, color: Gosu::Color::GREEN)
	pen = AnimationPen.new(x: x, y: y, angle: angle, color: color)
	pens << pen
	pen
end

#new_pen(x: 0, y: 0, angle: 0, color: Gosu::Color::GREEN) ⇒ Object

Creates a new Pen that draws on self

See Also:



30
31
32
33
34
# File 'lib/edu_draw/sheet.rb', line 30

def new_pen(x: 0, y: 0, angle: 0, color: Gosu::Color::GREEN)
	pen = Pen.new(x: x, y: y, angle: angle, color: color)
	pens << pen
	pen
end