Added functionality for graphics system to render to swapchain image when SHEDITOR is disabled. #241

Merged
Xenosas1337 merged 6 commits from SP3-1-Rendering into main 2022-11-22 10:58:26 +08:00
18 changed files with 286 additions and 57 deletions
Showing only changes of commit cf0b94e97d - Show all commits

View File

@ -14,7 +14,7 @@
#include "Physics/Interface/SHRigidBodyComponent.h"
#include "Physics/Interface/SHColliderComponent.h"
#include "Graphics/MiddleEnd/Lights/SHLightComponent.h"
#include "Graphics/MiddleEnd/TextRendering/SHTextRendererComponent.h"
#include "Graphics/MiddleEnd/TextRendering/SHTextRenderableComponent.h"
#include "Assets/SHAssetManager.h"
#include "Camera/SHCameraComponent.h"

View File

@ -498,11 +498,11 @@ namespace SHADE
}
template<>
static void DrawComponent(SHTextRendererComponent* component)
static void DrawComponent(SHTextRenderableComponent* component)
{
if (!component)
return;
ImGui::PushID(SHFamilyID<SHComponent>::GetID<SHTextRendererComponent>());
ImGui::PushID(SHFamilyID<SHComponent>::GetID<SHTextRenderableComponent>());
const auto componentType = rttr::type::get(*component);
SHEditorWidgets::CheckBox("##IsActive", [component]() {return component->isActive; }, [component](bool const& active) {component->isActive = active; }, "Is Component Active");
ImGui::SameLine();

View File

@ -22,7 +22,7 @@
#include "UI/SHCanvasComponent.h"
#include "SHEditorComponentView.h"
#include "AudioSystem/SHAudioListenerComponent.h"
#include "Graphics/MiddleEnd/TextRendering/SHTextRendererComponent.h"
#include "Graphics/MiddleEnd/TextRendering/SHTextRenderableComponent.h"
namespace SHADE
{
@ -145,7 +145,7 @@ namespace SHADE
{
DrawComponent(uiComponent);
}
if (auto textRendererComponent = SHComponentManager::GetComponent_s<SHTextRendererComponent>(eid))
if (auto textRendererComponent = SHComponentManager::GetComponent_s<SHTextRenderableComponent>(eid))
{
DrawComponent(textRendererComponent);
}
@ -167,7 +167,7 @@ namespace SHADE
DrawAddComponentWithEnforcedComponentButton<SHRenderable, SHTransformComponent>(eid);
DrawAddComponentWithEnforcedComponentButton<SHRigidBodyComponent, SHTransformComponent>(eid);
DrawAddComponentWithEnforcedComponentButton<SHColliderComponent, SHTransformComponent>(eid);
DrawAddComponentWithEnforcedComponentButton<SHTextRendererComponent, SHTransformComponent>(eid);
DrawAddComponentWithEnforcedComponentButton<SHTextRenderableComponent, SHTransformComponent>(eid);
ImGui::EndMenu();

View File

@ -1,15 +1,15 @@
#include "SHpch.h"
#include "SHTextRendererComponent.h"
#include "SHTextRenderableComponent.h"
namespace SHADE
{
void SHTextRendererComponent::MakeDirty(void) noexcept
void SHTextRenderableComponent::MakeDirty(void) noexcept
{
requiresRecompute = true;
}
void SHTextRendererComponent::Clean(void) noexcept
void SHTextRenderableComponent::Clean(void) noexcept
{
requiresRecompute = false;
}
@ -22,7 +22,7 @@ namespace SHADE
*/
/***************************************************************************/
void SHTextRendererComponent::OnCreate(void)
void SHTextRenderableComponent::OnCreate(void)
{
text = "My name is Brandon.";
requiresRecompute = true;
@ -31,7 +31,7 @@ namespace SHADE
color = SHColour::WHITE;
}
void SHTextRendererComponent::OnDestroy(void)
void SHTextRenderableComponent::OnDestroy(void)
{
}
@ -49,13 +49,13 @@ namespace SHADE
*/
/***************************************************************************/
void SHTextRendererComponent::SetText(std::string_view newText) noexcept
void SHTextRenderableComponent::SetText(std::string_view newText) noexcept
{
text = newText;
MakeDirty();
}
void SHTextRendererComponent::SetFont(Handle<SHFont> font) noexcept
void SHTextRenderableComponent::SetFont(Handle<SHFont> font) noexcept
{
fontHandle = font;
MakeDirty();
@ -72,12 +72,12 @@ namespace SHADE
*/
/***************************************************************************/
std::string const& SHTextRendererComponent::GetText(void) const noexcept
std::string const& SHTextRenderableComponent::GetText(void) const noexcept
{
return text;
}
Handle<SHFont> SHTextRendererComponent::GetFont(void) const noexcept
Handle<SHFont> SHTextRenderableComponent::GetFont(void) const noexcept
{
return fontHandle;
}
@ -90,6 +90,6 @@ namespace rttr
{
using namespace SHADE;
registration::class_<SHTextRendererComponent>("Text Renderer Component");
registration::class_<SHTextRenderableComponent>("Text Renderer Component");
};
}

View File

@ -13,7 +13,7 @@ namespace SHADE
class SHVkDescriptorSetGroup;
class SHVkBuffer;
class SH_API SHTextRendererComponent final : public SHComponent
class SH_API SHTextRenderableComponent final : public SHComponent
{
public:
static constexpr uint32_t MAX_CHARACTERS = 500;

View File

@ -1,6 +1,6 @@
#include "SHpch.h"
#include "SHTextRenderingSubSystem.h"
#include "Graphics/MiddleEnd/TextRendering/SHTextRendererComponent.h"
#include "Graphics/MiddleEnd/TextRendering/SHTextRenderableComponent.h"
#include "ECS_Base/Managers/SHComponentManager.h"
#include "Math/Vector/SHVec4.h"
#include "Graphics/Devices/SHVkLogicalDevice.h"
@ -14,20 +14,20 @@
namespace SHADE
{
void SHTextRenderingSubSystem::RecomputePositions(SHTextRendererComponent& textComp) noexcept
void SHTextRenderingSubSystem::RecomputePositions(SHTextRenderableComponent& textComp) noexcept
{
if (textComp.text.empty() || !textComp.fontHandle)
return;
// Create the buffer
if (!textComp.indexingDataBuffer)
textComp.indexingDataBuffer = logicalDevice->CreateBuffer(SHTextRendererComponent::MAX_CHARACTERS * sizeof(uint32_t), nullptr, SHTextRendererComponent::MAX_CHARACTERS * sizeof(uint32_t), vk::BufferUsageFlagBits::eVertexBuffer, VMA_MEMORY_USAGE_AUTO, VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT | VMA_ALLOCATION_CREATE_MAPPED_BIT);
textComp.indexingDataBuffer = logicalDevice->CreateBuffer(SHTextRenderableComponent::MAX_CHARACTERS * sizeof(uint32_t), nullptr, SHTextRenderableComponent::MAX_CHARACTERS * sizeof(uint32_t), vk::BufferUsageFlagBits::eVertexBuffer, VMA_MEMORY_USAGE_AUTO, VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT | VMA_ALLOCATION_CREATE_MAPPED_BIT);
if (!textComp.charPositionDataBuffer)
textComp.charPositionDataBuffer = logicalDevice->CreateBuffer(SHTextRendererComponent::MAX_CHARACTERS * sizeof(SHVec4), nullptr, SHTextRendererComponent::MAX_CHARACTERS * sizeof(SHVec4), vk::BufferUsageFlagBits::eVertexBuffer, VMA_MEMORY_USAGE_AUTO, VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT | VMA_ALLOCATION_CREATE_MAPPED_BIT);
textComp.charPositionDataBuffer = logicalDevice->CreateBuffer(SHTextRenderableComponent::MAX_CHARACTERS * sizeof(SHVec4), nullptr, SHTextRenderableComponent::MAX_CHARACTERS * sizeof(SHVec4), vk::BufferUsageFlagBits::eVertexBuffer, VMA_MEMORY_USAGE_AUTO, VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT | VMA_ALLOCATION_CREATE_MAPPED_BIT);
// For indexing font transformation in the shader
std::vector <SHTextRendererComponent::TextIndexingType> indexingData;
std::vector <SHTextRenderableComponent::TextIndexingType> indexingData;
// For placing glyphs correctly
std::vector <SHVec4> charPositionData;
@ -49,7 +49,7 @@ namespace SHADE
// for every character
for (uint32_t i = 0; i < numChars; ++i)
{
SHTextRendererComponent::TextIndexingType index = glyphTransformIndices.at(textComp.text[i]);
SHTextRenderableComponent::TextIndexingType index = glyphTransformIndices.at(textComp.text[i]);
// Copy baseline
SHVec4 characterPos = baselineOrigin;
@ -83,7 +83,7 @@ namespace SHADE
//}
}
textComp.indexingDataBuffer->WriteToMemory(indexingData.data(), static_cast<uint32_t>(indexingData.size()) * sizeof (SHTextRendererComponent::TextIndexingType),0, 0);
textComp.indexingDataBuffer->WriteToMemory(indexingData.data(), static_cast<uint32_t>(indexingData.size()) * sizeof (SHTextRenderableComponent::TextIndexingType),0, 0);
textComp.charPositionDataBuffer->WriteToMemory(charPositionData.data(), static_cast<uint32_t>(charPositionData.size()) * sizeof (SHVec4), 0, 0);
indexingData.clear();
@ -93,7 +93,7 @@ namespace SHADE
void SHTextRenderingSubSystem::Init(Handle<SHVkLogicalDevice> device, Handle<SHVkRenderpass> compatibleRenderpass, Handle<SHSubpass> subpass, Handle<SHVkDescriptorPool> descPool, Handle<SHVkShaderModule> textVS, Handle<SHVkShaderModule> textFS, std::function<void(Handle<SHVkCommandBuffer>, uint32_t)> const& bindFunction) noexcept
{
SHComponentManager::CreateComponentSparseSet<SHTextRendererComponent>();
SHComponentManager::CreateComponentSparseSet<SHTextRenderableComponent>();
cameraDescSetBind = bindFunction;
@ -179,7 +179,7 @@ namespace SHADE
void SHTextRenderingSubSystem::Run(uint32_t frameIndex) noexcept
{
auto& textRendererComps = SHComponentManager::GetDense<SHTextRendererComponent>();
auto& textRendererComps = SHComponentManager::GetDense<SHTextRenderableComponent>();
for (auto& comp : textRendererComps)
{
@ -194,7 +194,7 @@ namespace SHADE
void SHTextRenderingSubSystem::Render(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex) noexcept
{
auto& textRendererComps = SHComponentManager::GetDense<SHTextRendererComponent>();
auto& textRendererComps = SHComponentManager::GetDense<SHTextRenderableComponent>();
for (auto& comp : textRendererComps)
{
auto* transform = SHComponentManager::GetComponent<SHTransformComponent>(comp.GetEID());

View File

@ -14,7 +14,7 @@ namespace SHADE
class SHVkBuffer;
class SHLightComponent;
class SHVkCommandBuffer;
class SHTextRendererComponent;
class SHTextRenderableComponent;
class SHVkPipeline;
class SHVkPipelineLayout;
class SHVkRenderpass;
@ -48,7 +48,7 @@ namespace SHADE
std::function<void(Handle<SHVkCommandBuffer>, uint32_t)> cameraDescSetBind;
private:
void RecomputePositions(SHTextRendererComponent& textComp) noexcept;
void RecomputePositions(SHTextRenderableComponent& textComp) noexcept;
public:
void Init(Handle<SHVkLogicalDevice> device, Handle<SHVkRenderpass> compatibleRenderpass, Handle<SHSubpass> subpass, Handle<SHVkDescriptorPool> descPool, Handle<SHVkShaderModule> textVS, Handle<SHVkShaderModule> textFS, std::function<void(Handle<SHVkCommandBuffer>, uint32_t)> const& bindFunction) noexcept;

View File

@ -211,7 +211,7 @@ namespace SHADE
AddComponentToComponentNode<SHLightComponent>(components, eid);
AddComponentToComponentNode<SHRigidBodyComponent>(components, eid);
AddConvComponentToComponentNode<SHColliderComponent>(components, eid);
AddConvComponentToComponentNode<SHTextRendererComponent>(components, eid);
AddConvComponentToComponentNode<SHTextRenderableComponent>(components, eid);
node[ComponentsNode] = components;
@ -263,7 +263,7 @@ namespace SHADE
AddComponentID<SHRigidBodyComponent>(componentIDList, componentsNode);
AddComponentID<SHLightComponent>(componentIDList, componentsNode);
AddComponentID<SHColliderComponent>(componentIDList, componentsNode);
AddComponentID<SHTextRendererComponent>(componentIDList, componentsNode);
AddComponentID<SHTextRenderableComponent>(componentIDList, componentsNode);
return componentIDList;
}
@ -340,7 +340,7 @@ namespace SHADE
SHSerializationHelper::InitializeComponentFromNode<SHRigidBodyComponent>(componentsNode, eid);
SHSerializationHelper::ConvertNodeToComponent<SHRenderable>(componentsNode, eid);
SHSerializationHelper::ConvertNodeToComponent<SHColliderComponent>(componentsNode, eid);
SHSerializationHelper::ConvertNodeToComponent<SHTextRendererComponent>(componentsNode, eid);
SHSerializationHelper::ConvertNodeToComponent<SHTextRenderableComponent>(componentsNode, eid);
SHSerializationHelper::InitializeComponentFromNode<SHLightComponent>(componentsNode, eid);
}
}

View File

@ -12,7 +12,7 @@
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
#include "SHSerializationTools.h"
#include "Physics/Interface/SHColliderComponent.h"
#include "Graphics/MiddleEnd/TextRendering/SHTextRendererComponent.h"
#include "Graphics/MiddleEnd/TextRendering/SHTextRenderableComponent.h"
#include "Graphics/MiddleEnd/TextRendering/SHFont.h"
namespace YAML
@ -331,12 +331,12 @@ namespace YAML
};
template<>
struct convert<SHTextRendererComponent>
struct convert<SHTextRenderableComponent>
{
static constexpr std::string_view TEXT_YAML_TAG = "Text";
static constexpr std::string_view FONT_YAML_TAG = "Font";
static YAML::Node encode(SHTextRendererComponent const& rhs)
static YAML::Node encode(SHTextRenderableComponent const& rhs)
{
YAML::Node node;
node[TEXT_YAML_TAG.data()] = rhs.GetText();
@ -351,7 +351,7 @@ namespace YAML
}
return node;
}
static bool decode(YAML::Node const& node, SHTextRendererComponent& rhs)
static bool decode(YAML::Node const& node, SHTextRenderableComponent& rhs)
{
if (node[TEXT_YAML_TAG.data()].IsDefined())
{

View File

@ -33,6 +33,8 @@ project "SHADE_Managed"
"%{IncludeDir.imgui}",
"%{IncludeDir.imguizmo}",
"%{IncludeDir.imnodes}",
"%{IncludeDir.msdf_atlas_gen}",
"%{IncludeDir.msdfgen}",
"%{IncludeDir.yamlcpp}",
"%{IncludeDir.SDL}\\include",
"%{IncludeDir.RTTR}/include",
@ -53,6 +55,8 @@ project "SHADE_Managed"
links
{
"yaml-cpp",
"msdfgen",
"msdf-atlas-gen",
"imgui",
"SDL2.lib",
"SDL2main.lib",
@ -89,6 +93,8 @@ project "SHADE_Managed"
dependson
{
"yaml-cpp",
"msdfgen",
"msdf-atlas-gen",
"imgui",
"SHADE_Engine"
}

View File

@ -0,0 +1,32 @@
/************************************************************************************//*!
\file Font.cxx
\author Tng Kah Wei, kahwei.tng, 390009620
\par email: kahwei.tng\@digipen.edu
\date Oct 28, 2022
\brief Contains the implementation of the functions of the managed Font class.
Note: This file is written in C++17/CLI.
Copyright (C) 2022 DigiPen Institute of Technology.
Reproduction or disclosure of this file or its contents without the prior written consent
of DigiPen Institute of Technology is prohibited.
*//*************************************************************************************/
// Precompiled Headers
#include "SHpch.h"
// Primary Header
#include "Font.hxx"
namespace SHADE
{
/*---------------------------------------------------------------------------------*/
/* Explicit Template Instantiation */
/*---------------------------------------------------------------------------------*/
template ref class NativeAsset<SHFont>;
/*---------------------------------------------------------------------------------*/
/* Constructors/Destructor */
/*---------------------------------------------------------------------------------*/
Font::Font(Handle<SHFont> font)
: NativeAsset<SHFont> { font }
{}
}

View File

@ -0,0 +1,41 @@
/************************************************************************************//*!
\file Font.hxx
\author Tng Kah Wei, kahwei.tng, 390009620
\par email: kahwei.tng\@digipen.edu
\date Oct 28, 2022
\brief Contains the definition of the managed Font class.
Note: This file is written in C++17/CLI.
Copyright (C) 2022 DigiPen Institute of Technology.
Reproduction or disclosure of this file or its contents without the prior written consent
of DigiPen Institute of Technology is prohibited.
*//*************************************************************************************/
#pragma once
// External Dependencies
#include "Resource/SHHandle.h"
#include "Graphics/MiddleEnd/TextRendering/SHFont.h"
// Project Includes
#include "NativeAsset.hxx"
#include "Engine/GenericHandle.hxx"
namespace SHADE
{
/// <summary>
/// Managed counterpart of the native Font object that can be fed to TextRenderables
/// for rendering.
/// </summary>
public ref class Font : public NativeAsset<SHFont>
{
internal:
/*-----------------------------------------------------------------------------*/
/* Constructors/Destructor */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Constructor for the Font.
/// </summary>
/// <param name="font">Handle to the font object.</param>
Font(Handle<SHFont> font);
};
}

View File

@ -21,6 +21,17 @@ of DigiPen Institute of Technology is prohibited.
namespace SHADE
{
/*---------------------------------------------------------------------------------*/
/* Explicit Tempalte Instantiations */
/* Properties */
/*---------------------------------------------------------------------------------*/
GenericHandle Asset::NativeObjectHandle::get()
{
return nativeObjHandle;
}
/*---------------------------------------------------------------------------------*/
/* Constructors */
/*---------------------------------------------------------------------------------*/
Asset::Asset(Handle<void> nativeHandle)
: nativeObjHandle { Convert::ToCLI(Handle<void>(nativeHandle)) }
{}
}

View File

@ -16,6 +16,7 @@ of DigiPen Institute of Technology is prohibited.
// Primary Include
#include "NativeAsset.hxx"
#include "Utility/Convert.hxx"
namespace SHADE
{
@ -23,11 +24,6 @@ namespace SHADE
/* Properties */
/*---------------------------------------------------------------------------------*/
template <typename NativeAssetType>
GenericHandle NativeAsset<NativeAssetType>::NativeObjectHandle::get()
{
return nativeObjHandle;
}
template <typename NativeAssetType>
Handle<NativeAssetType> NativeAsset<NativeAssetType>::NativeObject::get()
try
{
@ -43,7 +39,6 @@ namespace SHADE
/*---------------------------------------------------------------------------------*/
template <typename NativeAssetType>
NativeAsset<NativeAssetType>::NativeAsset(Handle<NativeAssetType> nativeObj)
: nativeObjHandle{ Convert::ToCLI(Handle<void>(nativeObj)) }
: Asset { Handle<void>(nativeObj) }
{}
}

View File

@ -19,13 +19,9 @@ of DigiPen Institute of Technology is prohibited.
namespace SHADE
{
/// <summary>
/// Generalised template class for a managed representation of a native asset
/// Abstract base class that all Native Assets will inherit from.
/// </summary>
/// <typeparam name="NativeAssetType">
/// The type of the asset's native representation.
/// </typeparam>
template<typename NativeAssetType>
public ref class NativeAsset
public ref class Asset abstract
{
internal:
/*-----------------------------------------------------------------------------*/
@ -38,6 +34,36 @@ namespace SHADE
{
GenericHandle get();
}
/*-----------------------------------------------------------------------------*/
/* Constructors/Destructor */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Constructor for the asset.
/// </summary>
/// <param name="ptr">Native asset object handle.</param>
Asset(Handle<void> nativeHandle);
protected:
/*-----------------------------------------------------------------------------*/
/* Data Members */
/*-----------------------------------------------------------------------------*/
GenericHandle nativeObjHandle;
};
/// <summary>
/// Generalised template class for a managed representation of a native asset
/// </summary>
/// <typeparam name="NativeAssetType">
/// The type of the asset's native representation.
/// </typeparam>
template<typename NativeAssetType>
public ref class NativeAsset abstract : Asset
{
internal:
/*-----------------------------------------------------------------------------*/
/* Properties */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Copy of the Handle to the native object.
/// </summary>
@ -52,14 +78,8 @@ namespace SHADE
/// <summary>
/// Constructor for the native asset
/// </summary>
/// <param name="ptr">Native asset object.</param>
/// <param name="ptr">Native asset object handle.</param>
NativeAsset(Handle<NativeAssetType> ptr);
protected:
/*-----------------------------------------------------------------------------*/
/* Data Members */
/*-----------------------------------------------------------------------------*/
GenericHandle nativeObjHandle;
};
}

View File

@ -0,0 +1,57 @@
/************************************************************************************//*!
\file TextRenderable.cxx
\author Tng Kah Wei, kahwei.tng, 390009620
\par email: kahwei.tng\@digipen.edu
\date Oct 28, 2022
\brief Contains the definition of the functions of the managed TextRenderable
class.
Note: This file is written in C++17/CLI.
Copyright (C) 2022 DigiPen Institute of Technology.
Reproduction or disclosure of this file or its contents without the prior written consent
of DigiPen Institute of Technology is prohibited.
*//*************************************************************************************/
// Precompiled Headers
#include "SHpch.h"
// Primary Header
#include "TextRenderable.hxx"
#include "Assets/NativeAsset.hxx"
#include "Utility/Convert.hxx"
namespace SHADE
{
/*---------------------------------------------------------------------------------*/
/* Constructors */
/*---------------------------------------------------------------------------------*/
TextRenderable::TextRenderable(Entity entity)
: Component(entity)
{}
/*---------------------------------------------------------------------------------*/
/* Properties */
/*---------------------------------------------------------------------------------*/
System::String^ TextRenderable::Text::get()
{
return Convert::ToCLI(GetNativeComponent()->GetText());
}
void TextRenderable::Text::set(System::String^ value)
{
GetNativeComponent()->SetText(Convert::ToNative(value));
}
SHADE::Font^ TextRenderable::Font::get()
{
return gcnew SHADE::Font(GetNativeComponent()->GetFont());
}
void TextRenderable::Font::set(SHADE::Font^ value)
{
if (value == nullptr)
{
GetNativeComponent()->SetFont(Handle<SHFont>());
}
else
{
GetNativeComponent()->SetFont(Handle<SHFont>(Convert::ToNative(value->NativeObjectHandle)));
}
}
}

View File

@ -0,0 +1,65 @@
/************************************************************************************//*!
\file TextRenderable.hxx
\author Tng Kah Wei, kahwei.tng, 390009620
\par email: kahwei.tng\@digipen.edu
\date Nov 21, 2022
\brief Contains the definition of the managed TextRenderable class with the
declaration of functions for working with it.
Note: This file is written in C++17/CLI.
Copyright (C) 2022 DigiPen Institute of Technology.
Reproduction or disclosure of this file or its contents without the prior written consent
of DigiPen Institute of Technology is prohibited.
*//*************************************************************************************/
#pragma once
// External Dependencies
#include "Graphics/MiddleEnd/TextRendering/SHTextRenderableComponent.h"
// Project Includes
#include "Components/Component.hxx"
#include "Math/Vector3.hxx"
#include "Math/Quaternion.hxx"
#include "Assets/Font.hxx"
namespace SHADE
{
/// <summary>
/// CLR version of the SHADE Engine's SHTextRenderableComponent.
/// </summary>
public ref class TextRenderable : public Component<SHTextRenderableComponent>
{
internal:
/*-----------------------------------------------------------------------------*/
/* Constructors */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Constructs a TextRenderable Component that represents a native TextRenderable
/// component tied to the specified Entity.
/// </summary>
/// <param name="entity">Entity that this Component will be tied to.</param>
TextRenderable(Entity entity);
public:
/*-----------------------------------------------------------------------------*/
/* Properties */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Text to render using this TextRenderable.
/// </summary>
property System::String^ Text
{
System::String^ get();
void set(System::String^ value);
}
/// <summary>
/// Font to use to render using this TextRenderable.
/// </summary>
property SHADE::Font^ Font
{
SHADE::Font^ get();
void set(SHADE::Font^ value);
}
};
}

View File

@ -89,6 +89,8 @@ namespace SHADE
/*---------------------------------------------------------------------------------*/
std::string Convert::ToNative(System::String^ str)
{
if (str == nullptr)
return "";
return msclr::interop::marshal_as<std::string>(str);
}