Skip to main content
Arctic Dev

Espresso

Espresso is a light-weight wrapper around GLFW for Crystal. It provides an object-oriented and “crystalized” interface for using GLFW.

Here’s a preview of the minimal code required to setup and display a window:

require "espresso"

Espresso.run do
  Espresso::Window.open(800, 600, "Espresso") do |window|
    until window.closing?
      window.swap_buffers
      Espresso::Window.poll_events
    end
  end
end

A fundamental understanding of GLFW is recommended before using Espresso. However, most functionality can be grasped by going through the documentation.

Espresso does not provide OpenGL functionality. Another shard, such as Gloop, is needed to draw to the screen. The C bindings Espresso uses are defined in a separate shard - glfw.cr.