class RenderLoop::Input(Key, MouseButton)

Overview

Provides a helpful wrapper over window input.

Defined in:

render_loop/input.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(window : RenderLoop::Window(Key, MouseButton)) #

[View source]

Instance Method Detail

def get_center : RenderLoop::Position #

Returns the center of the window


[View source]
def get_key(key_code : Key) : Bool #

Checks if the key is currently down


[View source]
def get_key_pressed(key_code : Key) : Bool #

Checks if the key was pressed in this frame


[View source]
def get_key_released(key_code : Key) : Bool #

Checks if the key was released in this frame


[View source]
def get_keys : Array(Key) #

Returns an array of keys that are currently pressed


[View source]
def get_mouse(mouse_button : MouseButton) : Bool #

Check if the mouse button is currently down


[View source]
def get_mouse_position : RenderLoop::Position #

Returns the position of the mouse


[View source]
def get_mouse_pressed(mouse_button : MouseButton) : Bool #

Checks if the mouse button was pressed in this frame


[View source]
def get_mouse_released(mouse_button : MouseButton) : Bool #

Checks if the mouse button was released in this frame


[View source]
def set_cursor(enabled : Bool) #

Controls the cursor visibility within the window


[View source]
def set_mouse_position(position : RenderLoop::Position) #

Sets the mouse position within the window


[View source]
def tick #

Processes the window input during each update tick


[View source]
def window_size : NamedTuple(height: Int32, width: Int32) #

Returns the size of the window


[View source]