API Reference
Arseniy Mesherakov edited this page 5 days ago

Right now API Reference is described as list of available functions and theirs signatures.

Signatures?

Ok, so for example lets take hello(world: string = "lua") -> nil

It's a definition of hello function which takes 1 arguments, argument is named world which has type string and has default value lua, and also returns nil

:warning: If something is not described here it's likely either internal thing or not yet added into this wiki as this wiki is written by human. ALL available API can be found on https://underlevel.ddns.net/git/quantumde1/Himmel_Engine/src/master/source/scripts/lua.d#L404

:warning: also i want to mention that all function which load something from files load files relative to engine binary, if not specified full path.

engine

  • EventLoop() -> nil

    This is function which is defined by YOU. It's called every update, i.e. every frame.

  • loadScript(script: string) -> nil

    Loads script provided in script argument and transfers execution flow to it. It's also unloads all previously loaded background and characters.

  • getTime() -> number

    Returns number which is an UNIX timestamp in seconds

  • getLanguage() -> string

    Returns language for example english or russian

  • getScreenHeight() -> integer

    Returns height of current screen.

  • getScreenWidth() -> integer

    Returns width of current screen.

  • isKeyPressed(key: integer) -> boolean

    Returns true if key is pressed, otherwise false. For key reference take look at https://github.com/raysan5/raylib/blob/714de02a884983adc801e734e044d72ad86af815/src/raylib.h#L577

UI

  • setFont(font: string) -> nil

    Loads and replaces current font with new one which loads from font argument.

  • dialogBox(pages: table, possibleReplies: table, askPageIndex: integer = -1, textSpeed: integer = 0.06) -> nil

    Creates dialog box with pages provided from pages argument, if page index is askPageIndex user will be asked to select one from possibleReplies, if askPageIndex = -1 user wont be asked and possibleReplies will be ignored though. Text speed is provided in textSpeed argument and can be between 0.10 and 1.00.

  • getAnswerValue() -> integer

    This returns index of reply of last dialog.

  • isDialogExecuted() -> boolean

    Returns true if dialog is still shown or false if not.

  • loadBackground(filename: string, index: integer) -> nil

    Configures background texture from filename, index needed when drawing.

  • drawBackground(x: integer, y: integer, scale: number, index: integer) -> nil

    Draws background with specified index.

  • stopDrawBackground(index: integer) -> nil

    Stops drawing of background with specified index.

  • unloadBackground(index: integer) -> nil

    Unloads background with specified index.

  • loadCharacter(filename: string, index: integer) -> nil

    Configures character texture from filename, index needed when drawing.

  • drawCharacter(x: integer, y: integer, scale: number, index: integer) -> nil

    Draws character with specified index, scale, Y and X coordinates.

  • stopDrawCharacter(index: integer) -> nil

    Stops drawing of character with specified index.

  • unloadCharacter(index: integer) -> nil

    Unloads character texture with specified index.

  • loadMusic(filename: string) -> nil

    Loads music from file.

  • playMusic() -> nil

    Plays previously loaded music.

  • stopMusic() -> nil

    Stop music which is currently loaded.

  • unloadMusic() -> nil

    Unloads currently loaded music.