Open 3D Engine LyShine Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
CLyShine Class Reference

CLyShine is the full implementation of the ILyShine interface. More...

#include <LyShine.h>

Inherits ILyShine, UiCursorBus::Handler, AzFramework::InputChannelEventListener, AzFramework::InputTextEventListener, AZ::TickBus::Handler, AZ::RPI::ViewportContextNotificationBus::Handler, AZ::Render::Bootstrap::NotificationBus::Handler, and LyShinePassDataRequestBus::Handler.

Public Member Functions

 CLyShine ()
 Create the LyShine object, the given system pointer is stored internally.
 
void Release () override
 Delete this object.
 
IDraw2dGetDraw2d () override
 Gets the IDraw2d interface.
 
AZ::EntityId CreateCanvas () override
 Create an empty UI Canvas (in game)
 
AZ::EntityId LoadCanvas (const AZStd::string &assetIdPathname) override
 Load a UI Canvas from in-game.
 
AZ::EntityId CreateCanvasInEditor (UiEntityContext *entityContext) override
 Create an empty UI Canvas (for the UI editor)
 
AZ::EntityId LoadCanvasInEditor (const AZStd::string &assetIdPathname, const AZStd::string &sourceAssetPathname, UiEntityContext *entityContext) override
 Load a UI Canvas from the UI editor.
 
AZ::EntityId ReloadCanvasFromXml (const AZStd::string &xmlString, UiEntityContext *entityContext) override
 Reload a UI Canvas from xml. For use in the editor for the undo system only.
 
AZ::EntityId FindCanvasById (LyShine::CanvasId id) override
 
AZ::EntityId FindLoadedCanvasByPathName (const AZStd::string &assetIdPathname) override
 
void ReleaseCanvas (AZ::EntityId canvas, bool forEditor) override
 Release a canvas from use either in-game or in editor, destroy UI Canvas if no longer used in either.
 
void ReleaseCanvasDeferred (AZ::EntityId canvas) override
 Queue a canvas for release on the next tick (used in game mode)
 
ISpriteLoadSprite (const AZStd::string &pathname) override
 Load a sprite object.
 
ISpriteCreateSprite (const AZ::Data::Asset< AZ::RPI::AttachmentImageAsset > &attachmentImageAsset) override
 Create a sprite that references the specified render target asset.
 
bool DoesSpriteTextureAssetExist (const AZStd::string &pathname) override
 Check if a sprite's texture asset exists. The .sprite sidecar file is optional and is not checked.
 
AZ::Data::Instance< AZ::RPI::Image > LoadTexture (const AZStd::string &pathname) override
 Load an image asset by texture pathname.
 
void PostInit () override
 Perform post-initialization (script system will be available)
 
void SetViewportSize (AZ::Vector2 viewportSize) override
 Set the current viewport size, this should be called before Update and Render are called.
 
void Update (float deltaTimeInSeconds) override
 
void Render () override
 Render 2D and UI elements that should be rendered at end of frame.
 
void ExecuteQueuedEvents () override
 Execute events that were queued during a canvas update or input event handler.
 
void Reset () override
 Reset the system (this happens at end of running game in Editor for example)
 
void OnLevelUnload () override
 Unload canvases that should be unloaded when a level is unloaded.
 
void OnLoadScreenUnloaded () override
 
void IncrementVisibleCounter () override
 
void DecrementVisibleCounter () override
 
bool IsUiCursorVisible () override
 
void SetUiCursor (const char *cursorImagePath) override
 
AZ::Vector2 GetUiCursorPosition () override
 
void SetUiCursorPosition (const AZ::Vector2 &) override
 
bool OnInputChannelEventFiltered (const AzFramework::InputChannel &inputChannel) override
 
bool OnInputTextEventFiltered (const AZStd::string &textUTF8) override
 
void OnTick (float deltaTime, AZ::ScriptTimePoint time) override
 
int GetTickOrder () override
 
void OnRenderTick () override
 
void OnBootstrapSceneReady (AZ::RPI::Scene *bootstrapScene) override
 
LyShine::AttachmentImagesAndDependencies GetRenderTargets () override
 
UiRendererGetUiRenderer ()
 
UiRendererGetUiRendererForEditor ()
 
void SetUiRendererForEditor (AZStd::shared_ptr< UiRenderer > uiRenderer)
 
- Public Member Functions inherited from ILyShine
 AZ_RTTI (ILyShine, "{652ED9D7-0782-44E8-BCE7-65DD38C90907}")
 
