Scene changes and Bug fixes #336

Merged
glencelow merged 6 commits from PlayerController into main 2023-02-03 22:08:18 +08:00
18 changed files with 219 additions and 39 deletions
Showing only changes of commit 5284066cee - Show all commits

View File

@ -60,7 +60,7 @@ float CalcShadowValue (sampler2D shadowMap, vec4 worldSpaceFragPos, mat4 lightPV
if (fragPosLightPOV.z > sampledDepth && fragPosLightPOV.w > 0.0f) if (fragPosLightPOV.z > sampledDepth && fragPosLightPOV.w > 0.0f)
{ {
return 0.0f; return 0.7f;
} }
else else
return 1.0f; return 1.0f;

View File

@ -0,0 +1,10 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable
#extension GL_EXT_nonuniform_qualifier : require
void main()
{
}

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: ShadowMap_FS
ID: 45925790
Type: 2

View File

@ -5,6 +5,7 @@
//#define SHEDITOR //#define SHEDITOR
#ifdef SHEDITOR #ifdef SHEDITOR
#include "Editor/SHEditor.h" #include "Editor/SHEditor.h"
#include "Physics/System/SHPhysicsDebugDrawSystem.h"
//#include "Scenes/SBEditorScene.h" //#include "Scenes/SBEditorScene.h"
#endif // SHEDITOR #endif // SHEDITOR
@ -31,7 +32,6 @@
#include "Input/SHInputManager.h" #include "Input/SHInputManager.h"
#include "Math/Transform/SHTransformSystem.h" #include "Math/Transform/SHTransformSystem.h"
#include "Physics/System/SHPhysicsSystem.h" #include "Physics/System/SHPhysicsSystem.h"
#include "Physics/System/SHPhysicsDebugDrawSystem.h"
#include "Scripting/SHScriptEngine.h" #include "Scripting/SHScriptEngine.h"
#include "UI/SHUISystem.h" #include "UI/SHUISystem.h"
#include "Animation/SHAnimationSystem.h" #include "Animation/SHAnimationSystem.h"
@ -74,12 +74,15 @@ namespace Sandbox
#endif #endif
window.Create(hInstance, hPrevInstance, lpCmdLine, nCmdShow, wndData); window.Create(hInstance, hPrevInstance, lpCmdLine, nCmdShow, wndData);
SHAssetManager::Load();
// Create Systems // Create Systems
SHSystemManager::CreateSystem<SHScriptEngine>(); SHSystemManager::CreateSystem<SHScriptEngine>();
SHSystemManager::CreateSystem<SHTransformSystem>(); SHSystemManager::CreateSystem<SHTransformSystem>();
SHSystemManager::CreateSystem<SHPhysicsSystem>(); SHSystemManager::CreateSystem<SHPhysicsSystem>();
#ifndef _PUBLISH #ifdef SHEDITOR
SHSystemManager::CreateSystem<SHPhysicsDebugDrawSystem>(); SHSystemManager::CreateSystem<SHPhysicsDebugDrawSystem>();
#endif #endif
@ -122,7 +125,7 @@ namespace Sandbox
SHSystemManager::RegisterRoutine<SHPhysicsSystem, SHPhysicsSystem::PhysicsUpdate>(); SHSystemManager::RegisterRoutine<SHPhysicsSystem, SHPhysicsSystem::PhysicsUpdate>();
SHSystemManager::RegisterRoutine<SHPhysicsSystem, SHPhysicsSystem::PhysicsPostUpdate>(); SHSystemManager::RegisterRoutine<SHPhysicsSystem, SHPhysicsSystem::PhysicsPostUpdate>();
#ifndef _PUBLISH #ifdef SHEDITOR
SHSystemManager::RegisterRoutine<SHPhysicsDebugDrawSystem, SHPhysicsDebugDrawSystem::PhysicsDebugDraw>(); SHSystemManager::RegisterRoutine<SHPhysicsDebugDrawSystem, SHPhysicsDebugDrawSystem::PhysicsDebugDraw>();
#endif #endif
@ -155,7 +158,6 @@ namespace Sandbox
SHComponentManager::CreateComponentSparseSet<SHAnimatorComponent>(); SHComponentManager::CreateComponentSparseSet<SHAnimatorComponent>();
//SHComponentManager::CreateComponentSparseSet<SHCameraComponent>(); //SHComponentManager::CreateComponentSparseSet<SHCameraComponent>();
SHAssetManager::Load();
//auto font = SHAssetManager::GetData<SHFontAsset>(176667660); //auto font = SHAssetManager::GetData<SHFontAsset>(176667660);
SHSystemManager::RegisterRoutine<SHAudioSystem, SHAudioSystem::AudioRoutine>(); SHSystemManager::RegisterRoutine<SHAudioSystem, SHAudioSystem::AudioRoutine>();

View File

@ -200,7 +200,9 @@ namespace SHADE
void SHAudioSystem::ErrorCheck() const void SHAudioSystem::ErrorCheck() const
{ {
if (result != FMOD_OK) if (result != FMOD_OK)
std::cerr << "Audio system error: " << FMOD_ErrorString(result) << std::endl; {
SHLOG_ERROR( "Audio system error: {}", FMOD_ErrorString(result))
}
} }
void SHAudioSystem::PlayEventOnce(const char* path, bool isSFX, EntityID eid, bool spatial) void SHAudioSystem::PlayEventOnce(const char* path, bool isSFX, EntityID eid, bool spatial)
@ -319,6 +321,15 @@ namespace SHADE
if (channel->isPlaying(&isPlaying) == FMOD_OK && isPlaying) if (channel->isPlaying(&isPlaying) == FMOD_OK && isPlaying)
channel->stop(); channel->stop();
} }
auto [begin, end] = audioClipLibrary.GetDenseAccess();
for (auto it = begin; it != end; ++it)
{
if (it->instance)
{
it->instance->stop(FMOD_STUDIO_STOP_MODE::FMOD_STUDIO_STOP_IMMEDIATE);
it->instance->release();
}
}
masterGroup->stop(); masterGroup->stop();
} }
@ -349,6 +360,10 @@ namespace SHADE
audioClipHandle = audioClipLibrary.Create(); audioClipHandle = audioClipLibrary.Create();
it->second->createInstance(&audioClipHandle->instance); it->second->createInstance(&audioClipHandle->instance);
} }
else
{
SHLOG_ERROR("FMOD: Failed to find event path: {}", path)
}
return audioClipHandle; return audioClipHandle;
} }
@ -487,10 +502,12 @@ namespace SHADE
} }
void SHAudioSystem::SetBgmVolume(float const bgmvol) void SHAudioSystem::SetBgmVolume(float const bgmvol)
{ {
bgmVolume = bgmvol;
bgmChannelGroup->setVolume(bgmvol); bgmChannelGroup->setVolume(bgmvol);
} }
void SHAudioSystem::SetSfxVolume(float const sfxvol) void SHAudioSystem::SetSfxVolume(float const sfxvol)
{ {
sfxVolume = sfxvol;
sfxChannelGroup->setVolume(sfxvol); sfxChannelGroup->setVolume(sfxvol);
} }
void SHAudioSystem::SetMasterVolume(float const mastervol) void SHAudioSystem::SetMasterVolume(float const mastervol)
@ -506,15 +523,12 @@ namespace SHADE
{ {
channel->setPaused(paused); channel->setPaused(paused);
} }
for (auto const& event : eventMap) auto [begin, end] = audioClipLibrary.GetDenseAccess();
for (auto it = begin; it != end; ++it)
{ {
int instanceCount = 0; if (it->instance)
event.second->getInstanceCount(&instanceCount);
std::vector<FMOD::Studio::EventInstance*> instances(instanceCount);
event.second->getInstanceList(instances.data(), static_cast<int>(instances.size()), &instanceCount);
for (auto const& instance : instances)
{ {
instance->setPaused(pause); it->SetPause(pause);
} }
} }
} }
@ -546,6 +560,7 @@ namespace SHADE
bank->loadSampleData(); bank->loadSampleData();
int numOfEvents; int numOfEvents;
bank->getEventCount(&numOfEvents); bank->getEventCount(&numOfEvents);
if (numOfEvents > 0) if (numOfEvents > 0)
{ {
std::vector<FMOD::Studio::EventDescription*> events(numOfEvents); std::vector<FMOD::Studio::EventDescription*> events(numOfEvents);
@ -560,11 +575,71 @@ namespace SHADE
} }
} }
float SHAudioSystem::GetVCAVolume(const char* path)
{
FMOD::Studio::VCA* vca = nullptr;
result = fmodStudioSystem->getVCA(path, &vca);
float volume = 0.0f;
if (result != FMOD_OK)
{
ErrorCheck();
return volume;
}
result = vca->getVolume(&volume);
if (result != FMOD_OK)
{
ErrorCheck();
return volume;
}
return volume;
}
void SHAudioSystem::SetVCAVolume(const char* path, float value)
{
FMOD::Studio::VCA* vca = nullptr;
result = fmodStudioSystem->getVCA(path, &vca);
if (result != FMOD_OK)
{
ErrorCheck();
return;
}
result = vca->setVolume(std::clamp(value, 0.0f, 1.0f));
if (result != FMOD_OK)
{
ErrorCheck();
return;
}
}
float SHAudioSystem::GetParameterValue(const char* path)
{
float value = {};
result = fmodStudioSystem->getParameterByName(path, &value);
if(result != FMOD_OK)
{
ErrorCheck();
}
return value;
}
void SHAudioSystem::SetParameter(const char* path, float value)
{
result = fmodStudioSystem->setParameterByName(path, value);
if (result != FMOD_OK)
{
ErrorCheck();
}
}
void AudioClip::Play() void AudioClip::Play()
{ {
if(!instance) if(!instance)
return; return;
instance->start(); FMOD_RESULT result = instance->start();
if (result != FMOD_OK)
{
SHLOG_ERROR("Audio system error: {}", FMOD_ErrorString(result))
}
} }
//void AudioClip::Play(bool isSfx) //void AudioClip::Play(bool isSfx)
@ -598,7 +673,11 @@ namespace SHADE
{ {
if (!instance) if (!instance)
return; return;
instance->stop(fadeOut ? FMOD_STUDIO_STOP_ALLOWFADEOUT : FMOD_STUDIO_STOP_IMMEDIATE); FMOD_RESULT result = instance->stop(fadeOut ? FMOD_STUDIO_STOP_ALLOWFADEOUT : FMOD_STUDIO_STOP_IMMEDIATE);
if (result != FMOD_OK)
{
SHLOG_ERROR("Audio system error: {}", FMOD_ErrorString(result))
}
} }
void AudioClip::SetPause(bool pause) void AudioClip::SetPause(bool pause)
@ -623,7 +702,11 @@ namespace SHADE
{ {
if (!instance) if (!instance)
return; return;
instance->setParameterByName(paramName, value); FMOD_RESULT result = instance->setParameterByName(paramName, value);
if (result != FMOD_OK)
{
SHLOG_ERROR("Audio system error: {}", FMOD_ErrorString(result))
}
} }
//void AudioClip::SetParameterLabel(const char* paramName, const char* label) //void AudioClip::SetParameterLabel(const char* paramName, const char* label)
@ -635,11 +718,31 @@ namespace SHADE
float AudioClip::GetParameterValue(const char* paramName) float AudioClip::GetParameterValue(const char* paramName)
{ {
if (!instance)
return {};
float value{}; float value{};
instance->getParameterByName(paramName, &value); if (!instance)
return value; return value;
auto result = instance->getParameterByName(paramName, &value);
if (result != FMOD_OK)
{
SHLOG_ERROR("Audio system error: {}", FMOD_ErrorString(result))
}
return value;
}
float AudioClip::GetVolume()
{
float volume{};
if(!instance)
return volume;
instance->getVolume(&volume);
return volume;
}
void AudioClip::SetVolume(float volume)
{
if(!instance)
return;
instance->setVolume(volume);
} }
SHEventHandle SHAudioSystem::onStop(SHEventPtr onStopEvent) SHEventHandle SHAudioSystem::onStop(SHEventPtr onStopEvent)

View File

@ -35,6 +35,8 @@ namespace SHADE
void SetParameter(const char* paramName, float value); void SetParameter(const char* paramName, float value);
//void SetParameterLabel(const char* paramName, const char* label); //void SetParameterLabel(const char* paramName, const char* label);
float GetParameterValue(const char* paramName); float GetParameterValue(const char* paramName);
float GetVolume();
void SetVolume(float volume);
friend class SHAudioSystem; friend class SHAudioSystem;
private: private:
FMOD::Studio::EventInstance* instance = nullptr; FMOD::Studio::EventInstance* instance = nullptr;
@ -85,7 +87,13 @@ namespace SHADE
void SetPaused(bool pause); void SetPaused(bool pause);
bool GetPaused() const; bool GetPaused() const;
SHVec3 GetListenerPosition(); SHVec3 GetListenerPosition();
void LoadBank(const char* path); void LoadBank(const char* path);
float GetVCAVolume(const char* path);
void SetVCAVolume(const char* path, float value);
float GetParameterValue(const char* path);
void SetParameter(const char* path, float value);
private: private:
FMOD::Studio::System* fmodStudioSystem; FMOD::Studio::System* fmodStudioSystem;

View File

@ -94,7 +94,7 @@ namespace SHADE
if (systemContainer.find(id) == systemContainer.end()) if (systemContainer.find(id) == systemContainer.end())
{ {
std::cout << "System Manager error: System Version " << version << " does not exit." << std::endl; std::cout << "System Manager error: System Version " << typeid(T).name() << ", " << version << " does not exist." << std::endl;
return nullptr; return nullptr;
} }

