Added UI Element and other QoL fixes for scripting #329
|
@ -41,6 +41,8 @@ namespace SHADE
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
Asset::operator bool(Asset asset)
|
Asset::operator bool(Asset asset)
|
||||||
{
|
{
|
||||||
|
static_assert(INVALID_ASSET_ID == 0,
|
||||||
|
"This must be 0 due to the way structs are default initialized to ensure Assets are invalid if default constructed.");
|
||||||
return asset.NativeAssetID != INVALID_ASSET_ID;
|
return asset.NativeAssetID != INVALID_ASSET_ID;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -22,7 +22,8 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Struct that contains native asset information.
|
/// Struct that contains native asset information. Default constructed assets have
|
||||||
|
/// an internval value of 0 which is the invalid ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public value struct Asset
|
public value struct Asset
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,34 +30,36 @@ namespace SHADE
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Properties */
|
/* Properties */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
SHADE::MeshAsset^ Renderable::Mesh::get()
|
MeshAsset Renderable::Mesh::get()
|
||||||
{
|
{
|
||||||
return gcnew SHADE::MeshAsset(GetNativeComponent()->GetMesh());
|
auto mesh = GetNativeComponent()->GetMesh();
|
||||||
|
return mesh ? MeshAsset(mesh) : MeshAsset();
|
||||||
}
|
}
|
||||||
void Renderable::Mesh::set(SHADE::MeshAsset^ value)
|
void Renderable::Mesh::set(MeshAsset value)
|
||||||
{
|
{
|
||||||
if (value == nullptr)
|
if (value)
|
||||||
{
|
{
|
||||||
GetNativeComponent()->SetMesh(Handle<SHMesh>());
|
GetNativeComponent()->SetMesh(Handle<SHMesh>());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetNativeComponent()->SetMesh(value->NativeObject);
|
GetNativeComponent()->SetMesh(value.NativeObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SHADE::Material^ Renderable::Material::get()
|
SHADE::Material Renderable::Material::get()
|
||||||
{
|
{
|
||||||
return gcnew SHADE::Material(GetNativeComponent()->GetMaterial());
|
auto mat = GetNativeComponent()->GetMaterial();
|
||||||
|
return mat ? SHADE::Material(mat) : SHADE::Material();
|
||||||
}
|
}
|
||||||
void Renderable::Material::set(SHADE::Material^ value)
|
void Renderable::Material::set(SHADE::Material value)
|
||||||
{
|
{
|
||||||
if (value == nullptr)
|
if (value)
|
||||||
{
|
{
|
||||||
GetNativeComponent()->SetMaterial(Handle<SHMaterialInstance>());
|
GetNativeComponent()->SetMaterial(Handle<SHMaterialInstance>());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetNativeComponent()->SetMaterial(Handle<SHMaterialInstance>(Convert::ToNative(value->NativeObjectHandle)));
|
GetNativeComponent()->SetMaterial(Handle<SHMaterialInstance>(Convert::ToNative(value.NativeObjectHandle)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System::Byte Renderable::LightLayer::get()
|
System::Byte Renderable::LightLayer::get()
|
||||||
|
|
|
@ -49,18 +49,18 @@ namespace SHADE
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Mesh used to render this Renderable.
|
/// Mesh used to render this Renderable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
property SHADE::MeshAsset^ Mesh
|
property MeshAsset Mesh
|
||||||
{
|
{
|
||||||
SHADE::MeshAsset^ get();
|
MeshAsset get();
|
||||||
void set(SHADE::MeshAsset^ value);
|
void set(MeshAsset value);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Material used to render this Renderable.
|
/// Material used to render this Renderable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
property SHADE::Material^ Material
|
property SHADE::Material Material
|
||||||
{
|
{
|
||||||
SHADE::Material^ get();
|
SHADE::Material get();
|
||||||
void set(SHADE::Material^ value);
|
void set(SHADE::Material value);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Material used to render this Renderable.
|
/// Material used to render this Renderable.
|
||||||
|
|
|
@ -39,19 +39,20 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
GetNativeComponent()->SetText(Convert::ToNative(value));
|
GetNativeComponent()->SetText(Convert::ToNative(value));
|
||||||
}
|
}
|
||||||
SHADE::FontAsset^ TextRenderable::Font::get()
|
FontAsset TextRenderable::Font::get()
|
||||||
{
|
{
|
||||||
return gcnew SHADE::FontAsset(GetNativeComponent()->GetFont());
|
auto font = GetNativeComponent()->GetFont();
|
||||||
|
return font ? FontAsset(font) : FontAsset();
|
||||||
}
|
}
|
||||||
void TextRenderable::Font::set(SHADE::FontAsset^ value)
|
void TextRenderable::Font::set(FontAsset value)
|
||||||
{
|
{
|
||||||
if (value == nullptr)
|
if (value)
|
||||||
{
|
{
|
||||||
GetNativeComponent()->SetFont(Handle<SHFont>());
|
GetNativeComponent()->SetFont(Handle<SHFont>());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetNativeComponent()->SetFont(value->NativeObject);
|
GetNativeComponent()->SetFont(value.NativeObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,10 +55,10 @@ namespace SHADE
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Font to use to render using this TextRenderable.
|
/// Font to use to render using this TextRenderable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
property SHADE::FontAsset^ Font
|
property FontAsset Font
|
||||||
{
|
{
|
||||||
SHADE::FontAsset^ get();
|
FontAsset get();
|
||||||
void set(SHADE::FontAsset^ value);
|
void set(FontAsset value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue