Psych Engine Logo
T-Bar Engine - Documentation

List of State callbacks


Common callbacks

Callbacks that every state will have (Including ModScriptState & Global Scripts).

  • onCreate()

    - Called when the script is first created.

  • onCreatePost()

    - Called at the end of the create process.

  • onUpdate(elapsed:Float)

    - Called when the state updates (before everything is updated).

  • onUpdatePost(elapsed:Float)

    - Called at the end of update (after everything is updated).

  • onDestroy()

    - Called when the state is destroyed.


  • State callbacks

    Callbacks that only states & substates will have.

  • onStepHit()

    - Called every step in the music (Only called when the music.time is synced with Conductor).

  • onBeatHit()

    - Called every beat in the music (Only called when the music.time is synced with Conductor).

  • onSectionHit()

    - Called every section in the music (Only called when the music.time is synced with Conductor).

  • onOpenSubState()

    - Called when the state opens up a substate (use "return Function_Stop;" to prevent!).

  • onResize(w:Int, h:Int)

    - Called when the window is resized while in the state ("w" & "h" being the new width and height).

  • onFocus()

    - Called when the window is focused on while in the state.

  • onFocusLost()

    - Called when the window has lost focus while in the state.

  • onDraw()

    - Same as `onUpdate`, but when the state draws (use `return Function_Stop;` to prevent!).

  • onDrawPost()

    - Same as `onUpdatePost`, but when the state draws.


  • Substate callbacks

    Callbacks that only substates will have.

  • onClose()

    - Called when the substate is first closed (use `return Function_Stop;` to prevent!).

  • onClosePost()

    - Called at the end of the closing process.