View File

@ -128,6 +128,7 @@ namespace SHADE
SHFreetypeInstance::Init(); SHFreetypeInstance::Init();
//SHAssetManager::CompileAsset("../../Assets/Shaders/DeferredComposite_CS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/DeferredComposite_CS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/ShadowMap_FS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/SSAO_CS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/SSAO_CS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/SSAOBlur_CS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/SSAOBlur_CS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/PureCopy_CS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/PureCopy_CS.glsl", false);
@ -137,6 +138,7 @@ namespace SHADE
//SHAssetManager::CompileAsset("../../Assets/Shaders/UI_FS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/UI_FS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/Text_VS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/Text_VS.glsl", false);
// Load Built In Shaders // Load Built In Shaders
static constexpr AssetID VS_DEFAULT = 39210065; defaultVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEFAULT); static constexpr AssetID VS_DEFAULT = 39210065; defaultVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEFAULT);
static constexpr AssetID VS_ANIM = 47911992; animtVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_ANIM); static constexpr AssetID VS_ANIM = 47911992; animtVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_ANIM);
@ -152,6 +154,7 @@ namespace SHADE
static constexpr AssetID RENDER_SC_VS = 48082949; renderToSwapchainVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(RENDER_SC_VS); static constexpr AssetID RENDER_SC_VS = 48082949; renderToSwapchainVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(RENDER_SC_VS);
static constexpr AssetID RENDER_SC_FS = 36869006; renderToSwapchainFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(RENDER_SC_FS); static constexpr AssetID RENDER_SC_FS = 36869006; renderToSwapchainFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(RENDER_SC_FS);
static constexpr AssetID SHADOW_MAP_VS = 44646107; shadowMapVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_MAP_VS); static constexpr AssetID SHADOW_MAP_VS = 44646107; shadowMapVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_MAP_VS);
static constexpr AssetID SHADOW_MAP_FS = 45925790; shadowMapFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_MAP_FS);
} }
@ -583,14 +586,21 @@ namespace SHADE
#endif #endif
} }
//if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::B)) static bool shadowAdded = false;
if (shadowAdded == false/* && SHInputManager::GetKey(SHInputManager::SH_KEYCODE::B)*/)
{
shadowAdded = true;
auto& lightComps = SHComponentManager::GetDense<SHLightComponent>();
if (lightComps.size() > 2)
{
lightComps[2].SetEnableShadow(true);
}
//for (auto& comp : lightComps)
//{ //{
// auto& lightComps = SHComponentManager::GetDense<SHLightComponent>();
// for (auto& comp : lightComps)
// {
// comp.SetEnableShadow(true); // comp.SetEnableShadow(true);
// }
//} //}
}
renderGraph->Begin(frameIndex); renderGraph->Begin(frameIndex);
auto cmdBuffer = renderGraph->GetCommandBuffer(frameIndex); auto cmdBuffer = renderGraph->GetCommandBuffer(frameIndex);
@ -809,11 +819,11 @@ namespace SHADE
tempLibrary.Init(device); tempLibrary.Init(device);
tempLibrary.CreateGraphicsPipelines tempLibrary.CreateGraphicsPipelines
( (
{ shadowMapVS, {} }, shadowMapNode->GetRenderpass(), newSubpass, { shadowMapVS, shadowMapFS }, shadowMapNode->GetRenderpass(), newSubpass,
SHGraphicsPredefinedData::SystemType::BATCHING, SHGraphicsPredefinedData::SystemType::BATCHING,
SHGraphicsPredefinedData::GetShadowMapViState(), rasterState SHGraphicsPredefinedData::GetShadowMapViState(), rasterState
); );
shadowMapPipeline = tempLibrary.GetGraphicsPipeline({ shadowMapVS, {} }); shadowMapPipeline = tempLibrary.GetGraphicsPipeline({ shadowMapVS, shadowMapFS });
} }
newSubpass->SetCompanionSubpass(companionSubpass, shadowMapPipeline); // set companion subpass and pipeline newSubpass->SetCompanionSubpass(companionSubpass, shadowMapPipeline); // set companion subpass and pipeline

