Classes

UI/Canvas

Brief descriptions

Detailed information

ui::UiCanvasBuilder

engine/core/modules/ui/include/nau/ui/data/ui_canvas_builder.h

class UiCanvasBuilder

Public Static Functions

static async::Task loadIntoScene(Canvas *uiCanvas, nau::Ptr<data::UiAssetView> uiAsset)
static async::Task loadIntoScene(Canvas *uiCanvas, UiSceneAssetRef assetRef)

ui::Canvas

engine/core/modules/ui/include/nau/ui/elements/canvas.h

class Canvas : public nau::ui::Node

Public Functions

Canvas(const eastl::string&)
~Canvas()
void setReferenceSize(math::vec2 size)

Changes the canvas reference size.

Note

Reference size of the canvas is it unscaled size. Depending on the actual window size and rescaling policy it will be changed in the UI scene.

Parameters:

size[in] Value to assign.

math::vec2 getReferenceSize() const

Retrieves the canvas reference size.

Note

Reference size of the canvas is it unscaled size. Depending on the actual window size and rescaling policy it will be changed in the UI scene.

Returns:

Canvas reference size in virtual pixels.

RescalePolicy getRescalePolicy() const

Retrieves canvas rescaling policy.

Returns:

Current rescaling policy of the canvas.

void setRescalePolicy(RescalePolicy rescale)

Changes the canvas rescaling policy.

Parameters:

rescale[in] Policy to select.

inline const eastl::string &getCanvasName() const

Retrieves the canvas name.

Returns:

Canvas name.

template<typename TUIElement>
inline TUIElement *getUIElement(const eastl::string &name)

Retrieves a GUI element attached to the canvas.

Template Parameters:

TUIElement – Type of the element to retrieve.

Parameters:

name[in] Name of the element to retrieve.

Returns:

A pointer to the canvas element or NULL if the element has not been found or in case types mismatch.

Public Static Functions

static Canvas *create(math::vec2 size = {0.f, 0.f}, RescalePolicy rescale = RescalePolicy::NoRescale)

Creates canvas object.

Note

The canvas will have a default name. If a named canvas creation is desired, use different overload.

Parameters:
  • size[in] Canvas size in virtual pixels.

  • rescale[in] Canvas rescaling policy.

Returns:

A pointer to the created canvas object.

static Canvas *create(const eastl::string &name, math::vec2 size = {0.f, 0.f}, RescalePolicy rescale = RescalePolicy::NoRescale)

Creates canvas object.

Parameters:
  • name[in] Canvas name.

  • size[in] Canvas size in virtual pixels.

  • rescale[in] Canvas rescaling policy.

Returns:

A pointer to the created canvas object.

Public Static Attributes

static const eastl::string DEFAULT_NAME

Private Members

RescalePolicy m_rescale = {RescalePolicy::NoRescale}
math::vec2 m_size = {0.f, 0.f}
eastl::string m_canvasName = {}