Latest version:
Tramway SDK 0.0.9
Github
Quick links
Home
Get Started

UI


The UI system deals with the creation of windows and taking in of the input.

Once initialized, the system will create an operating system window and will start gathering and emitting keyboard and mouse events. It also creates the rendering context.

Key concepts


Window

It's where the graphics are rendered to. Also can be clicked on.

Keyboard key

Represents either a key on a computer keyboard, or a button on a mouse. Yes.

Can either be pressed on released.

Keyboard axis

Represents cursor position or scroll wheel scrolling.

Unlike a keyboard key, an axis has a scalar state.

Keyboard action

Unlike a keyboard key, which represents a physical key or something similar, keyboard actions are completely abstract.

Keyboard keys can be bound to keyboard actions. This means that pressing and releasing the keyboard key will also trigger the keyboard action.

State

The UI state determines what the system will do with keyboard and mouse inputs.

States


Default | STATE_DEFAULT

Cursor is hidden. Inputs generate events normally.

No Input | STATE_NO_INPUT

Cursor is hidden, but inputs generate no events.

Flying | STATE_FLYING

Cursor is hidden, no inputs are generated. Instead, WASD keys can be used to move the Render view directly. Useful for debugging.

Menu Open | STATE_MENU_OPEN

Cursor is displayed, but no events are generated.

Cursor | STATE_CURSOR

Cursor is displayed. Inputs generate events normally.

Programming in C++


#include <framework/system.h>
API documentation page.

The basic initializtion and stuff goes something like this.

UI::Init();

// main loop
while (true) {
    UI::Update();
}

UI::Uninit();

As for the rest of it, there is too much stuff to cover all here. Check the API documentation.