View File

@ -469,6 +469,7 @@ namespace SHADE
Handle<SHVkShaderModule> renderToSwapchainVS; Handle<SHVkShaderModule> renderToSwapchainVS;
Handle<SHVkShaderModule> renderToSwapchainFS; Handle<SHVkShaderModule> renderToSwapchainFS;
Handle<SHVkShaderModule> shadowMapVS; Handle<SHVkShaderModule> shadowMapVS;
Handle<SHVkShaderModule> shadowMapFS;
// Fonts // Fonts
Handle<SHFont> testFont; Handle<SHFont> testFont;

View File

@ -170,10 +170,7 @@ namespace SHADE
SHCollisionListener collisionListener; SHCollisionListener collisionListener;
SHRaycaster raycaster; SHRaycaster raycaster;
// For the debug drawer to draw rays
#ifdef SHEDITOR
std::vector<RaycastHit> raycastHits; std::vector<RaycastHit> raycastHits;
#endif
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* Function Members */ /* Function Members */

View File

@ -62,9 +62,9 @@ namespace SHADE
loadFunctions(); loadFunctions();
// Generate script assembly if it hasn't been before // Generate script assembly if it hasn't been before
#ifndef _PUBLISH #ifndef _PUBLISH
BuildScriptAssembly(); BuildScriptAssembly();
#endif #endif
// Initialise the CSharp Engine // Initialise the CSharp Engine
csEngineInit(); csEngineInit();
@ -261,6 +261,7 @@ namespace SHADE
<TargetFramework>net5.0</TargetFramework>\n\ <TargetFramework>net5.0</TargetFramework>\n\
<Platforms>x64</Platforms>\n\ <Platforms>x64</Platforms>\n\
<Configurations>Release;Debug</Configurations>\n\ <Configurations>Release;Debug</Configurations>\n\
<DefaultItemExcludes>$(DefaultItemExcludes);**/*.shmeta</DefaultItemExcludes>\n\
</PropertyGroup>\n\ </PropertyGroup>\n\
<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n\ <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n\
<OutputPath>.\\bin\\Release</OutputPath>\n\ <OutputPath>.\\bin\\Release</OutputPath>\n\
@ -283,7 +284,6 @@ namespace SHADE
<ItemGroup>\n\ <ItemGroup>\n\
<None Remove=\".gitignore\" />\n\ <None Remove=\".gitignore\" />\n\
<None Remove=\".gitmodules\" />\n\ <None Remove=\".gitmodules\" />\n\
<None Remove=\"*.shmeta\" />\n\
</ItemGroup>\n\ </ItemGroup>\n\
<ItemGroup>\n\ <ItemGroup>\n\
<Reference Include=\"SHADE_Managed\">\n"; <Reference Include=\"SHADE_Managed\">\n";

View File

@ -99,6 +99,31 @@ namespace SHADE
audioSys->StopAllSounds(); audioSys->StopAllSounds();
} }
float Audio::GetVCAVolume(System::String^ path)
{
auto audioSys = SHSystemManager::GetSystem<SHAudioSystem>();
return audioSys->GetVCAVolume(Convert::ToNative(path).data());
}
void Audio::SetVCAVolume(System::String^ path, float volume)
{
auto audioSys = SHSystemManager::GetSystem<SHAudioSystem>();
audioSys->SetVCAVolume(Convert::ToNative(path).data(), volume);
}
float Audio::GetParameterValue(System::String^ path)
{
auto audioSys = SHSystemManager::GetSystem<SHAudioSystem>();
return audioSys->GetParameterValue(Convert::ToNative(path).data());
}
void Audio::SetParameter(System::String^ path, float value)
{
auto audioSys = SHSystemManager::GetSystem<SHAudioSystem>();
audioSys->SetParameter(Convert::ToNative(path).data(), value);
}
AudioClipHandler Audio::CreateAudioClip(System::String^ path) AudioClipHandler Audio::CreateAudioClip(System::String^ path)
{ {
auto audioSys = SHSystemManager::GetSystem<SHAudioSystem>(); auto audioSys = SHSystemManager::GetSystem<SHAudioSystem>();

View File

@ -101,6 +101,10 @@ namespace SHADE
/// </summary> /// </summary>
static void StopAllSounds(); static void StopAllSounds();
static float GetVCAVolume(System::String^ path);
static void SetVCAVolume(System::String^ path, float volume);
static float GetParameterValue(System::String^ path);
static void SetParameter(System::String^ path, float value);
//to comment ltr //to comment ltr
static AudioClipHandler CreateAudioClip(System::String^ path); static AudioClipHandler CreateAudioClip(System::String^ path);

View File

@ -84,6 +84,14 @@ namespace SHADE
return NativeObject->GetParameterValue(Convert::ToNative(paramName).data()); return NativeObject->GetParameterValue(Convert::ToNative(paramName).data());
} }
float AudioClipHandler::GetVolume()
{
return NativeObject->GetVolume();
}
void AudioClipHandler::SetVolume(float volume)
{
NativeObject->SetVolume(volume);
}
} }

View File

@ -72,6 +72,8 @@ namespace SHADE
bool IsPaused(); bool IsPaused();
void SetParameter(System::String^ paramName, float value); void SetParameter(System::String^ paramName, float value);
float GetParameterValue(System::String^ paramName); float GetParameterValue(System::String^ paramName);
float GetVolume();
void SetVolume(float volume);
protected: protected:
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/

View File

@ -28,25 +28,32 @@ namespace SHADE
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
bool Application::IsPlaying::get() bool Application::IsPlaying::get()
{ {
#ifdef SHEDITOR
auto editor = SHSystemManager::GetSystem<SHEditor>(); auto editor = SHSystemManager::GetSystem<SHEditor>();
if (editor) if (editor)
return editor->editorState == SHEditor::State::PLAY return editor->editorState == SHEditor::State::PLAY
|| ||
editor->editorState == SHEditor::State::PAUSE; editor->editorState == SHEditor::State::PAUSE;
#endif
return true; return true;
} }
bool Application::IsPaused::get() bool Application::IsPaused::get()
{ {
#ifdef SHEDITOR
auto editor = SHSystemManager::GetSystem<SHEditor>(); auto editor = SHSystemManager::GetSystem<SHEditor>();
if (editor) if (editor)
return editor->editorState == SHEditor::State::PAUSE; return editor->editorState == SHEditor::State::PAUSE;
#endif
return false; return false;
} }
bool Application::IsEditor::get() bool Application::IsEditor::get()
{ {
#ifdef SHEDITOR
return SHSystemManager::GetSystem<SHEditor>() != nullptr; return SHSystemManager::GetSystem<SHEditor>() != nullptr;
#else
return false;
#endif
} }
int Application::WindowWidth::get() int Application::WindowWidth::get()
{ {