module Basher::UI
Public Instance Methods
current_views()
click to toggle source
# File lib/basher/ui.rb, line 18 def current_views views = case state.current when :loading [loading_view] when :menu [title_view, menu_view] when :in_game [info_view, current_word_view, remaining_words_view, progress_view] when :score [score_view] when :paused [title_view, menu_view] else [] end views << debug_view if debugging? views end
current_word_view()
click to toggle source
# File lib/basher/ui.rb, line 73 def current_word_view @current_word_view ||= CurrentWordView.new do |v| v.game = self v.lines = CurrentWordView.lines v.line = -> { other = CurrentWordView.lines + InfoView.lines + RemainingWordsView.lines + ProgressView.lines (v.parent.lines - other) / 2 } end end
debug_view()
click to toggle source
# File lib/basher/ui.rb, line 39 def debug_view @debug_view ||= DebugView.new do |v| v.game = self v.lines = DebugView.lines end end
info_view()
click to toggle source
# File lib/basher/ui.rb, line 87 def info_view @info_view ||= InfoView.new do |v| v.game = self v.line = 0 v.lines = InfoView.lines end end
loading_view()
click to toggle source
# File lib/basher/ui.rb, line 47 def loading_view @loading_view ||= LoadingView.new do |v| v.text = 'Loading...' end end
progress_view()
click to toggle source
# File lib/basher/ui.rb, line 105 def progress_view @progress_view ||= ProgressView.new do |v| v.game = self v.lines = ProgressView.lines v.line = -> { v.parent.lines - 1 } end end
remaining_words_view()
click to toggle source
# File lib/basher/ui.rb, line 96 def remaining_words_view @remaining_words_view ||= RemainingWordsView.new do |v| v.game = self v.lines = RemainingWordsView.lines v.line = -> { v.parent.lines - 2 } end end
score_view()
click to toggle source
# File lib/basher/ui.rb, line 114 def score_view @score_view ||= ScoreView.new do |v| v.game = self v.lines = ScoreView.lines v.line = -> { (v.parent.lines - ScoreView.lines) / 2 } end end
title_view()
click to toggle source
# File lib/basher/ui.rb, line 53 def title_view @title_view ||= TitleView.new do |v| v.state = state v.lines = TitleView.lines v.line = -> { (v.parent.lines - TitleView.lines - MenuView.lines) / 2 } end end
views()
click to toggle source
# File lib/basher/ui.rb, line 14 def views @views ||= methods.grep(/(?<!base)_view/).map { |v| self.public_send(v) }.flatten end