module Espresso

Overview

Lightweight wrapper around GLFW for Crystal.

Included Modules

Extended Modules

Defined in:

espresso.cr
espresso/bounds.cr
espresso/class_topic.cr
espresso/client_api.cr
espresso/context_creation_api.cr
espresso/context_robustness.cr
espresso/coordinates.cr
espresso/enum_copy.cr
espresso/error_handling.cr
espresso/errors/api_unavailable_error.cr
espresso/errors/format_unavailable_error.cr
espresso/errors/glfw_error.cr
espresso/errors/invalid_enum_error.cr
espresso/errors/invalid_value_error.cr
espresso/errors/no_current_context_error.cr
espresso/errors/no_window_context_error.cr
espresso/errors/not_initialized_error.cr
espresso/errors/out_of_memory_error.cr
espresso/errors/platform_error.cr
espresso/errors/version_unavailable_error.cr
espresso/events/joystick_connect_event.cr
espresso/events/keyboard_char_event.cr
espresso/events/keyboard_char_mods_event.cr
espresso/events/keyboard_event.cr
espresso/events/keyboard_key_event.cr
espresso/events/monitor_connect_event.cr
espresso/events/mouse_button_event.cr
espresso/events/mouse_enter_event.cr
espresso/events/mouse_event.cr
espresso/events/mouse_move_event.cr
espresso/events/mouse_scroll_event.cr
espresso/events/window_closing_event.cr
espresso/events/window_drop_event.cr
espresso/events/window_event.cr
espresso/events/window_focus_event.cr
espresso/events/window_iconify_event.cr
espresso/events/window_maximize_event.cr
espresso/events/window_move_event.cr
espresso/events/window_refresh_event.cr
espresso/events/window_resize_event.cr
espresso/events/window_scale_event.cr
espresso/frame_size.cr
espresso/image.cr
espresso/input/button_state.cr
espresso/input/joystick.cr
espresso/input/joystick/events.cr
espresso/input/joystick/gamepad_axis.cr
espresso/input/joystick/gamepad_button.cr
espresso/input/joystick/gamepad_state.cr
espresso/input/joystick/joystick_connect_topic.cr
espresso/input/joystick/joystick_hat_state.cr
espresso/input/joystick/joystick_user_data.cr
espresso/input/keyboard.cr
espresso/input/keyboard/events.cr
espresso/input/keyboard/key.cr
espresso/input/keyboard/key_state.cr
espresso/input/keyboard/modifier_key.cr
espresso/input/keyboard/topics.cr
espresso/input/keyboard/window_user_data.cr
espresso/input/mouse.cr
espresso/input/mouse/cursor.cr
espresso/input/mouse/cursor_mode.cr
espresso/input/mouse/cursor_shape.cr
espresso/input/mouse/events.cr
espresso/input/mouse/mouse_button.cr
espresso/input/mouse/topics.cr
espresso/input/mouse/window_user_data.cr
espresso/instance_topic.cr
espresso/monitor.cr
espresso/monitor/events.cr
espresso/monitor/gamma_ramp.cr
espresso/monitor/monitor_connect_topic.cr
espresso/monitor/monitor_user_data.cr
espresso/monitor/video_mode.cr
espresso/opengl_profile.cr
espresso/position.cr
espresso/release_behavior.cr
espresso/scale.cr
espresso/size.cr
espresso/timer.cr
espresso/topic.cr
espresso/user_data.cr
espresso/window.cr
espresso/window/attributes.cr
espresso/window/events.cr
espresso/window/topics.cr
espresso/window/window_builder.cr
espresso/window/window_topic.cr
espresso/window/window_user_data.cr

Constant Summary

VERSION = {{ (`shards version \"/srv/crystaldoc.info/gitlab-arctic-fox-espresso-v0.2.1/src\"`).stringify.chomp }}

Current version of the shard.

Instance Method Summary

Instance Method Detail

def compiled_version : SemanticVersion #

Version of GLFW that Espresso was compiled against. This should match #runtime_version to have consistent/expected behavior.


[View source]
def init(joystick_hat_buttons : Bool | Nil = nil, cocoa_chdir_resources : Bool | Nil = nil, cocoa_menubar : Bool | Nil = nil) : Nil #

Prepares GLFW so that it can be used. This method must be called prior to any features that require initialization. If the initialization fails, a GLFWError will be raised.

Before exiting the program, and after GLFW is no longer needed, the #terminate method must be called. It is recommended to use #run instead of this method.

Arguments to this method are initialization hints. When unspecified (nil), the hints will use their default value. Specify true or false for the hints as needed.

joystick_hat_buttons specifies whether to also expose joystick hats as buttons, for compatibility with earlier versions of GLFW that did not have this feature.

macOS specific hints:

cocoa_chdir_resources specifies whether to set the current directory to the application to the Contents/Resources subdirectory of the application's bundle, if present.

cocoa_menubar specifies whether to create a basic menu bar, either from a nib or manually, when the first window is created, which is when AppKit is initialized.

Calling this method when GLFW is already initialized does nothing.

A PlatformError will be raised if GLFW couldn't be initialized.


[View source]
def run(joystick_hat_buttons : Bool | Nil = nil, cocoa_chdir_resources : Bool | Nil = nil, cocoa_menubar : Bool | Nil = nil, &) #

Initializes GLFW and yields for the duration it is usable. GLFW is automatically terminated after the block completes, even if an uncaught exception is raised.

Arguments to this method are initialization hints. When unspecified (nil), the hints will use their default value. Specify true or false for the hints as needed. See #init for details on what these hints do.

The value of the block is returned by this method.

Calling this method when GLFW is already initialized does nothing.

A PlatformError will be raised if GLFW couldn't be initialized.

Usage:

Espresso.run do
  # Use GLFW here.
end

[View source]
def runtime_version : SemanticVersion #

Version of GLFW that is loaded and in-use by Espresso. This should match #compiled_version to have consistent/expected behavior.


[View source]
def terminate : Nil #

Cleans up resources used by GLFW and and changes it made to the system. This method must be called after GLFW is no longer used and before the program exits. Once GLFW is terminated, it must be reinitialized before using it again.

Calling this method when GLFW is already terminated does nothing.

A PlatformError can be raised if GLFW couldn't be terminated.


[View source]
def version : SemanticVersion #

Version of GLFW that is loaded and in-use by Espresso.


[View source]
def version_string : String #

Compiled version string produced by GLFW. Includes the version string and additional compilation and environment information.


[View source]