Merge branch 'main' into SP3-141-Camera-System
This commit is contained in:
commit
b017618373
|
@ -28,16 +28,19 @@ namespace SHADE
|
||||||
void SHButtonComponent::SetDefaultTexture(AssetID texture) noexcept
|
void SHButtonComponent::SetDefaultTexture(AssetID texture) noexcept
|
||||||
{
|
{
|
||||||
defaultTexture = texture;
|
defaultTexture = texture;
|
||||||
|
SHResourceManager::LoadOrGet<SHTexture>(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHButtonComponent::SetHoveredTexture(AssetID texture) noexcept
|
void SHButtonComponent::SetHoveredTexture(AssetID texture) noexcept
|
||||||
{
|
{
|
||||||
hoveredTexture = texture;
|
hoveredTexture = texture;
|
||||||
|
SHResourceManager::LoadOrGet<SHTexture>(texture);\
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHButtonComponent::SetClickedTexture(AssetID texture) noexcept
|
void SHButtonComponent::SetClickedTexture(AssetID texture) noexcept
|
||||||
{
|
{
|
||||||
clickedTexture = texture;
|
clickedTexture = texture;
|
||||||
|
SHResourceManager::LoadOrGet<SHTexture>(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "SHpch.h"
|
#include "SHpch.h"
|
||||||
#include "SHToggleButtonComponent.h"
|
#include "SHToggleButtonComponent.h"
|
||||||
|
#include "Resource/SHResourceManager.h"
|
||||||
|
#include "Graphics/MiddleEnd/Textures/SHTextureLibrary.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -28,11 +29,13 @@ namespace SHADE
|
||||||
void SHToggleButtonComponent::SetDefaultTexture(AssetID texture) noexcept
|
void SHToggleButtonComponent::SetDefaultTexture(AssetID texture) noexcept
|
||||||
{
|
{
|
||||||
defaultTexture = texture;
|
defaultTexture = texture;
|
||||||
|
SHResourceManager::LoadOrGet<SHTexture>(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHToggleButtonComponent::SetToggledTexture(AssetID texture) noexcept
|
void SHToggleButtonComponent::SetToggledTexture(AssetID texture) noexcept
|
||||||
{
|
{
|
||||||
toggledTexture = texture;
|
toggledTexture = texture;
|
||||||
|
SHResourceManager::LoadOrGet<SHTexture>(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHToggleButtonComponent::SetValue(bool value) noexcept
|
void SHToggleButtonComponent::SetValue(bool value) noexcept
|
||||||
|
|
|
@ -313,8 +313,8 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
auto material = renderable->GetModifiableMaterial();
|
auto material = renderable->GetModifiableMaterial();
|
||||||
comp.currentTexture = textureID;
|
comp.currentTexture = textureID;
|
||||||
material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>(textureID));
|
material->SetProperty("data.textureIndex", SHResourceManager::Get<SHTexture>(textureID)->TextureArrayIndex);
|
||||||
loadTexture = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -368,8 +368,8 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
auto material = renderable->GetModifiableMaterial();
|
auto material = renderable->GetModifiableMaterial();
|
||||||
comp.currentTexture = textureID;
|
comp.currentTexture = textureID;
|
||||||
material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>(textureID));
|
material->SetProperty("data.textureIndex", SHResourceManager::Get<SHTexture>(textureID)->TextureArrayIndex);
|
||||||
loadTexture = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -381,6 +381,8 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
SHUISystem* system = (SHUISystem*)GetSystem();
|
SHUISystem* system = (SHUISystem*)GetSystem();
|
||||||
auto& dense = SHComponentManager::GetDense<SHButtonComponent>();
|
auto& dense = SHComponentManager::GetDense<SHButtonComponent>();
|
||||||
|
//We ensure that the textures are loaded before we do the update.
|
||||||
|
SHResourceManager::FinaliseChanges();
|
||||||
for (auto& comp : dense)
|
for (auto& comp : dense)
|
||||||
{
|
{
|
||||||
if (SHSceneManager::CheckNodeAndComponentsActive<SHButtonComponent>(comp.GetEID()))
|
if (SHSceneManager::CheckNodeAndComponentsActive<SHButtonComponent>(comp.GetEID()))
|
||||||
|
@ -393,11 +395,6 @@ namespace SHADE
|
||||||
if (SHSceneManager::CheckNodeAndComponentsActive<SHToggleButtonComponent>(comp.GetEID()))
|
if (SHSceneManager::CheckNodeAndComponentsActive<SHToggleButtonComponent>(comp.GetEID()))
|
||||||
system->UpdateToggleButtonComponent(comp);
|
system->UpdateToggleButtonComponent(comp);
|
||||||
}
|
}
|
||||||
if (system->loadTexture == true)
|
|
||||||
{
|
|
||||||
system->loadTexture = false;
|
|
||||||
SHResourceManager::FinaliseChanges();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SHVec2 SHUISystem::CanvasToScreenPoint(SHVec2& const canvasPoint, bool normalized) noexcept
|
SHVec2 SHUISystem::CanvasToScreenPoint(SHVec2& const canvasPoint, bool normalized) noexcept
|
||||||
|
|
Loading…
Reference in New Issue