Class: Engine::Cursor
- Inherits:
-
Object
- Object
- Engine::Cursor
- Defined in:
- lib/engine/cursor.rb
Class Method Summary collapse
- .disable ⇒ Object
- .enable ⇒ Object
-
.get_input_mode ⇒ Object
Returns a symbol from the supported_modes, e.g.
- .hide ⇒ Object
-
.restore_input_mode(original_mode) ⇒ Object
Expects a symbol present in supported_modes, e.g.
-
.set_input_mode(mode) ⇒ Object
Expects a symbol present in supported_modes, e.g.
- .supported_modes ⇒ Object
Class Method Details
.disable ⇒ Object
19 20 21 |
# File 'lib/engine/cursor.rb', line 19 def disable set_input_mode(:disable) end |
.enable ⇒ Object
15 16 17 |
# File 'lib/engine/cursor.rb', line 15 def enable set_input_mode(:enable) end |
.get_input_mode ⇒ Object
Returns a symbol from the supported_modes, e.g. ‘:hide’
33 34 35 |
# File 'lib/engine/cursor.rb', line 33 def get_input_mode supported_modes.key(GLFW.GetInputMode(Window.window, GLFW::CURSOR)) end |
.hide ⇒ Object
23 24 25 |
# File 'lib/engine/cursor.rb', line 23 def hide set_input_mode(:hide) end |
.restore_input_mode(original_mode) ⇒ Object
Expects a symbol present in supported_modes, e.g. ‘:hide’
38 39 40 |
# File 'lib/engine/cursor.rb', line 38 def restore_input_mode(original_mode) set_input_mode(original_mode) end |
.set_input_mode(mode) ⇒ Object
Expects a symbol present in supported_modes, e.g. ‘:hide’
28 29 30 |
# File 'lib/engine/cursor.rb', line 28 def set_input_mode(mode) GLFW.SetInputMode(Window.window, GLFW::CURSOR, supported_modes[mode]) end |
.supported_modes ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/engine/cursor.rb', line 7 def supported_modes { :enable => GLFW::CURSOR_NORMAL, :disable => GLFW::CURSOR_DISABLED, :hide => GLFW::CURSOR_HIDDEN } end |