Documentation > Game engine

Version: v3.4.0
Dina:draw(WithState)

This function starts the "draw" function of the current state or of each of the loaded components.

WithState

Indicates whether to take into account the current state (true by default) or not.

Dina:update(dt, WithState)

This function starts the update function of the current state (if it has been defined). Otherwise, this function calls the update function of all loaded components.

For the translation:

If a language has been defined, the content of the Text components are translated using the datas in the language file if found; otherwise, the content remains the same.

dt

Delta time.

WithState

Indicates if the framework uses states or not. If true, launch the update function of the given state; otherwise, launch the update of the components.

Dina:removeComponent(Component)

This function deletes the given component.

Component

Component to remove

Dina:removeComponents()

This function removes all components tag for removed.

Dina:setGlobalValue(Name, Data)

This function allows to create a global data which can be used everywhere in the code. If the data already exists, it will be overwritten.

Name

Name of the data

Data

Value of the data

Dina:getGlobalValue(Name)

This function allows to retrieve the value of a global data.

Name

Name of the data

Return

Returns the value of the data if it exists; otherwise returns nil.

Dina:addState(State, File, Load)

This function adds a new report with the supplied file. If the report already exists, no changes are made.

State

Name of the state.

File

Path and file name without extension.

Load

Name of the function to run when the state is loaded (by default, "load").

Dina:removeState(State)

This function allows to remove a given state.

State

State to remove.

Dina:setState(State)

This function sets the current state and starts the stored Load function.

State

New state to define

Dina:isValidState(State)

This function checks if the given state has already been defined (true) or not (false).

State

State to be checked.

Return

Returns true if the state already exists; false otherwise.

Dina:loadTranslator()

This function allows you to initialize the management of the translation.

Dina:addLanguage(Language, File)

This function allows you to add a given language. The translation is in the given file.

Language

Language for the translation.

File

File containing the translations.

Dina:setLanguage(Language)

This function sets the given language as the current language.

Language

Language to use for the translation.

Dina:getCurrentLanguage()

This function returns the current language or nil if no language has been added.

Return

Returns the current language (could be nil).

Dina:getNextLanguage()

This function returns the next language or nil if no language has been added.

Return

Returns the next language (could be nil).

Dina:translate(KeyText)

This function returns translation of the given key in the current language.

Return

Returns the translation of the given key in the current language.

Dina:loadController()

This function allows you to initialize the management of the controllers.

Dina:setActionKeys(Object, FctName, State, ...)

This function allows you to associate one or more keys with the given function.

Object

Object that must contain the function to be executed.

FctName

Name of the function to be executed.

Mode

Mode: 'pressed', 'released' or 'continuous'.

...

List of keys that should trigger the execution of the function (see tutorials or examples for more details).

Dina:resetActionKeys()

This function removes all action keys previously defined by setActionKeys.