class Crame::Game

Overview

Game is the class used to represent the main entry point of your game. This is what your game code will inherit from.

In the class inheriting Game, there are some useful methods and callbacks that you can (and should) define to make your game run:

WARNING Mixing methods to the callbacks they shouldn't belong to (for example, putting in Game.draw what should be in Game.update(dt : Time::Span)) may result in unexpected behaviours.

Defined in:

crame/game.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(title : String, size : Vector2) #

Creates a new instance of the game.

This constructor is used to create the main window, where everything related to the game will be handled and rendered.

NOTE When redefined by the class inheriting this one in the form of Game.initialize, this constructor must be called as a super method.


Instance Method Detail

def run #

Makes the game run its main loop.


def window : Window #

Returns the main window of the game.