Sha256: 0a5edc7be92d86c213b5d247083cd35e6cc21b19245d6d536e4bccaff8343230
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
require 'curses' require 'singleton' require 'forwardable' require 'amun/windows/frame' require 'amun/event_manager' require 'amun/features_loader' require 'amun/helpers/keyboard' module Amun # singleton Amun application, it initialize curses, # have the frame and handles keyboard class Application include Singleton attr_writer :frame def frame @frame ||= Windows::Frame.new end def run init_curses frame.render FeaturesLoader.load keyboard_thread.join end class << self extend Forwardable def_delegators :instance, :run, :frame, :frame= end private def init_curses Curses.init_screen Curses.curs_set 0 Curses.raw Curses.noecho Curses.start_color Curses.stdscr.keypad = true Curses.ESCDELAY = 0 end def keyboard_thread Thread.new do chain = [] while (ch = Helpers::Keyboard.char) chain << ch chain.clear if frame.trigger(chain.join(' ')) != EventManager::CHAINED frame.render end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
amun-0.2.0 | lib/amun/application.rb |