class Eagle::Config

Overview

Settings for the window and the engine loop. Every field has a sensible default.

You rarely build a Config yourself. Pass the fields as named arguments to Eagle.run, or override App#configure to compute them:

class Game < App
  def configure(config : Config) : Nil
    config.msaa = 4
    config.fixed_fps = 120 # finer physics steps
  end
end

Eagle.run(Game, title: "Space Rocks", width: 1280, height: 720, vsync: true)

A few environment variables override the config, which is handy for CI and screenshots:

Defined in:

eagle/core/engine.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(**opts) #

Builds a config from named arguments that match the property names.


Instance Method Detail

def assets_dir : String | Nil #

Folder that res:// paths resolve against. nil auto-detects it; see Assets.


def assets_dir=(assets_dir : String | Nil) #

Folder that res:// paths resolve against. nil auto-detects it; see Assets.


def audio : Bool #

Set to false to skip opening an audio device, for tools and servers.


def audio=(audio : Bool) #

Set to false to skip opening an audio device, for tools and servers.


def clear_color : Color #

Background color the screen is cleared to at the start of every frame.


def clear_color=(clear_color : Color) #

Background color the screen is cleared to at the start of every frame.


def fixed_fps : Int32 #

How many times per second physics_process and App#fixed_update run, independent of the frame rate.


def fixed_fps=(fixed_fps : Int32) #

How many times per second physics_process and App#fixed_update run, independent of the frame rate.


def fullscreen : Bool #

Start fullscreen. Toggle later with Window.fullscreen=.


def fullscreen=(fullscreen : Bool) #

Start fullscreen. Toggle later with Window.fullscreen=.


def height : Int32 #

Initial window height in logical pixels.


def height=(height : Int32) #

Initial window height in logical pixels.


def hidden : Bool #

Open the window hidden, for tests and offscreen rendering.


def hidden=(hidden : Bool) #

Open the window hidden, for tests and offscreen rendering.


def highdpi : Bool #

Render at full resolution on Retina and other high-DPI screens.


def highdpi=(highdpi : Bool) #

Render at full resolution on Retina and other high-DPI screens.


def max_fps : Int32 #

Frame-rate cap used when vsync is off. 0 means uncapped.


def max_fps=(max_fps : Int32) #

Frame-rate cap used when vsync is off. 0 means uncapped.


def msaa : Int32 #

Multisample anti-aliasing samples (0, 2, 4 or 8). Smooths 3D edges and shape outlines.


def msaa=(msaa : Int32) #

Multisample anti-aliasing samples (0, 2, 4 or 8). Smooths 3D edges and shape outlines.


def resizable : Bool #

Whether the player can resize the window. App#resize and Node#resized fire when they do.


def resizable=(resizable : Bool) #

Whether the player can resize the window. App#resize and Node#resized fire when they do.


def title : String #

Window title.


def title=(title : String) #

Window title.


def vsync : Bool #

Sync presentation to the display's refresh rate. Leave it on unless you are measuring performance.


def vsync=(vsync : Bool) #

Sync presentation to the display's refresh rate. Leave it on unless you are measuring performance.


def width : Int32 #

Initial window width in logical pixels.


def width=(width : Int32) #

Initial window width in logical pixels.