virtual void Release ()=0
 Delete this object.
 
virtual IDraw2dGetDraw2d ()=0
 Gets the IDraw2d interface.
 
virtual AZ::EntityId CreateCanvas ()=0
 Create an empty UI Canvas (in game)
 
virtual AZ::EntityId LoadCanvas (const AZStd::string &assetIdPathname)=0
 Load a UI Canvas from in-game.
 
virtual AZ::EntityId CreateCanvasInEditor (UiEntityContext *entityContext)=0
 Create an empty UI Canvas (for the UI editor)
 
virtual AZ::EntityId LoadCanvasInEditor (const AZStd::string &assetIdPathname, const AZStd::string &sourceAssetPathname, UiEntityContext *entityContext)=0
 Load a UI Canvas from the UI editor.
 
virtual AZ::EntityId ReloadCanvasFromXml (const AZStd::string &xmlString, UiEntityContext *entityContext)=0
 Reload a UI Canvas from xml. For use in the editor for the undo system only.
 
virtual AZ::EntityId FindCanvasById (LyShine::CanvasId id)=0
 
virtual AZ::EntityId FindLoadedCanvasByPathName (const AZStd::string &assetIdPathname)=0
 
virtual void ReleaseCanvas (AZ::EntityId canvas, bool forEditor=false)=0
 Release a canvas from use either in-game or in editor, destroy UI Canvas if no longer used in either.
 
virtual void ReleaseCanvasDeferred (AZ::EntityId canvas)=0
 Queue a canvas for release on the next tick (used in game mode)
 
virtual ISpriteLoadSprite (const AZStd::string &pathname)=0
 Load a sprite object.
 
virtual ISpriteCreateSprite (const AZ::Data::Asset< AZ::RPI::AttachmentImageAsset > &attachmentImageAsset)=0
 Create a sprite that references the specified render target asset.
 
virtual bool DoesSpriteTextureAssetExist (const AZStd::string &pathname)=0
 Check if a sprite's texture asset exists. The .sprite sidecar file is optional and is not checked.
 
virtual AZ::Data::Instance< AZ::RPI::Image > LoadTexture (const AZStd::string &pathName)=0
 Load an image asset by texture pathname.
 
virtual void PostInit ()=0
 Perform post-initialization (script system will be available)
 
virtual void SetViewportSize (AZ::Vector2 viewportSize)=0
 Set the current viewport size, this should be called before Update and Render are called.
 
virtual void Update (float deltaTimeInSeconds)=0
 
virtual void Render ()=0
 Render 2D and UI elements that should be rendered at end of frame.
 
virtual void ExecuteQueuedEvents ()=0
 Execute events that were queued during a canvas update or input event handler.
 
virtual void Reset ()=0
 Reset the system (this happens at end of running game in Editor for example)
 
virtual void OnLevelUnload ()=0
 Unload canvases that should be unloaded when a level is unloaded.
 
virtual void OnLoadScreenUnloaded ()=0
 

Static Public Member Functions

static void RunUnitTests (IConsoleCmdArgs *cmdArgs)
 

Detailed Description

CLyShine is the full implementation of the ILyShine interface.

Member Function Documentation

◆ CreateCanvas()

AZ::EntityId CLyShine::CreateCanvas ( )
overridevirtual

Create an empty UI Canvas (in game)

The system keeps track of all the loaded canvases and unloads them on game exit.

Implements ILyShine.

◆ CreateCanvasInEditor()

AZ::EntityId CLyShine::CreateCanvasInEditor ( UiEntityContext entityContext)
overridevirtual

Create an empty UI Canvas (for the UI editor)

The editor keeps track of the canvases it has open.

Implements ILyShine.

◆ CreateSprite()

ISprite * CLyShine::CreateSprite ( const AZ::Data::Asset< AZ::RPI::AttachmentImageAsset > &  attachmentImageAsset)
overridevirtual

Create a sprite that references the specified render target asset.

Implements ILyShine.

◆ DoesSpriteTextureAssetExist()

bool CLyShine::DoesSpriteTextureAssetExist ( const AZStd::string &  pathname)
overridevirtual

Check if a sprite's texture asset exists. The .sprite sidecar file is optional and is not checked.

Implements ILyShine.

◆ ExecuteQueuedEvents()

void CLyShine::ExecuteQueuedEvents ( )
overridevirtual

