class Presentation::Slide
Attributes
code[RW]
TODO: create different/customizable slide layouts
code_offset_top[RW]
TODO: create different/customizable slide layouts
list[RW]
TODO: create different/customizable slide layouts
subtitle[RW]
TODO: create different/customizable slide layouts
title[RW]
TODO: create different/customizable slide layouts
Public Instance Methods
code_text()
click to toggle source
# File lib/presentation/slide.rb, line 29 def code_text @code_text ||= create_text @code, font_family: 'Courier', font_size: 50, align: :left end
create_text(text, font_family: 'Arial', font_size: 80, line_spacing: 10, max_width: nil, align: :center)
click to toggle source
# File lib/presentation/slide.rb, line 16 def create_text(text, font_family: 'Arial', font_size: 80, line_spacing: 10, max_width: nil, align: :center) max_width ||= @window.width - slide_padding Gosu::Image.from_text(@window, text, font_family, font_size, line_spacing, max_width, align) end
draw(window)
click to toggle source
# File lib/presentation/slide.rb, line 54 def draw(window) @window = window if code or list draw_normal_screen else draw_title_screen end end
draw_normal_screen()
click to toggle source
# File lib/presentation/slide.rb, line 70 def draw_normal_screen left = slide_padding top = (@window.height / 100) * 5 title_text.draw(left, top, 0, 1, 1, 0xffffffff) code_text.draw(left, top + title_text.height + code_offset_top, 0, 1, 1, 0xffffffff) list_text.draw(left, top + title_text.height, 0, 1, 1, 0xffffffff) end
draw_title_screen()
click to toggle source
# File lib/presentation/slide.rb, line 63 def draw_title_screen left = slide_padding top = (@window.height / 100) * 30 title_text.draw(left, top, 0, 1, 1, 0xffffffff) subtitle_text.draw(left, top + title_text.height, 0, 1, 1, 0xffffffff) end
list_as_string()
click to toggle source
# File lib/presentation/slide.rb, line 33 def list_as_string return '' unless @list @list.map do |line| line = '• ' + line end.join("\n") end
list_text()
click to toggle source
# File lib/presentation/slide.rb, line 40 def list_text @list_text ||= create_text list_as_string, font_size: 50, align: :left end
scroll_down()
click to toggle source
# File lib/presentation/slide.rb, line 49 def scroll_down @code_offset_top ||= 0 @code_offset_top += 5 end
scroll_up()
click to toggle source
# File lib/presentation/slide.rb, line 44 def scroll_up @code_offset_top ||= 0 @code_offset_top -= 5 end
slide_padding()
click to toggle source
# File lib/presentation/slide.rb, line 12 def slide_padding (@window.width / 100) * 5 end
subtitle_text()
click to toggle source
# File lib/presentation/slide.rb, line 25 def subtitle_text @subtitle_text ||= create_text @subtitle, font_size: 50, align: :center end
title_text()
click to toggle source
# File lib/presentation/slide.rb, line 21 def title_text @title_text ||= create_text @title, font_size: 80, align: :center end