Class: WinClass
- Inherits:
-
Gosu::Window
- Object
- Gosu::Window
- WinClass
- Defined in:
- lib/texplay/live.rb
Defined Under Namespace
Classes: View
Instance Attribute Summary collapse
-
#images ⇒ Object
readonly
Returns the value of attribute images.
-
#view ⇒ Object
readonly
Returns the value of attribute view.
Instance Method Summary collapse
- #create_image(width, height, options = {}) ⇒ Object
- #draw ⇒ Object
- #hide_image(image) ⇒ Object
-
#initialize ⇒ WinClass
constructor
A new instance of WinClass.
- #load_image(file) ⇒ Object
- #show_image(image) ⇒ Object
- #update ⇒ Object
Methods inherited from Gosu::Window
Constructor Details
#initialize ⇒ WinClass
Returns a new instance of WinClass.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/texplay/live.rb', line 38 def initialize super(WIDTH, HEIGHT, false) Gosu.enable_undocumented_retrofication @images = [] @view = View.new @pry_instance = Pry.new :prompt => [Proc.new { "(live)> " }, Proc.new { "(live)* " }] @img = TexPlay.create_image(self, 200, 200) @img.rect 0, 0, @img.width - 1, @img.height - 1 images << @img @binding = binding end |
Instance Attribute Details
#images ⇒ Object (readonly)
Returns the value of attribute images.
36 37 38 |
# File 'lib/texplay/live.rb', line 36 def images @images end |
#view ⇒ Object (readonly)
Returns the value of attribute view.
36 37 38 |
# File 'lib/texplay/live.rb', line 36 def view @view end |
Instance Method Details
#create_image(width, height, options = {}) ⇒ Object
53 54 55 |
# File 'lib/texplay/live.rb', line 53 def create_image(width, height, ={}) TexPlay.create_image(self, width, height, ) end |
#draw ⇒ Object
69 70 71 72 73 74 |
# File 'lib/texplay/live.rb', line 69 def draw images.uniq! images.each do |v| v.draw_rot(v.x, v.y, 1, view.rotate, 0.5, 0.5, view.zoom, view.zoom) end end |
#hide_image(image) ⇒ Object
65 66 67 |
# File 'lib/texplay/live.rb', line 65 def hide_image(image) images.delete(image) end |
#load_image(file) ⇒ Object
57 58 59 |
# File 'lib/texplay/live.rb', line 57 def load_image(file) Gosu::Image.new(self, file) end |
#show_image(image) ⇒ Object
61 62 63 |
# File 'lib/texplay/live.rb', line 61 def show_image(image) images << image end |
#update ⇒ Object
76 77 78 |
# File 'lib/texplay/live.rb', line 76 def update @pry_instance.rep(@binding) end |