Class: WinClass

Inherits:
Gosu::Window show all
Defined in:
lib/texplay/live.rb

Defined Under Namespace

Classes: View

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Gosu::Window

#render_to_image

Constructor Details

#initializeWinClass

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

#imagesObject (readonly)

Returns the value of attribute images.



36
37
38
# File 'lib/texplay/live.rb', line 36

def images
  @images
end

#viewObject (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, options={})
  TexPlay.create_image(self, width, height, options)
end

#drawObject



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

#updateObject



76
77
78
# File 'lib/texplay/live.rb', line 76

def update
  @pry_instance.rep(@binding)
end