Added UI Element and other QoL fixes for scripting #329
|
@ -41,6 +41,8 @@ namespace SHADE
|
|||
/*---------------------------------------------------------------------------------*/
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -22,7 +22,8 @@ of DigiPen Institute of Technology is prohibited.
|
|||
namespace SHADE
|
||||
{
|
||||
/// <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>
|
||||
public value struct Asset
|
||||
{
|
||||
|
|
|
@ -30,34 +30,36 @@ namespace SHADE
|
|||
/*---------------------------------------------------------------------------------*/
|
||||
/* 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>());
|
||||
}
|
||||
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>());
|
||||
}
|
||||
else
|
||||
{
|
||||
GetNativeComponent()->SetMaterial(Handle<SHMaterialInstance>(Convert::ToNative(value->NativeObjectHandle)));
|
||||
GetNativeComponent()->SetMaterial(Handle<SHMaterialInstance>(Convert::ToNative(value.NativeObjectHandle)));
|
||||
}
|
||||
}
|
||||
System::Byte Renderable::LightLayer::get()
|
||||
|
|
|
@ -49,18 +49,18 @@ namespace SHADE
|
|||
/// <summary>
|
||||
/// Mesh used to render this Renderable.
|
||||
/// </summary>
|
||||
property SHADE::MeshAsset^ Mesh
|
||||
property MeshAsset Mesh
|
||||
{
|
||||
SHADE::MeshAsset^ get();
|
||||
void set(SHADE::MeshAsset^ value);
|
||||
MeshAsset get();
|
||||
void set(MeshAsset value);
|
||||
}
|
||||
/// <summary>
|
||||
/// Material used to render this Renderable.
|
||||
/// </summary>
|
||||
property SHADE::Material^ Material
|
||||
property SHADE::Material Material
|
||||
{
|
||||
SHADE::Material^ get();
|
||||
void set(SHADE::Material^ value);
|
||||
SHADE::Material get();
|
||||
void set(SHADE::Material value);
|
||||
}
|
||||
/// <summary>
|
||||
/// Material used to render this Renderable.
|
||||
|
|
|
@ -39,19 +39,20 @@ namespace SHADE
|
|||
{
|
||||
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>());
|
||||
}
|
||||
else
|
||||
{
|
||||
GetNativeComponent()->SetFont(value->NativeObject);
|
||||
GetNativeComponent()->SetFont(value.NativeObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,10 +55,10 @@ namespace SHADE
|
|||
/// <summary>
|
||||
/// Font to use to render using this TextRenderable.
|
||||
/// </summary>
|
||||
property SHADE::FontAsset^ Font
|
||||
property FontAsset Font
|
||||
{
|
||||
SHADE::FontAsset^ get();
|
||||
void set(SHADE::FontAsset^ value);
|
||||
FontAsset get();
|
||||
void set(FontAsset value);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue