abstract struct Number

Overview

The top-level number type.

Included Modules

Defined in:

glint/number.cr

Instance Method Summary

Instance Method Detail

def degrees #

Returns a number as an angle, annotated as degrees.


[View source]
def fps #

Returns a number annotated as frames per second.

Negative values are not supported.

Example:
Game.target_framerate = 30.fps

[View source]
def pixels #

Returns a number annotated as pixels.

Example:
self.position.x += 24.pixels # Shift the x position of the game object by 24 pixels.

[View source]
def radians #

Returns a number as an angle, annotated as radians.


[View source]
def to_degrees #

Returns an angle (assumed in radians) converted to degrees.


[View source]
def to_radians #

Returns an angle (assumed in degrees) converted to radians.


[View source]