Execute events that were queued during a canvas update or input event handler.

Implements ILyShine.

◆ FindCanvasById()

AZ::EntityId CLyShine::FindCanvasById ( LyShine::CanvasId  id)
overridevirtual

Get a loaded canvas by CanvasId NOTE: this only searches canvases loaded in the game (not the editor)

Implements ILyShine.

◆ FindLoadedCanvasByPathName()

AZ::EntityId CLyShine::FindLoadedCanvasByPathName ( const AZStd::string &  assetIdPathname)
overridevirtual

Get a loaded canvas by path name NOTE: this only searches canvases loaded in the game (not the editor)

Implements ILyShine.

◆ GetDraw2d()

IDraw2d * CLyShine::GetDraw2d ( )
overridevirtual

Gets the IDraw2d interface.

Implements ILyShine.

◆ LoadCanvas()

AZ::EntityId CLyShine::LoadCanvas ( const AZStd::string &  assetIdPathname)
overridevirtual

Load a UI Canvas from in-game.

Implements ILyShine.

◆ LoadCanvasInEditor()

AZ::EntityId CLyShine::LoadCanvasInEditor ( const AZStd::string &  assetIdPathname,
const AZStd::string &  sourceAssetPathname,
UiEntityContext entityContext 
)
overridevirtual

Load a UI Canvas from the UI editor.

Implements ILyShine.

◆ LoadSprite()

ISprite * CLyShine::LoadSprite ( const AZStd::string &  pathname)
overridevirtual

Load a sprite object.

Implements ILyShine.

◆ LoadTexture()

AZ::Data::Instance< AZ::RPI::Image > CLyShine::LoadTexture ( const AZStd::string &  pathName)
overridevirtual

Load an image asset by texture pathname.

Implements ILyShine.

◆ OnLevelUnload()

void CLyShine::OnLevelUnload ( )
overridevirtual

Unload canvases that should be unloaded when a level is unloaded.

Implements ILyShine.

◆ OnLoadScreenUnloaded()

void CLyShine::OnLoadScreenUnloaded ( )
overridevirtual

Called when a load screen is finished displaying (when a level load is complete). Used to mark all render graphs dirty in case the loaded canvases were already rendered before their textures were done loading. This happens when a load screen is being rendered during a level load. When other canvases associated with the level are loaded, they also get rendered by the UiLoadScreenComponent, but their texture loading is delayed until further down the level load process. Once a canvas is rendered, its render graph's dirty flag is cleared, so the render graph needs to be marked dirty again after the textures are loaded

Implements ILyShine.

◆ PostInit()

void CLyShine::PostInit ( )
overridevirtual

Perform post-initialization (script system will be available)

Implements ILyShine.

◆ Release()

void CLyShine::Release ( )
overridevirtual

Delete this object.

Implements ILyShine.

◆ ReleaseCanvas()

void CLyShine::ReleaseCanvas ( AZ::EntityId  canvas,
bool  forEditor 
)
overridevirtual

Release a canvas from use either in-game or in editor, destroy UI Canvas if no longer used in either.

Implements ILyShine.

◆ ReleaseCanvasDeferred()

void CLyShine::ReleaseCanvasDeferred ( AZ::EntityId  canvas)
overridevirtual

Queue a canvas for release on the next tick (used in game mode)

Implements ILyShine.

◆ ReloadCanvasFromXml()

AZ::EntityId CLyShine::ReloadCanvasFromXml ( const AZStd::string &  xmlString,
UiEntityContext entityContext 
)
overridevirtual

Reload a UI Canvas from xml. For use in the editor for the undo system only.

Implements ILyShine.

◆ Render()

void CLyShine::Render ( )
overridevirtual

Render 2D and UI elements that should be rendered at end of frame.

Implements ILyShine.

◆ Reset()

void CLyShine::Reset ( )
overridevirtual

Reset the system (this happens at end of running game in Editor for example)

Implements ILyShine.

◆ SetViewportSize()

void CLyShine::SetViewportSize ( AZ::Vector2  viewportSize)
overridevirtual

Set the current viewport size, this should be called before Update and Render are called.

Implements ILyShine.

◆ Update()

void CLyShine::Update ( float  deltaTimeInSeconds)
overridevirtual

Update UI elements

Parameters
deltaTimeInSecondsthe amount of time in seconds since the last call to this function

Implements ILyShine.


The documentation for this class was generated from the following file: