Add an LyShine client API target (#6829)

* Reduce the need to link with LyShine static lib in other gems

Signed-off-by: abrmich <abrmich@amazon.com>

* Add UiBasics.Builders to VirtualGamepad.Builders alias

Signed-off-by: abrmich <abrmich@amazon.com>

* Add UiBasics to LyShine gem's metadata

Signed-off-by: abrmich <abrmich@amazon.com>

* Change include to a forward declaration

Signed-off-by: abrmich <abrmich@amazon.com>
This commit is contained in:
michabr
2022-01-13 12:56:34 -08:00
committed by GitHub
parent 34d74857f5
commit 193f529b9c
31 changed files with 125 additions and 99 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ ly_add_target(
INTERFACE
Gem::GameState
Gem::LocalUser
Gem::LyShine.Static
Gem::LyShine.Clients.API
Gem::SaveData.Static
Gem::MessagePopup.Static
Legacy::CryCommon
+10 -9
View File
@@ -58,10 +58,13 @@ ly_add_target(
# by default, load the above "Gem::LyShine" module in Client and Server applications:
ly_create_alias(NAME LyShine.Clients NAMESPACE Gem TARGETS Gem::LyShine)
ly_create_alias(NAME LyShine.Servers NAMESPACE Gem TARGETS Gem::LyShine)
# create an alias for other gems to depend on an LyShine public API (may be converted to a target in the future):
ly_create_alias(NAME LyShine.Clients.API NAMESPACE Gem TARGETS Gem::LyShine.Clients)
ly_create_alias(NAME LyShine.Servers.API NAMESPACE Gem TARGETS Gem::LyShine.Servers)
if (PAL_TRAIT_BUILD_HOST_TOOLS)
ly_add_target(
NAME LyShine.Editor.Static STATIC
NAME LyShine.Tools.Static STATIC
NAMESPACE Gem
AUTOMOC
AUTOUIC
@@ -73,7 +76,6 @@ if (PAL_TRAIT_BUILD_HOST_TOOLS)
.
Source
Editor
PUBLIC
Include
BUILD_DEPENDENCIES
PRIVATE
@@ -100,7 +102,7 @@ if (PAL_TRAIT_BUILD_HOST_TOOLS)
)
ly_add_target(
NAME LyShine.Editor GEM_MODULE
NAME LyShine.Tools GEM_MODULE
NAMESPACE Gem
FILES_CMAKE
lyshine_common_module_files.cmake
@@ -112,18 +114,18 @@ if (PAL_TRAIT_BUILD_HOST_TOOLS)
.
Source
Editor
PUBLIC
Include
BUILD_DEPENDENCIES
PRIVATE
Legacy::CryCommon
AZ::AzToolsFramework
Gem::LyShine.Editor.Static
Gem::LyShine.Tools.Static
Gem::LmbrCentral.Editor
Gem::TextureAtlas.Editor
RUNTIME_DEPENDENCIES
Gem::LmbrCentral.Editor
Gem::TextureAtlas.Editor
Gem::UiBasics.Tools
)
# by naming this target LyShine.Builders it ensures that it is loaded
@@ -179,10 +181,9 @@ if (PAL_TRAIT_BUILD_HOST_TOOLS)
Gem::LyShine.Builders.Static
Gem::LmbrCentral.Editor
Gem::TextureAtlas.Editor
RUNTIME_DEPENDENCIES
Gem::UiBasics.Builders
)
# by default, load the above "Gem::LyShine.Editor" module in dev tools:
ly_create_alias(NAME LyShine.Tools NAMESPACE Gem TARGETS Gem::LyShine.Editor)
endif()
################################################################################
@@ -241,7 +242,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
AZ::AzTest
Legacy::CryCommon
AZ::AssetBuilderSDK
Gem::LyShine.Editor.Static
Gem::LyShine.Tools.Static
Gem::LyShine.Builders.Static
Gem::LmbrCentral.Editor
Gem::TextureAtlas
+1 -1
View File
@@ -173,7 +173,7 @@ namespace GuideHelpers
// the line is drawn as the inverse of the background color
AZ::Color guideColor(1.0f, 1.0f, 1.0f, 1.0f);
CDraw2d::RenderState renderState;
IDraw2d::RenderState renderState;
renderState.m_blendState.m_blendSource = AZ::RHI::BlendFactor::ColorDestInverse;
renderState.m_blendState.m_blendDest = AZ::RHI::BlendFactor::Zero;
@@ -50,7 +50,7 @@ void ViewportCanvasBackground::Draw(Draw2dHelper& draw2d, const AZ::Vector2& can
// now draw the same as Stretched but with UV's adjusted
const AZ::Vector2 uvs[4] = { AZ::Vector2(0, 0), AZ::Vector2(uvScale.GetX(), 0), AZ::Vector2(uvScale.GetX(), uvScale.GetY()), AZ::Vector2(0, uvScale.GetY()) };
AZ::Color colorWhite(1.0f, 1.0f, 1.0f, 1.0f);
CDraw2d::VertexPosColUV verts[4];
IDraw2d::VertexPosColUV verts[4];
for (int i = 0; i < 4; ++i)
{
verts[i].position = positions[i];
@@ -8,7 +8,7 @@
#pragma once
#include <AzCore/Math/Vector2.h>
#include <LyShine/Draw2d.h>
#include <LyShine/IDraw2d.h>
//! Abstract base class for drag interactions in the UI Editor viewport window.
class ViewportDragInteraction
+1 -1
View File
@@ -7,7 +7,7 @@
*/
#pragma once
#include <LyShine/Draw2d.h>
#include <LyShine/IDraw2d.h>
namespace ViewportHelpers
{
+6 -6
View File
@@ -6,7 +6,7 @@
*
*/
#include "EditorCommon.h"
#include <LyShine/Draw2d.h>
#include <LyShine/IDraw2d.h>
#include <Atom/RPI.Public/Image/StreamingImage.h>
#include <Atom/RPI.Reflect/Image/StreamingImageAsset.h>
@@ -15,7 +15,7 @@ float ViewportIcon::m_dpiScaleFactor = 1.0f;
ViewportIcon::ViewportIcon(const char* textureFilename)
{
m_image = CDraw2d::LoadTexture(textureFilename);
m_image = Draw2dHelper::LoadTexture(textureFilename);
}
ViewportIcon::~ViewportIcon()
@@ -48,7 +48,7 @@ void ViewportIcon::DrawImageAligned(Draw2dHelper& draw2d, AZ::Vector2& pivot, fl
opacity);
}
void ViewportIcon::DrawImageTiled(Draw2dHelper& draw2d, CDraw2d::VertexPosColUV* verts)
void ViewportIcon::DrawImageTiled(Draw2dHelper& draw2d, IDraw2d::VertexPosColUV* verts)
{
// Use default blending and rounding modes
IDraw2d::Rounding rounding = IDraw2d::Rounding::Nearest;
@@ -63,7 +63,7 @@ void ViewportIcon::DrawAxisAlignedBoundingBox(Draw2dHelper& draw2d, AZ::Vector2
float endTexCoordU = fabsf((bound1.GetX() - bound0.GetX()) * pixelLengthForDottedLineTexture);
float endTexCoordV = fabsf((bound1.GetY() - bound0.GetY()) * pixelLengthForDottedLineTexture);
CDraw2d::VertexPosColUV verts[2];
IDraw2d::VertexPosColUV verts[2];
{
verts[0].color = dottedColor;
verts[1].color = dottedColor;
@@ -158,7 +158,7 @@ void ViewportIcon::Draw(Draw2dHelper& draw2d, AZ::Vector2 anchorPos, const AZ::M
AZ::Matrix4x4 moveFromPivotSpaceMat = AZ::Matrix4x4::CreateTranslation(pivot3);
AZ::Matrix4x4 newTransform = transform * moveFromPivotSpaceMat * rotMat * moveToPivotSpaceMat;
CDraw2d::VertexPosColUV verts[4];
IDraw2d::VertexPosColUV verts[4];
// points are a clockwise quad
static const AZ::Vector2 uvs[4] = {
AZ::Vector2(0.0f, 0.0f), AZ::Vector2(1.0f, 0.0f), AZ::Vector2(1.0f, 1.0f), AZ::Vector2(0.0f, 1.0f)
@@ -251,7 +251,7 @@ void ViewportIcon::DrawDistanceLine(Draw2dHelper& draw2d, AZ::Vector2 start, AZ:
const float pixelLengthForDottedLineTexture = 8.0f;
float endTexCoordU = length / pixelLengthForDottedLineTexture;
CDraw2d::VertexPosColUV verts[2];
IDraw2d::VertexPosColUV verts[2];
verts[0].position = start;
verts[0].color = dottedColor;
+1 -1
View File
@@ -20,7 +20,7 @@ public:
void DrawImageAligned(Draw2dHelper& draw2d, AZ::Vector2& pivot, float opacity);
void DrawImageTiled(Draw2dHelper& draw2d, CDraw2d::VertexPosColUV* verts);
void DrawImageTiled(Draw2dHelper& draw2d, IDraw2d::VertexPosColUV* verts);
void Draw(Draw2dHelper& draw2d, AZ::Vector2 anchorPos, const AZ::Matrix4x4& transform, float iconRot = 0.0f, AZ::Color color = AZ::Color(1.0f, 1.0f, 1.0f, 1.0f)) const;
+1 -1
View File
@@ -16,7 +16,6 @@
#include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>
#include <LyShine/Bus/UiEditorCanvasBus.h>
#include <LyShine/Draw2d.h>
#include "LyShine.h"
#include "UiRenderer.h"
@@ -27,6 +26,7 @@
#include "RulerWidget.h"
#include "CanvasHelpers.h"
#include "AssetDropHelpers.h"
#include "Draw2d.h"
#include "QtHelpers.h"
#include <QtGui/private/qhighdpiscaling_p.h>
@@ -482,6 +482,50 @@ public: // static member functions
return nullptr;
}
//! Helper to load a texture
static AZ::Data::Instance<AZ::RPI::Image> LoadTexture(const AZStd::string& pathName)
{
if (gEnv && gEnv->pLyShine) // [LYSHINE_ATOM_TODO][GHI #3569] Remove LyShine global interface pointer from legacy global environment
{
return gEnv->pLyShine->LoadTexture(pathName);
}
return nullptr;
}
//! Given a position and size and an alignment return the top left corner of the aligned quad
static AZ::Vector2 Align(AZ::Vector2 position, AZ::Vector2 size, IDraw2d::HAlign horizontalAlignment, IDraw2d::VAlign verticalAlignment)
{
AZ::Vector2 result = AZ::Vector2::CreateZero();
switch (horizontalAlignment)
{
case IDraw2d::HAlign::Left:
result.SetX(position.GetX());
break;
case IDraw2d::HAlign::Center:
result.SetX(position.GetX() - size.GetX() * 0.5f);
break;
case IDraw2d::HAlign::Right:
result.SetX(position.GetX() - size.GetX());
break;
}
switch (verticalAlignment)
{
case IDraw2d::VAlign::Top:
result.SetY(position.GetY());
break;
case IDraw2d::VAlign::Center:
result.SetY(position.GetY() - size.GetY() * 0.5f);
break;
case IDraw2d::VAlign::Bottom:
result.SetY(position.GetY() - size.GetY());
break;
}
return result;
}
//! Round the X and Y coordinates of a point using the given rounding policy
template<typename T>
static T RoundXY(T value, IDraw2d::Rounding roundingType)
@@ -9,12 +9,18 @@
#include <AzCore/Math/Vector2.h>
#include <LyShine/UiBase.h>
#include <AtomCore/Instance/Instance.h>
class IDraw2d;
class ISprite;
struct IUiAnimationSystem;
class UiEntityContext;
namespace AZ::RPI
{
class Image;
}
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the LYSHINE_EXPORTS
// symbol defined in the StdAfx.h. this symbol should not be defined on any project
@@ -82,6 +88,9 @@ public:
//! Check if a sprite's texture asset exists. The .sprite sidecar file is optional and is not checked
virtual bool DoesSpriteTextureAssetExist(const AZStd::string& pathname) = 0;
//! Load an image asset by texture pathname
virtual AZ::Data::Instance<AZ::RPI::Image> LoadTexture(const AZStd::string& pathName) = 0;
//! Perform post-initialization (script system will be available)
virtual void PostInit() = 0;
+2 -36
View File
@@ -6,7 +6,7 @@
*
*/
#include <LyShine/Draw2d.h>
#include "Draw2d.h"
#include <LyShine/UiRenderFormats.h>
#include "LyShinePassDataBus.h"
@@ -215,7 +215,7 @@ void CDraw2d::DrawImageAligned(AZ::Data::Instance<AZ::RPI::Image> image, AZ::Vec
HAlign horizontalAlignment, VAlign verticalAlignment,
float opacity, float rotation, const AZ::Vector2* minMaxTexCoords, ImageOptions* imageOptions)
{
AZ::Vector2 alignedPosition = Align(position, size, horizontalAlignment, verticalAlignment);
AZ::Vector2 alignedPosition = Draw2dHelper::Align(position, size, horizontalAlignment, verticalAlignment);
DrawImage(image, alignedPosition, size, opacity, rotation, &position, minMaxTexCoords, imageOptions);
}
@@ -524,40 +524,6 @@ void CDraw2d::SetSortKey(int64_t key)
// PUBLIC STATIC FUNCTIONS
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
AZ::Vector2 CDraw2d::Align(AZ::Vector2 position, AZ::Vector2 size,
HAlign horizontalAlignment, VAlign verticalAlignment)
{
AZ::Vector2 result = AZ::Vector2::CreateZero();
switch (horizontalAlignment)
{
case HAlign::Left:
result.SetX(position.GetX());
break;
case HAlign::Center:
result.SetX(position.GetX() - size.GetX() * 0.5f);
break;
case HAlign::Right:
result.SetX(position.GetX() - size.GetX());
break;
}
switch (verticalAlignment)
{
case VAlign::Top:
result.SetY(position.GetY());
break;
case VAlign::Center:
result.SetY(position.GetY() - size.GetY() * 0.5f);
break;
case VAlign::Bottom:
result.SetY(position.GetY() - size.GetY());
break;
}
return result;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
AZ::Data::Instance<AZ::RPI::Image> CDraw2d::LoadTexture(const AZStd::string& pathName)
{
@@ -180,9 +180,6 @@ private:
public: // static member functions
//! Given a position and size and an alignment return the top left corner of the aligned quad
static AZ::Vector2 Align(AZ::Vector2 position, AZ::Vector2 size, HAlign horizontalAlignment, VAlign verticalAlignment);
//! Helper to load a texture
static AZ::Data::Instance<AZ::RPI::Image> LoadTexture(const AZStd::string& pathName);
+8 -2
View File
@@ -43,11 +43,11 @@
#include "Sprite.h"
#include "UiSerialize.h"
#include "UiRenderer.h"
#include "Draw2d.h"
#include <LyShine/Bus/UiCursorBus.h>
#include <LyShine/Bus/UiDraggableBus.h>
#include <LyShine/Bus/UiDropTargetBus.h>
#include <LyShine/Draw2d.h>
#if defined(LYSHINE_INTERNAL_UNIT_TEST)
#include "TextMarkup.h"
@@ -355,6 +355,12 @@ bool CLyShine::DoesSpriteTextureAssetExist(const AZStd::string& pathname)
return CSprite::DoesSpriteTextureAssetExist(pathname);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
AZ::Data::Instance<AZ::RPI::Image> CLyShine::LoadTexture(const AZStd::string& pathname)
{
return CDraw2d::LoadTexture(pathname);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void CLyShine::PostInit()
{
@@ -691,7 +697,7 @@ void CLyShine::RenderUiCursor()
AZ::RHI::Size cursorSize = m_uiCursorTexture->GetDescriptor().m_size;
const AZ::Vector2 dimensions(aznumeric_cast<float>(cursorSize.m_width), aznumeric_cast<float>(cursorSize.m_height));
CDraw2d::ImageOptions imageOptions;
IDraw2d::ImageOptions imageOptions;
imageOptions.m_clamp = true;
const float opacity = 1.0f;
const float rotation = 0.0f;
+1
View File
@@ -72,6 +72,7 @@ public:
ISprite* LoadSprite(const AZStd::string& pathname) override;
ISprite* CreateSprite(const AZStd::string& renderTargetName) override;
bool DoesSpriteTextureAssetExist(const AZStd::string& pathname) override;
AZ::Data::Instance<AZ::RPI::Image> LoadTexture(const AZStd::string& pathname) override;
void PostInit() override;
+11 -11
View File
@@ -7,7 +7,7 @@
*/
#include "LyShineDebug.h"
#include "IConsole.h"
#include <LyShine/Draw2d.h>
#include <LyShine/IDraw2d.h>
#include <Atom/RPI.Public/Image/ImageSystemInterface.h>
@@ -377,7 +377,7 @@ static void DebugDrawColoredBox(AZ::Vector2 pos, AZ::Vector2 size, AZ::Color col
{
IDraw2d* draw2d = Draw2dHelper::GetDefaultDraw2d();
CDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
IDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
imageOptions.color = color.GetAsVector3();
auto whiteTexture = AZ::RPI::ImageSystemInterface::Get()->GetSystemImage(AZ::RPI::SystemImage::White);
draw2d->DrawImageAligned(whiteTexture, pos, size, horizontalAlignment, verticalAlignment,
@@ -392,7 +392,7 @@ static void DebugDrawStringWithSizeBox(AZStd::string_view font, unsigned int eff
{
IDraw2d* draw2d = Draw2dHelper::GetDefaultDraw2d();
CDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions();
IDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions();
if (!font.empty())
{
textOptions.fontName = font;
@@ -618,7 +618,7 @@ static AZ::Vector2 DebugDrawFontColorTestBox(AZ::Vector2 pos, const char* string
float pointSize = 32.0f;
const float spacing = 6.0f;
CDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions();
IDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions();
textOptions.effectIndex = 1; // no drop shadow baked in
textOptions.color = color;
@@ -742,7 +742,7 @@ static void DebugDraw2dImageColor()
AZ::Data::Instance<AZ::RPI::Image> texture = GetMonoAlphaTestTexture();
CDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
IDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
draw2d->DrawText(
"Testing image colors, image is black and white, top row is opacity=1, bottom row is opacity = 0.5",
@@ -780,7 +780,7 @@ static void DebugDraw2dImageBlendMode()
AZ::Data::Instance<AZ::RPI::Image> texture = GetColorAlphaTestTexture();
CDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
IDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
draw2d->DrawText("Testing blend modes, src blend changes across x-axis, dst blend changes across y axis",
AZ::Vector2(20, 20), 16);
@@ -801,7 +801,7 @@ static void DebugDraw2dImageBlendMode()
AZ::Vector2 pos(xStart + xSpacing * srcIndex, yStart + ySpacing * dstIndex);
// first draw a background with varying color and alpha
CDraw2d::VertexPosColUV verts[4] =
IDraw2d::VertexPosColUV verts[4] =
{
{ // top left
AZ::Vector2(pos.GetX(), pos.GetY()),
@@ -828,7 +828,7 @@ static void DebugDraw2dImageBlendMode()
// Draw the image with this color
CDraw2d::RenderState renderState;
IDraw2d::RenderState renderState;
renderState.m_blendState.m_blendSource = g_srcBlendModes[srcIndex];
renderState.m_blendState.m_blendDest = g_dstBlendModes[dstIndex];
draw2d->DrawImage(texture, pos, size, 1.0f, 0.0f, 0, 0, &imageOptions);
@@ -845,7 +845,7 @@ static void DebugDraw2dImageUVs()
AZ::Data::Instance<AZ::RPI::Image> texture = GetColorTestTexture();
CDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
IDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
draw2d->DrawText(
"Testing DrawImage with minMaxTexCoords. Full image, top left quadrant, middle section, full flipped",
@@ -894,7 +894,7 @@ static void DebugDraw2dImagePixelRounding()
AZ::Data::Instance<AZ::RPI::Image> texture = GetColorTestTexture();
CDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
IDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
draw2d->DrawText("Testing DrawImage pixel rounding options", AZ::Vector2(20, 20), 16);
@@ -933,7 +933,7 @@ static void DebugDraw2dLineBasic()
{
IDraw2d* draw2d = Draw2dHelper::GetDefaultDraw2d();
CDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
IDraw2d::ImageOptions imageOptions = draw2d->GetDefaultImageOptions();
draw2d->DrawText("Testing DrawLine", AZ::Vector2(20, 20), 16);
@@ -27,7 +27,7 @@
#include <LyShine/Bus/UiEntityContextBus.h>
#include <LyShine/Bus/UiCanvasUpdateNotificationBus.h>
#include <LyShine/UiSerializeHelpers.h>
#include <LyShine/Draw2d.h>
#include <LyShine/IDraw2d.h>
#include <AzCore/Math/Crc.h>
#include <AzCore/Memory/Memory.h>
+3 -3
View File
@@ -6,7 +6,7 @@
*
*/
#include "UiCanvasManager.h"
#include <LyShine/Draw2d.h>
#include <LyShine/IDraw2d.h>
#include "UiCanvasFileObject.h"
#include "UiCanvasComponent.h"
@@ -1020,7 +1020,7 @@ void UiCanvasManager::DebugDisplayCanvasData(int setting) const
// local function to write a line of text (with a background rect) and increment Y offset
AZStd::function<void(const char*, const AZ::Vector3&)> WriteLine = [&](const char* buffer, const AZ::Vector3& color)
{
CDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions();
IDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions();
textOptions.color = color;
AZ::Vector2 textSize = draw2d->GetTextSize(buffer, fontSize, &textOptions);
AZ::Vector2 rectTopLeft = AZ::Vector2(xOffset - 2, yOffset);
@@ -1174,7 +1174,7 @@ void UiCanvasManager::DebugDisplayDrawCallData() const
// local function to write a line of text (with a background rect) and increment Y offset
AZStd::function<void(const char*, const AZ::Vector3&)> WriteLine = [&](const char* buffer, const AZ::Vector3& color)
{
CDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions();
IDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions();
textOptions.color = color;
AZ::Vector2 textSize = draw2d->GetTextSize(buffer, fontSize, &textOptions);
AZ::Vector2 rectTopLeft = AZ::Vector2(xOffset - 2, yOffset);
@@ -7,7 +7,7 @@
*/
#include "UiFaderComponent.h"
#include "RenderGraph.h"
#include <LyShine/Draw2d.h>
#include <LyShine/IDraw2d.h>
#include <AzCore/Math/Crc.h>
#include <AzCore/Math/MathUtils.h>
@@ -13,7 +13,7 @@
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Component/ComponentApplicationBus.h>
#include <LyShine/Draw2d.h>
#include <LyShine/IDraw2d.h>
#include <LyShine/UiSerializeHelpers.h>
#include <LyShine/Bus/UiElementBus.h>
#include <LyShine/Bus/UiCanvasBus.h>
@@ -9,7 +9,7 @@
#include "Sprite.h"
#include "RenderGraph.h"
#include <LyShine/Draw2d.h>
#include <LyShine/IDraw2d.h>
#include <LyShine/ISprite.h>
#include <LyShine/IRenderGraph.h>
#include <LyShine/Bus/UiElementBus.h>
+1 -1
View File
@@ -6,7 +6,7 @@
*
*/
#include "UiMaskComponent.h"
#include <LyShine/Draw2d.h>
#include <LyShine/IDraw2d.h>
#include <AzCore/Math/Crc.h>
#include <AzCore/Serialization/SerializeContext.h>
+2 -2
View File
@@ -20,7 +20,7 @@
#include <AzCore/Math/MatrixUtils.h>
#include <AzCore/Debug/Trace.h>
#include <LyShine/Draw2d.h>
#include <LyShine/IDraw2d.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
// PUBLIC MEMBER FUNCTIONS
@@ -449,7 +449,7 @@ void UiRenderer::DebugDisplayTextureData(int recordingOption)
// local function to write a line of text (with a background rect) and increment Y offset
AZStd::function<void(const char*, const AZ::Vector3&)> WriteLine = [&](const char* buffer, const AZ::Vector3& color)
{
CDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions();
IDraw2d::TextOptions textOptions = draw2d->GetDefaultTextOptions();
textOptions.color = color;
AZ::Vector2 textSize = draw2d->GetTextSize(buffer, fontSize, &textOptions);
AZ::Vector2 rectTopLeft = AZ::Vector2(xOffset - 2, yOffset);
+5 -5
View File
@@ -23,7 +23,7 @@
#include <LyShine/Bus/UiCanvasBus.h>
#include <LyShine/UiSerializeHelpers.h>
#include <LyShine/IRenderGraph.h>
#include <LyShine/Draw2d.h>
#include <LyShine/IDraw2d.h>
#include <ILocalizationManager.h>
@@ -1105,7 +1105,7 @@ UiTextComponent::InlineImage::InlineImage(const AZStd::string& texturePathname,
else
{
// Load the texture
m_texture = CDraw2d::LoadTexture(m_filepath);
m_texture = Draw2dHelper::LoadTexture(m_filepath);
if (m_texture)
{
AZ::RHI::Size size = m_texture->GetDescriptor().m_size;
@@ -1157,7 +1157,7 @@ bool UiTextComponent::InlineImage::OnAtlasUnloaded(const TextureAtlasNamespace::
else
{
// Load the texture
m_texture = CDraw2d::LoadTexture(m_filepath);
m_texture = Draw2dHelper::LoadTexture(m_filepath);
}
return true;
}
@@ -2675,7 +2675,7 @@ void UiTextComponent::GetClickableTextRects(UiClickableTextInterface::ClickableT
}
else
{
alignedPosition = CDraw2d::Align(pos, drawBatchLine.lineSize, m_textHAlignment, IDraw2d::VAlign::Top); // y is already aligned
alignedPosition = Draw2dHelper::Align(pos, drawBatchLine.lineSize, m_textHAlignment, IDraw2d::VAlign::Top); // y is already aligned
}
alignedPosition.SetY(alignedPosition.GetY() + newlinePosYIncrement);
@@ -4043,7 +4043,7 @@ void UiTextComponent::RenderDrawBatchLines(
}
else
{
alignedPosition = CDraw2d::Align(pos, drawBatchLine.lineSize, m_textHAlignment, IDraw2d::VAlign::Top); // y is already aligned
alignedPosition = Draw2dHelper::Align(pos, drawBatchLine.lineSize, m_textHAlignment, IDraw2d::VAlign::Top); // y is already aligned
}
alignedPosition.SetY(alignedPosition.GetY() + newlinePosYIncrement);
+2 -2
View File
@@ -7,8 +7,6 @@
#
set(FILES
Source/Draw2d.cpp
Include/LyShine/Draw2d.h
Include/LyShine/IDraw2d.h
Include/LyShine/IRenderGraph.h
Include/LyShine/ISprite.h
@@ -88,6 +86,8 @@ set(FILES
Include/LyShine/Bus/World/UiCanvasOnMeshBus.h
Include/LyShine/Bus/World/UiCanvasRefBus.h
Include/LyShine/Bus/Tools/UiSystemToolsBus.h
Source/Draw2d.cpp
Source/Draw2d.h
Source/LyShine.cpp
Source/LyShine.h
Source/LyShinePassDataBus.h
+2 -1
View File
@@ -24,6 +24,7 @@
"Atom_Bootstrap",
"AtomFont",
"TextureAtlas",
"AtomToolsFramework"
"AtomToolsFramework",
"UiBasics"
]
}
+2 -2
View File
@@ -21,7 +21,7 @@ ly_add_target(
Gem::LmbrCentral
PUBLIC
Legacy::CryCommon
Gem::LyShine.Static
Gem::LyShine.Clients.API
)
ly_add_target(
@@ -42,7 +42,7 @@ ly_add_target(
# if enabled, LyShineExamples is used by all kinds of applications, however, the dependency to LmbrCentral is different
# per application type
ly_create_alias(NAME LyShineExamples.Builders NAMESPACE Gem TARGETS Gem::LyShineExamples Gem::LmbrCentral.Editor)
ly_create_alias(NAME LyShineExamples.Builders NAMESPACE Gem TARGETS Gem::LyShineExamples Gem::UiBasics.Builders Gem::LmbrCentral.Editor)
ly_create_alias(NAME LyShineExamples.Tools NAMESPACE Gem TARGETS Gem::LyShineExamples Gem::LmbrCentral.Editor)
ly_create_alias(NAME LyShineExamples.Clients NAMESPACE Gem TARGETS Gem::LyShineExamples Gem::LmbrCentral)
ly_create_alias(NAME LyShineExamples.Servers NAMESPACE Gem TARGETS Gem::LyShineExamples Gem::LmbrCentral)
@@ -14,7 +14,7 @@
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <LyShine/Draw2d.h>
#include <LyShine/IDraw2d.h>
#include <LyShine/ISprite.h>
#include <LyShine/Bus/UiElementBus.h>
#include <LyShine/Bus/UiCanvasBus.h>
+2 -2
View File
@@ -19,7 +19,7 @@ ly_add_target(
BUILD_DEPENDENCIES
PUBLIC
Legacy::CryCommon
Gem::LyShine
Gem::LyShine.Clients.API
)
ly_add_target(
@@ -39,4 +39,4 @@ ly_add_target(
# MessagePopup is used only in client applications
ly_create_alias(NAME MessagePopup.Clients NAMESPACE Gem TARGETS Gem::MessagePopup)
ly_create_alias(NAME MessagePopup.Builders NAMESPACE Gem TARGETS Gem::UiBasics.Builders)
+1
View File
@@ -9,4 +9,5 @@
# This will export its "SourcePaths" to the generated "cmake_dependencies.<project>.assetbuilder.setreg"
if(PAL_TRAIT_BUILD_HOST_TOOLS)
ly_create_alias(NAME UiBasics.Builders NAMESPACE Gem)
ly_create_alias(NAME UiBasics.Tools NAMESPACE Gem)
endif()
+2 -2
View File
@@ -21,7 +21,7 @@ ly_add_target(
AZ::AzCore
AZ::AzFramework
Legacy::CryCommon
Gem::LyShine
Gem::LyShine.Clients.API
)
ly_add_target(
@@ -42,4 +42,4 @@ ly_add_target(
# the virtual gamepad is needed everywhere except servers:
ly_create_alias(NAME VirtualGamepad.Clients NAMESPACE Gem TARGETS Gem::VirtualGamepad)
ly_create_alias(NAME VirtualGamepad.Tools NAMESPACE Gem TARGETS Gem::VirtualGamepad)
ly_create_alias(NAME VirtualGamepad.Builders NAMESPACE Gem TARGETS Gem::VirtualGamepad)
ly_create_alias(NAME VirtualGamepad.Builders NAMESPACE Gem TARGETS Gem::VirtualGamepad Gem::UiBasics.Builders)