class AuthorEngine::Editor
Attributes
header_height[R]
savefile[R]
Public Class Methods
new(savefile)
click to toggle source
# File lib/author_engine/containers/editor.rb, line 5 def initialize(savefile) @savefile = savefile @scale_x = window.scale_x @scale_y = window.scale_y @active_view = nil @header_height= (16 * @scale_y)+(@scale_y*2) @header_color = Gosu::Color.rgba(dark_green.red, dark_green.green, dark_green.blue, 100)#Gosu::Color.rgba(25, 255, 25, 100) @title = Text.new(message: "AuthorEngine", x: (1.0*@scale_x)) @title.y = @header_height/2 - @title.height/2 @views = [] @buttons = [] @locked = false end
Public Instance Methods
close()
click to toggle source
# File lib/author_engine/containers/editor.rb, line 75 def close @savefile.save window.close! end
draw()
click to toggle source
# File lib/author_engine/containers/editor.rb, line 61 def draw unless @locked Gosu.draw_rect(0, 0, window.width, @header_height, @header_color) @title.draw @buttons.each(&:draw) end @active_view.draw if @active_view end
lock()
click to toggle source
# File lib/author_engine/containers/editor.rb, line 58 def lock; @locked = true; end
setup()
click to toggle source
# File lib/author_engine/containers/editor.rb, line 22 def setup add_buttons end
unlock()
click to toggle source
# File lib/author_engine/containers/editor.rb, line 59 def unlock; @locked = false; end
update()
click to toggle source
# File lib/author_engine/containers/editor.rb, line 71 def update @active_view.update if @active_view end