Class: RAGE::InputHandlers::TerminationInputHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/rage/input.rb

Overview

Input handler providing ability to Terminate game on quit related events, including

  • SDL quit event (window close, etc)

  • ‘Q’ or ‘ESC’ keys pressed

Class Method Summary collapse

Class Method Details

.handle(event) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/rage/input.rb', line 44

def self.handle(event)
   case event
   when SDL::Event2::Quit
      exit
   when SDL::Event2::KeyDown
      case event.sym
      when SDL::Key::Q, SDL::Key::ESCAPE
        exit
      end
   end
end