Merge branch 'main' into SP3-5-ECS

This commit is contained in:
maverickdgg 2022-09-15 12:18:20 +08:00
commit 7900c52984
28 changed files with 724 additions and 149 deletions

View File

@ -8,15 +8,15 @@ echo "A - All"
echo "B - VMA" echo "B - VMA"
echo "C - msdf" echo "C - msdf"
echo "D - assimp" echo "D - assimp"
echo "E - ktx" echo "E - spdlog"
echo "F - spdlog" echo "F - reactphysics3d"
echo "G - reactphysics3d" echo "G - imgui"
echo "H - imgui" echo "H - imguizmo"
echo "I - imguizmo" echo "I - imnodes"
echo "J - imnodes" echo "J - tracy"
echo "K - tracy" echo "K - RTTR"
echo "L - RTTR" echo "L - yamlcpp"
echo "M - yamlcpp" echo "M - SDL"
echo --------------------------------------------------- echo ---------------------------------------------------
echo. echo.
@ -27,15 +27,15 @@ if %_e%==1 goto VMA
if %_e%==2 goto VMA if %_e%==2 goto VMA
if %_e%==3 goto MSDF if %_e%==3 goto MSDF
if %_e%==4 goto assimp if %_e%==4 goto assimp
if %_e%==5 goto ktx if %_e%==5 goto spdlog
if %_e%==6 goto spdlog if %_e%==6 goto reactphysics3d
if %_e%==7 goto reactphysics3d if %_e%==7 goto imgui
if %_e%==8 goto imgui if %_e%==8 goto imguizmo
if %_e%==9 goto imguizmo if %_e%==9 goto imnodes
if %_e%==10 goto imnodes if %_e%==10 goto tracy
if %_e%==11 goto tracy if %_e%==11 goto RTTR
if %_e%==12 goto RTTR if %_e%==12 goto yamlcpp
if %_e%==13 goto yamlcpp if %_e%==13 goto SDL
:VMA :VMA
echo -----------------------VMA---------------------------- echo -----------------------VMA----------------------------
@ -55,58 +55,71 @@ rmdir "Dependencies/assimp" /S /Q
git clone https://github.com/SHADE-DP/assimp.git "Dependencies/assimp" git clone https://github.com/SHADE-DP/assimp.git "Dependencies/assimp"
if %_e%==4 (goto :done) else (goto :ktx) if %_e%==4 (goto :done) else (goto :ktx)
:ktx @REM :ktx
rmdir "Dependencies/ktx" /S /Q @REM rmdir "Dependencies/ktx" /S /Q
echo -----------------------ktx---------------------------- @REM echo -----------------------ktx----------------------------
git clone https://github.com/SHADE-DP/ktx.git "Dependencies/ktx" @REM git clone https://github.com/SHADE-DP/ktx.git "Dependencies/ktx"
if %_e%==5 (goto :done) else (goto :spdlog) @REM if %_e%==5 (goto :done) else (goto :spdlog)
:spdlog :spdlog
echo -----------------------spdlog---------------------------- echo -----------------------spdlog----------------------------
rmdir "Dependencies/spdlog" /S /Q rmdir "Dependencies/spdlog" /S /Q
git clone https://github.com/SHADE-DP/spdlog.git "Dependencies/spdlog" git clone https://github.com/SHADE-DP/spdlog.git "Dependencies/spdlog"
if %_e%==6 (goto :done) else (goto :reactphysics3d) if %_e%==5 (goto :done) else (goto :reactphysics3d)
:reactphysics3d :reactphysics3d
echo -----------------------reactphysics3d---------------------------- echo -----------------------reactphysics3d----------------------------
rmdir "Dependencies/reactphysics3d" /S /Q rmdir "Dependencies/reactphysics3d" /S /Q
git clone https://github.com/SHADE-DP/reactphysics3d.git "Dependencies/reactphysics3d" git clone https://github.com/SHADE-DP/reactphysics3d.git "Dependencies/reactphysics3d"
if %_e%==7 (goto :done) else (goto :imgui) if %_e%==6 (goto :done) else (goto :imgui)
:imgui :imgui
echo -----------------------imgui---------------------------- echo -----------------------imgui----------------------------
rmdir "Dependencies/imgui" /S /Q rmdir "Dependencies/imgui" /S /Q
git clone https://github.com/SHADE-DP/imgui.git "Dependencies/imgui" git clone https://github.com/SHADE-DP/imgui.git "Dependencies/imgui"
if %_e%==8 (goto :done) else (goto :imguizmo) if %_e%==7 (goto :done) else (goto :imguizmo)
:imguizmo :imguizmo
echo -----------------------imguizmo---------------------------- echo -----------------------imguizmo----------------------------
rmdir "Dependencies/imguizmo" /S /Q rmdir "Dependencies/imguizmo" /S /Q
git clone https://github.com/SHADE-DP/ImGuizmo.git "Dependencies/imguizmo" git clone https://github.com/SHADE-DP/ImGuizmo.git "Dependencies/imguizmo"
if %_e%==9 (goto :done) else (goto :imnodes) if %_e%==8 (goto :done) else (goto :imnodes)
:imnodes :imnodes
echo -----------------------imnodes---------------------------- echo -----------------------imnodes----------------------------
rmdir "Dependencies/imnodes" /S /Q rmdir "Dependencies/imnodes" /S /Q
git clone https://github.com/SHADE-DP/imnodes.git "Dependencies/imnodes" git clone https://github.com/SHADE-DP/imnodes.git "Dependencies/imnodes"
if %_e%==10 (goto :done) else (goto :tracy) if %_e%==9 (goto :done) else (goto :tracy)
:tracy :tracy
echo -----------------------tracy---------------------------- echo -----------------------tracy----------------------------
rmdir "Dependencies/tracy" /S /Q rmdir "Dependencies/tracy" /S /Q
git clone https://github.com/SHADE-DP/tracy.git "Dependencies/tracy" git clone https://github.com/SHADE-DP/tracy.git "Dependencies/tracy"
if %_e%==11 (goto :done) else (goto :RTTR) if %_e%==10 (goto :done) else (goto :RTTR)
:RTTR :RTTR
echo -----------------------RTTR---------------------------- echo -----------------------RTTR----------------------------
rmdir "Dependencies/RTTR" /S /Q rmdir "Dependencies/RTTR" /S /Q
git clone https://github.com/SHADE-DP/RTTR.git "Dependencies/RTTR" git clone https://github.com/SHADE-DP/RTTR.git "Dependencies/RTTR"
if %_e%==12 (goto :done) else (goto :yamlcpp) if %_e%==11 (goto :done) else (goto :yamlcpp)
:yamlcpp :yamlcpp
echo -----------------------yamlcpp---------------------------- echo -----------------------yamlcpp----------------------------
rmdir "Dependencies/yamlcpp" /S /Q rmdir "Dependencies/yamlcpp" /S /Q
git clone https://github.com/SHADE-DP/yaml-cpp.git "Dependencies/yamlcpp" git clone https://github.com/SHADE-DP/yaml-cpp.git "Dependencies/yamlcpp"
if %_e%==12 (goto :done) else (goto :SDL)
:SDL
echo -----------------------SDL----------------------------
rmdir "Dependencies/SDL" /S /Q
mkdir "Dependencies/SDL/include"
mkdir "Dependencies/SDL/lib"
powershell -Command "& {wget https://github.com/libsdl-org/SDL/releases/download/release-2.24.0/SDL2-devel-2.24.0-VC.zip -OutFile "Dependencies/SDL/SDL.zip"}"
powershell -Command "& {Expand-Archive -LiteralPath Dependencies/SDL/SDL.zip -DestinationPath Dependencies/SDL/tmp}"
robocopy "Dependencies/SDL/tmp/SDL2-2.24.0/lib/x64" "Dependencies/SDL/lib/" /ns /nfl /ndl /nc /njh
robocopy "Dependencies/SDL/tmp/SDL2-2.24.0/include/" "Dependencies/SDL/include/" /ns /nfl /ndl /nc /njh
rmdir "Dependencies/SDL/tmp/" /s /q
powershell -Command "& {Remove-Item "Dependencies/SDL/SDL.zip"}"
:done :done
echo DONE! echo DONE!

View File

@ -10,6 +10,6 @@ IncludeDir["tracy"] = "%{wks.location}/Dependencies/tracy"
IncludeDir["VMA"] = "%{wks.location}/Dependencies/VMA" IncludeDir["VMA"] = "%{wks.location}/Dependencies/VMA"
IncludeDir["yamlcpp"] = "%{wks.location}/Dependencies/yamlcpp/include" IncludeDir["yamlcpp"] = "%{wks.location}/Dependencies/yamlcpp/include"
IncludeDir["RTTR"] = "%{wks.location}/Dependencies/RTTR" IncludeDir["RTTR"] = "%{wks.location}/Dependencies/RTTR"
IncludeDir["ktx"] = "%{wks.location}/Dependencies/ktx"
IncludeDir["reactphysics3d"] = "%{wks.location}/Dependencies/reactphysics3d" IncludeDir["reactphysics3d"] = "%{wks.location}/Dependencies/reactphysics3d"
IncludeDir["SDL"] = "%{wks.location}/Dependencies/SDL"
IncludeDir["VULKAN"] = "$(VULKAN_SDK)" IncludeDir["VULKAN"] = "$(VULKAN_SDK)"

Binary file not shown.

View File

@ -15,8 +15,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msdfgen", "Dependencies\msd
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reactphysics3d", "Dependencies\reactphysics3d\reactphysics3d.vcxproj", "{2ECAB41A-1A98-A820-032C-1947EF988485}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reactphysics3d", "Dependencies\reactphysics3d\reactphysics3d.vcxproj", "{2ECAB41A-1A98-A820-032C-1947EF988485}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spdlog", "Dependencies\spdlog\spdlog.vcxproj", "{8EAD431C-7A4F-6EF2-630A-82464F4BF542}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yaml-cpp", "Dependencies\yamlcpp\yaml-cpp.vcxproj", "{88F1A057-74BE-FB62-9DD7-E90A890331F1}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yaml-cpp", "Dependencies\yamlcpp\yaml-cpp.vcxproj", "{88F1A057-74BE-FB62-9DD7-E90A890331F1}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SHADE_Engine", "SHADE_Engine\SHADE_Engine.vcxproj", "{3F92E998-2BF5-783D-D47A-B1F3C0BC44C0}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SHADE_Engine", "SHADE_Engine\SHADE_Engine.vcxproj", "{3F92E998-2BF5-783D-D47A-B1F3C0BC44C0}"
@ -26,7 +24,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SHADE_Engine", "SHADE_Engin
{38BD587B-248B-4C81-0D1F-BDA7F98B28E6} = {38BD587B-248B-4C81-0D1F-BDA7F98B28E6} {38BD587B-248B-4C81-0D1F-BDA7F98B28E6} = {38BD587B-248B-4C81-0D1F-BDA7F98B28E6}
{2ECAB41A-1A98-A820-032C-1947EF988485} = {2ECAB41A-1A98-A820-032C-1947EF988485} {2ECAB41A-1A98-A820-032C-1947EF988485} = {2ECAB41A-1A98-A820-032C-1947EF988485}
{C0FF640D-2C14-8DBE-F595-301E616989EF} = {C0FF640D-2C14-8DBE-F595-301E616989EF} {C0FF640D-2C14-8DBE-F595-301E616989EF} = {C0FF640D-2C14-8DBE-F595-301E616989EF}
{8EAD431C-7A4F-6EF2-630A-82464F4BF542} = {8EAD431C-7A4F-6EF2-630A-82464F4BF542}
EndProjectSection EndProjectSection
EndProject EndProject
Global Global
@ -59,10 +56,6 @@ Global
{2ECAB41A-1A98-A820-032C-1947EF988485}.Debug|x64.Build.0 = Debug|x64 {2ECAB41A-1A98-A820-032C-1947EF988485}.Debug|x64.Build.0 = Debug|x64
{2ECAB41A-1A98-A820-032C-1947EF988485}.Release|x64.ActiveCfg = Release|x64 {2ECAB41A-1A98-A820-032C-1947EF988485}.Release|x64.ActiveCfg = Release|x64
{2ECAB41A-1A98-A820-032C-1947EF988485}.Release|x64.Build.0 = Release|x64 {2ECAB41A-1A98-A820-032C-1947EF988485}.Release|x64.Build.0 = Release|x64
{8EAD431C-7A4F-6EF2-630A-82464F4BF542}.Debug|x64.ActiveCfg = Debug|x64
{8EAD431C-7A4F-6EF2-630A-82464F4BF542}.Debug|x64.Build.0 = Debug|x64
{8EAD431C-7A4F-6EF2-630A-82464F4BF542}.Release|x64.ActiveCfg = Release|x64
{8EAD431C-7A4F-6EF2-630A-82464F4BF542}.Release|x64.Build.0 = Release|x64
{88F1A057-74BE-FB62-9DD7-E90A890331F1}.Debug|x64.ActiveCfg = Debug|x64 {88F1A057-74BE-FB62-9DD7-E90A890331F1}.Debug|x64.ActiveCfg = Debug|x64
{88F1A057-74BE-FB62-9DD7-E90A890331F1}.Debug|x64.Build.0 = Debug|x64 {88F1A057-74BE-FB62-9DD7-E90A890331F1}.Debug|x64.Build.0 = Debug|x64
{88F1A057-74BE-FB62-9DD7-E90A890331F1}.Release|x64.ActiveCfg = Release|x64 {88F1A057-74BE-FB62-9DD7-E90A890331F1}.Release|x64.ActiveCfg = Release|x64
@ -81,7 +74,6 @@ Global
{38BD587B-248B-4C81-0D1F-BDA7F98B28E6} = {53E47842-3FC8-3998-A828-34EB942B241A} {38BD587B-248B-4C81-0D1F-BDA7F98B28E6} = {53E47842-3FC8-3998-A828-34EB942B241A}
{8900D8DD-F5DF-5679-FEF7-E14F6A56BDDA} = {53E47842-3FC8-3998-A828-34EB942B241A} {8900D8DD-F5DF-5679-FEF7-E14F6A56BDDA} = {53E47842-3FC8-3998-A828-34EB942B241A}
{2ECAB41A-1A98-A820-032C-1947EF988485} = {53E47842-3FC8-3998-A828-34EB942B241A} {2ECAB41A-1A98-A820-032C-1947EF988485} = {53E47842-3FC8-3998-A828-34EB942B241A}
{8EAD431C-7A4F-6EF2-630A-82464F4BF542} = {53E47842-3FC8-3998-A828-34EB942B241A}
{88F1A057-74BE-FB62-9DD7-E90A890331F1} = {53E47842-3FC8-3998-A828-34EB942B241A} {88F1A057-74BE-FB62-9DD7-E90A890331F1} = {53E47842-3FC8-3998-A828-34EB942B241A}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@ -42,15 +42,15 @@
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug_x86_64\SHADE_Application\</OutDir> <OutDir>..\bin\Debug\</OutDir>
<IntDir>bin-int\Debug_x86_64\SHADE_Application\</IntDir> <IntDir>..\bin_int\Debug\SHADE_Application\</IntDir>
<TargetName>SHADE_Application</TargetName> <TargetName>SHADE_Application</TargetName>
<TargetExt>.exe</TargetExt> <TargetExt>.exe</TargetExt>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<OutDir>bin\Release_x86_64\SHADE_Application\</OutDir> <OutDir>..\bin\Release\</OutDir>
<IntDir>bin-int\Release_x86_64\SHADE_Application\</IntDir> <IntDir>..\bin_int\Release\SHADE_Application\</IntDir>
<TargetName>SHADE_Application</TargetName> <TargetName>SHADE_Application</TargetName>
<TargetExt>.exe</TargetExt> <TargetExt>.exe</TargetExt>
</PropertyGroup> </PropertyGroup>
@ -59,18 +59,21 @@
<PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>SBpch.h</PrecompiledHeaderFile> <PrecompiledHeaderFile>SBpch.h</PrecompiledHeaderFile>
<WarningLevel>Level4</WarningLevel> <WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\Dependencies\spdlog\include;..\SHADE_Engine\src;src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\Dependencies\spdlog\include;..\SHADE_Engine\src;src;include;..\Dependencies\SDL\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat> <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpplatest</LanguageStandard> <LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>SDL2.lib;SDL2main.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\Dependencies\spdlog\lib;..\Dependencies\SDL\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<EntryPointSymbol>wWinMainCRTStartup</EntryPointSymbol> <EntryPointSymbol>wWinMainCRTStartup</EntryPointSymbol>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
@ -79,21 +82,24 @@
<PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>SBpch.h</PrecompiledHeaderFile> <PrecompiledHeaderFile>SBpch.h</PrecompiledHeaderFile>
<WarningLevel>Level4</WarningLevel> <WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<PreprocessorDefinitions>_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\Dependencies\spdlog\include;..\SHADE_Engine\src;src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\Dependencies\spdlog\include;..\SHADE_Engine\src;src;include;..\Dependencies\SDL\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Full</Optimization> <Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpplatest</LanguageStandard> <LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>SDL2.lib;SDL2main.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\Dependencies\spdlog\lib;..\Dependencies\SDL\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<EntryPointSymbol>wWinMainCRTStartup</EntryPointSymbol> <EntryPointSymbol>wWinMainCRTStartup</EntryPointSymbol>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>

View File

@ -1,19 +1,20 @@
project "SHADE_Application" project "SHADE_Application"
kind "WindowedApp" kind "WindowedApp"
language "C++" language "C++"
cppdialect "C++latest" cppdialect "C++20"
targetdir ("bin/" .. outputdir .. "/%{prj.name}") targetdir (outputdir)
objdir ("bin-int/" .. outputdir .. "/%{prj.name}") objdir (interdir)
systemversion "latest" systemversion "latest"
pchheader "SBpch.h" pchheader "SBpch.h"
pchsource "%{prj.location}/src/SBpch.cpp" pchsource "%{prj.location}/src/SBpch.cpp"
staticruntime "on" staticruntime "off"
entrypoint "wWinMainCRTStartup" entrypoint "wWinMainCRTStartup"
system ("windows") system ("windows")
files files
{ {
"%{prj.location}/src/**.h", "%{prj.location}/src/**.h",
"%{prj.location}/src/**.hpp",
"%{prj.location}/src/**.c", "%{prj.location}/src/**.c",
"%{prj.location}/src/**.cpp", "%{prj.location}/src/**.cpp",
"%{prj.location}/src/**.glsl", "%{prj.location}/src/**.glsl",
@ -23,7 +24,9 @@ project "SHADE_Application"
{ {
"%{IncludeDir.spdlog}/include", "%{IncludeDir.spdlog}/include",
"../SHADE_Engine/src", "../SHADE_Engine/src",
"src" "src",
"%{IncludeDir.dotnet}/include",
"%{IncludeDir.SDL}/include",
} }
flags flags
@ -33,11 +36,20 @@ project "SHADE_Application"
links links
{ {
"SHADE_Engine" "SHADE_Engine",
"SDL2.lib",
"SDL2main.lib"
} }
postbuildcommands libdirs
{ {
"%{IncludeDir.spdlog}/lib",
"%{IncludeDir.SDL}/lib",
}
disablewarnings
{
"4251"
} }
warnings 'Extra' warnings 'Extra'

View File

@ -1,15 +1,18 @@
#include "SBpch.h" #include "SBpch.h"
#include "SBApplication.h" #include "SBApplication.h"
#include "ECS_Base/UnitTesting/SHECSUnitTest.h"
#ifdef SHEDITOR #ifdef SHEDITOR
#include "Editor/SHEditor.h" #include "Editor/SHEditor.h"
#include "Scenes/SBEditorScene.h" #include "Scenes/SBEditorScene.h"
#endif // SHEDITOR #endif // SHEDITOR
#include "Tools/SHLogger.h"
#include "Tools/SHFileUtilties.h"
#include <chrono> #include <chrono>
#include <ratio> #include <ratio>
#include <ctime> #include <ctime>
#include <SDL.h>
namespace Sandbox namespace Sandbox
{ {
@ -22,15 +25,17 @@ namespace Sandbox
_In_ INT nCmdShow _In_ INT nCmdShow
) )
{ {
// Set working directory
SHADE::SHFileUtilities::SetWorkDirToExecDir();
SDL_Init(SDL_INIT_VIDEO);
window.Create(hInstance, hPrevInstance, lpCmdLine, nCmdShow); window.Create(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
SDL_CreateWindowFrom(window.GetHWND());
#ifdef SHEDITOR #ifdef SHEDITOR
#else #else
#endif #endif
} }
void SBApplication::Update(void) void SBApplication::Update(void)
@ -47,6 +52,7 @@ namespace Sandbox
void SBApplication::Exit(void) void SBApplication::Exit(void)
{ {
SDL_DestroyWindow(sdlWindow);
#ifdef SHEDITOR #ifdef SHEDITOR
#else #else
#endif #endif

View File

@ -1,6 +1,7 @@
#ifndef SB_APPLICATION_H #ifndef SB_APPLICATION_H
#define SB_APPLICATION_H #define SB_APPLICATION_H
#include <Graphics/Windowing/SHWindow.h> #include <SDL_video.h>
#include "Graphics/Windowing/SHWindow.h"
//using namespace SHADE; //using namespace SHADE;
namespace Sandbox namespace Sandbox
@ -9,6 +10,7 @@ namespace Sandbox
{ {
private: private:
SHADE::SHWindow window; SHADE::SHWindow window;
SDL_Window* sdlWindow;
//SHAppConfig config; //SHAppConfig config;
public: public:
SBApplication() = default; SBApplication() = default;

View File

@ -26,7 +26,7 @@ INT WINAPI wWinMain
) )
{ {
const SHADE::SHLogger::Config LOGGER_CONFIG{ .directoryPath = "./logs/" }; const SHADE::SHLogger::Config LOGGER_CONFIG{ .directoryPath = "./logs/" };
SHADE::SHLogger::Initialise(LOGGER_CONFIG); auto logger = SHADE::SHLogger::Initialise(LOGGER_CONFIG);
try try
{ {
@ -34,7 +34,7 @@ INT WINAPI wWinMain
//ShowWindow(::GetConsoleWindow(), SW_HIDE); //ShowWindow(::GetConsoleWindow(), SW_HIDE);
#endif #endif
SHLOG_INFO("sup") SHLOG_REGISTER(logger)
SHADE::SHEngine::Run<Sandbox::SBApplication>(hInstance, hPrevInstance, lpCmdLine, nCmdShow); SHADE::SHEngine::Run<Sandbox::SBApplication>(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);

View File

@ -19,13 +19,13 @@
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
@ -41,65 +41,75 @@
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>bin\Debug_x86_64\SHADE_Engine\</OutDir> <LinkIncremental>true</LinkIncremental>
<IntDir>bin-int\Debug_x86_64\SHADE_Engine\</IntDir> <OutDir>..\bin\Debug\</OutDir>
<IntDir>..\bin_int\Debug\SHADE_Engine\</IntDir>
<TargetName>SHADE_Engine</TargetName> <TargetName>SHADE_Engine</TargetName>
<TargetExt>.lib</TargetExt> <TargetExt>.dll</TargetExt>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>bin\Release_x86_64\SHADE_Engine\</OutDir> <LinkIncremental>false</LinkIncremental>
<IntDir>bin-int\Release_x86_64\SHADE_Engine\</IntDir> <OutDir>..\bin\Release\</OutDir>
<IntDir>..\bin_int\Release\SHADE_Engine\</IntDir>
<TargetName>SHADE_Engine</TargetName> <TargetName>SHADE_Engine</TargetName>
<TargetExt>.lib</TargetExt> <TargetExt>.dll</TargetExt>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile> <ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>SHpch.h</PrecompiledHeaderFile> <PrecompiledHeaderFile>SHpch.h</PrecompiledHeaderFile>
<WarningLevel>Level4</WarningLevel> <WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>_LIB;_GLFW_INCLUDE_NONE;MSDFGEN_USE_CPP11;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <DisableSpecificWarnings>4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<AdditionalIncludeDirectories>src;..\Dependencies\assimp\include;..\Dependencies\imgui;..\Dependencies\imguizmo;..\Dependencies\imnodes;..\Dependencies\msdf;..\Dependencies\msdf\msdfgen;..\Dependencies\spdlog\include;..\Dependencies\tracy;..\Dependencies\VMA\include;..\Dependencies\yamlcpp\include;..\Dependencies\ktx\include;..\Dependencies\RTTR\include;..\Dependencies\reactphysics3d\include;$(VULKAN_SDK)\include;$(VULKAN_SDK)\Source\SPIRV-Reflect;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_LIB;_GLFW_INCLUDE_NONE;MSDFGEN_USE_CPP11;NOMINMAX;SH_API_EXPORT;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>src;..\Dependencies\assimp\include;..\Dependencies\imgui;..\Dependencies\imguizmo;..\Dependencies\imnodes;..\Dependencies\msdf;..\Dependencies\msdf\msdfgen;..\Dependencies\spdlog\include;..\Dependencies\tracy;..\Dependencies\VMA\include;..\Dependencies\yamlcpp\include;..\Dependencies\SDL\include;..\Dependencies\RTTR\include;..\Dependencies\reactphysics3d\include;$(VULKAN_SDK)\include;$(VULKAN_SDK)\Source\SPIRV-Reflect;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat> <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpplatest</LanguageStandard> <LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>vulkan-1.lib;SDL2.lib;SDL2main.lib;shaderc_shared.lib;shlwapi.lib;assimp-vc142-mtd.lib;librttr_core_d.lib;spdlogd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>libs;$(VULKAN_SDK)\Lib;..\Dependencies\assimp\lib\Debug;..\Dependencies\assimp\lib\Release;..\Dependencies\RTTR\lib;..\Dependencies\SDL\lib;..\Dependencies\spdlog\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ImportLibrary>..\bin\Debug\SHADE_Engine.lib</ImportLibrary>
</Link> </Link>
<Lib> <PostBuildEvent>
<AdditionalDependencies>vulkan-1.lib;shaderc_shared.lib;assimp-vc142-mtd.lib;ktxd.lib;librttr_core_d.lib;%(AdditionalDependencies)</AdditionalDependencies> <Command>xcopy /s /r /y /q "$(SolutionDir)/Dependencies/spdlog/bin" "$(OutDir)"
<AdditionalLibraryDirectories>libs;$(VULKAN_SDK)\Lib;..\Dependencies\assimp\lib\Debug;..\Dependencies\assimp\lib\Release;..\Dependencies\RTTR\lib;..\Dependencies\ktx\lib\Debug;..\Dependencies\ktx\lib\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> xcopy /r /y /q "$(SolutionDir)/Dependencies/SDL/lib/SDL2.dll" "$(OutDir)"</Command>
</Lib> </PostBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>SHpch.h</PrecompiledHeaderFile> <PrecompiledHeaderFile>SHpch.h</PrecompiledHeaderFile>
<WarningLevel>Level4</WarningLevel> <WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>_LIB;_GLFW_INCLUDE_NONE;MSDFGEN_USE_CPP11;NOMINMAX;_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <DisableSpecificWarnings>4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<AdditionalIncludeDirectories>src;..\Dependencies\assimp\include;..\Dependencies\imgui;..\Dependencies\imguizmo;..\Dependencies\imnodes;..\Dependencies\msdf;..\Dependencies\msdf\msdfgen;..\Dependencies\spdlog\include;..\Dependencies\tracy;..\Dependencies\VMA\include;..\Dependencies\yamlcpp\include;..\Dependencies\ktx\include;..\Dependencies\RTTR\include;..\Dependencies\reactphysics3d\include;$(VULKAN_SDK)\include;$(VULKAN_SDK)\Source\SPIRV-Reflect;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_LIB;_GLFW_INCLUDE_NONE;MSDFGEN_USE_CPP11;NOMINMAX;SH_API_EXPORT;_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>src;..\Dependencies\assimp\include;..\Dependencies\imgui;..\Dependencies\imguizmo;..\Dependencies\imnodes;..\Dependencies\msdf;..\Dependencies\msdf\msdfgen;..\Dependencies\spdlog\include;..\Dependencies\tracy;..\Dependencies\VMA\include;..\Dependencies\yamlcpp\include;..\Dependencies\SDL\include;..\Dependencies\RTTR\include;..\Dependencies\reactphysics3d\include;$(VULKAN_SDK)\include;$(VULKAN_SDK)\Source\SPIRV-Reflect;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Full</Optimization> <Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpplatest</LanguageStandard> <LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>vulkan-1.lib;SDL2.lib;SDL2main.lib;shaderc_shared.lib;shlwapi.lib;assimp-vc142-mt.lib;librttr_core.lib;spdlog.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>libs;$(VULKAN_SDK)\Lib;..\Dependencies\assimp\lib\Debug;..\Dependencies\assimp\lib\Release;..\Dependencies\RTTR\lib;..\Dependencies\SDL\lib;..\Dependencies\spdlog\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ImportLibrary>..\bin\Release\SHADE_Engine.lib</ImportLibrary>
</Link> </Link>
<Lib> <PostBuildEvent>
<AdditionalDependencies>vulkan-1.lib;shaderc_shared.lib;assimp-vc142-mt.lib;ktx.lib;librttr_core.lib;%(AdditionalDependencies)</AdditionalDependencies> <Command>xcopy /s /r /y /q "$(SolutionDir)/Dependencies/spdlog/bin" "$(OutDir)"
<AdditionalLibraryDirectories>libs;$(VULKAN_SDK)\Lib;..\Dependencies\assimp\lib\Debug;..\Dependencies\assimp\lib\Release;..\Dependencies\RTTR\lib;..\Dependencies\ktx\lib\Debug;..\Dependencies\ktx\lib\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> xcopy /r /y /q "$(SolutionDir)/Dependencies/SDL/lib/SDL2.dll" "$(OutDir)"</Command>
</Lib> </PostBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="src\ECS_Base\Components\SHComponent.h" /> <ClInclude Include="src\ECS_Base\Components\SHComponent.h" />
@ -122,6 +132,7 @@
<ClInclude Include="src\ECS_Base\UnitTesting\SHTestComponents.h" /> <ClInclude Include="src\ECS_Base\UnitTesting\SHTestComponents.h" />
<ClInclude Include="src\ECS_Base\UnitTesting\SHTestSystems.h" /> <ClInclude Include="src\ECS_Base\UnitTesting\SHTestSystems.h" />
<ClInclude Include="src\Engine\SHEngine.h" /> <ClInclude Include="src\Engine\SHEngine.h" />
<ClInclude Include="src\FRC\SHFramerateController.h" />
<ClInclude Include="src\Filesystem\SHFileSystem.h" /> <ClInclude Include="src\Filesystem\SHFileSystem.h" />
<ClInclude Include="src\Graphics\Buffers\SHVkBuffer.h" /> <ClInclude Include="src\Graphics\Buffers\SHVkBuffer.h" />
<ClInclude Include="src\Graphics\Commands\SHCommandPoolResetMode.h" /> <ClInclude Include="src\Graphics\Commands\SHCommandPoolResetMode.h" />
@ -189,12 +200,15 @@
<ClInclude Include="src\Resource\Handle.h" /> <ClInclude Include="src\Resource\Handle.h" />
<ClInclude Include="src\Resource\ResourceLibrary.h" /> <ClInclude Include="src\Resource\ResourceLibrary.h" />
<ClInclude Include="src\Resource\SparseSet.h" /> <ClInclude Include="src\Resource\SparseSet.h" />
<ClInclude Include="src\SHCommonTypes.h" />
<ClInclude Include="src\SH_API.h" />
<ClInclude Include="src\SHpch.h" /> <ClInclude Include="src\SHpch.h" />
<ClInclude Include="src\Scene\SHScene.h" /> <ClInclude Include="src\Scene\SHScene.h" />
<ClInclude Include="src\Scene\SHSceneGraph.h" /> <ClInclude Include="src\Scene\SHSceneGraph.h" />
<ClInclude Include="src\Scene\SHSceneManager.h" /> <ClInclude Include="src\Scene\SHSceneManager.h" />
<ClInclude Include="src\Tools\SHException.h" /> <ClInclude Include="src\Tools\SHException.h" />
<ClInclude Include="src\Tools\SHExceptionHandler.h" /> <ClInclude Include="src\Tools\SHExceptionHandler.h" />
<ClInclude Include="src\Tools\SHFileUtilties.h" />
<ClInclude Include="src\Tools\SHLogger.h" /> <ClInclude Include="src\Tools\SHLogger.h" />
<ClInclude Include="src\Tools\SHUtilities.h" /> <ClInclude Include="src\Tools\SHUtilities.h" />
</ItemGroup> </ItemGroup>
@ -209,6 +223,7 @@
<ClCompile Include="src\ECS_Base\System\SHSystemRoutine.cpp" /> <ClCompile Include="src\ECS_Base\System\SHSystemRoutine.cpp" />
<ClCompile Include="src\ECS_Base\UnitTesting\SHECSUnitTest.cpp" /> <ClCompile Include="src\ECS_Base\UnitTesting\SHECSUnitTest.cpp" />
<ClCompile Include="src\Engine\SHEngine.cpp" /> <ClCompile Include="src\Engine\SHEngine.cpp" />
<ClCompile Include="src\FRC\SHFramerateController.cpp" />
<ClCompile Include="src\Filesystem\SHFileSystem.cpp" /> <ClCompile Include="src\Filesystem\SHFileSystem.cpp" />
<ClCompile Include="src\Graphics\Buffers\SHVkBuffer.cpp" /> <ClCompile Include="src\Graphics\Buffers\SHVkBuffer.cpp" />
<ClCompile Include="src\Graphics\Commands\SHVkCommandBuffer.cpp" /> <ClCompile Include="src\Graphics\Commands\SHVkCommandBuffer.cpp" />
@ -270,6 +285,7 @@
<ClCompile Include="src\Scene\SHSceneManager.cpp" /> <ClCompile Include="src\Scene\SHSceneManager.cpp" />
<ClCompile Include="src\Tools\SHException.cpp" /> <ClCompile Include="src\Tools\SHException.cpp" />
<ClCompile Include="src\Tools\SHExceptionHandler.cpp" /> <ClCompile Include="src\Tools\SHExceptionHandler.cpp" />
<ClCompile Include="src\Tools\SHFileUtilties.cpp" />
<ClCompile Include="src\Tools\SHLogger.cpp" /> <ClCompile Include="src\Tools\SHLogger.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -288,9 +304,6 @@
<ProjectReference Include="..\Dependencies\imgui\ImGui.vcxproj"> <ProjectReference Include="..\Dependencies\imgui\ImGui.vcxproj">
<Project>{C0FF640D-2C14-8DBE-F595-301E616989EF}</Project> <Project>{C0FF640D-2C14-8DBE-F595-301E616989EF}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Dependencies\spdlog\spdlog.vcxproj">
<Project>{8EAD431C-7A4F-6EF2-630A-82464F4BF542}</Project>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View File

@ -22,6 +22,9 @@
<Filter Include="Engine"> <Filter Include="Engine">
<UniqueIdentifier>{DBC7D3B0-C769-FE86-B024-12DB9C6585D7}</UniqueIdentifier> <UniqueIdentifier>{DBC7D3B0-C769-FE86-B024-12DB9C6585D7}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="FRC">
<UniqueIdentifier>{80E7870B-ECF0-877C-756C-9E7CE174937C}</UniqueIdentifier>
</Filter>
<Filter Include="Filesystem"> <Filter Include="Filesystem">
<UniqueIdentifier>{8A8E2B37-7646-6D84-DF4D-46E0CB240875}</UniqueIdentifier> <UniqueIdentifier>{8A8E2B37-7646-6D84-DF4D-46E0CB240875}</UniqueIdentifier>
</Filter> </Filter>
@ -162,6 +165,9 @@
<ClInclude Include="src\Engine\SHEngine.h"> <ClInclude Include="src\Engine\SHEngine.h">
<Filter>Engine</Filter> <Filter>Engine</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\FRC\SHFramerateController.h">
<Filter>FRC</Filter>
</ClInclude>
<ClInclude Include="src\Filesystem\SHFileSystem.h"> <ClInclude Include="src\Filesystem\SHFileSystem.h">
<Filter>Filesystem</Filter> <Filter>Filesystem</Filter>
</ClInclude> </ClInclude>
@ -363,6 +369,8 @@
<ClInclude Include="src\Resource\SparseSet.h"> <ClInclude Include="src\Resource\SparseSet.h">
<Filter>Resource</Filter> <Filter>Resource</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\SHCommonTypes.h" />
<ClInclude Include="src\SH_API.h" />
<ClInclude Include="src\SHpch.h" /> <ClInclude Include="src\SHpch.h" />
<ClInclude Include="src\Scene\SHScene.h"> <ClInclude Include="src\Scene\SHScene.h">
<Filter>Scene</Filter> <Filter>Scene</Filter>
@ -379,6 +387,9 @@
<ClInclude Include="src\Tools\SHExceptionHandler.h"> <ClInclude Include="src\Tools\SHExceptionHandler.h">
<Filter>Tools</Filter> <Filter>Tools</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\Tools\SHFileUtilties.h">
<Filter>Tools</Filter>
</ClInclude>
<ClInclude Include="src\Tools\SHLogger.h"> <ClInclude Include="src\Tools\SHLogger.h">
<Filter>Tools</Filter> <Filter>Tools</Filter>
</ClInclude> </ClInclude>
@ -414,6 +425,9 @@
<ClCompile Include="src\Engine\SHEngine.cpp"> <ClCompile Include="src\Engine\SHEngine.cpp">
<Filter>Engine</Filter> <Filter>Engine</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\FRC\SHFramerateController.cpp">
<Filter>FRC</Filter>
</ClCompile>
<ClCompile Include="src\Filesystem\SHFileSystem.cpp"> <ClCompile Include="src\Filesystem\SHFileSystem.cpp">
<Filter>Filesystem</Filter> <Filter>Filesystem</Filter>
</ClCompile> </ClCompile>
@ -589,6 +603,9 @@
<ClCompile Include="src\Tools\SHExceptionHandler.cpp"> <ClCompile Include="src\Tools\SHExceptionHandler.cpp">
<Filter>Tools</Filter> <Filter>Tools</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\Tools\SHFileUtilties.cpp">
<Filter>Tools</Filter>
</ClCompile>
<ClCompile Include="src\Tools\SHLogger.cpp"> <ClCompile Include="src\Tools\SHLogger.cpp">
<Filter>Tools</Filter> <Filter>Tools</Filter>
</ClCompile> </ClCompile>

View File

@ -1,13 +1,13 @@
project "SHADE_Engine" project "SHADE_Engine"
kind "StaticLib" kind "SharedLib"
language "C++" language "C++"
cppdialect "C++latest" cppdialect "C++20"
targetdir ("bin/" .. outputdir .. "/%{prj.name}") targetdir (outputdir)
objdir ("bin-int/" .. outputdir .. "/%{prj.name}") objdir (interdir)
systemversion "latest" systemversion "latest"
pchheader "SHpch.h" pchheader "SHpch.h"
pchsource "%{prj.location}/src/SHpch.cpp" pchsource "%{prj.location}/src/SHpch.cpp"
staticruntime "on" staticruntime "off"
files files
{ {
@ -31,7 +31,7 @@ project "SHADE_Engine"
"%{IncludeDir.tracy}", "%{IncludeDir.tracy}",
"%{IncludeDir.VMA}/include", "%{IncludeDir.VMA}/include",
"%{IncludeDir.yamlcpp}", "%{IncludeDir.yamlcpp}",
"%{IncludeDir.ktx}/include", "%{IncludeDir.SDL}/include",
"%{IncludeDir.RTTR}/include", "%{IncludeDir.RTTR}/include",
"%{IncludeDir.reactphysics3d}/include", "%{IncludeDir.reactphysics3d}/include",
"%{IncludeDir.VULKAN}/include", "%{IncludeDir.VULKAN}/include",
@ -45,8 +45,8 @@ project "SHADE_Engine"
"%{IncludeDir.assimp}/lib/Debug", "%{IncludeDir.assimp}/lib/Debug",
"%{IncludeDir.assimp}/lib/Release", "%{IncludeDir.assimp}/lib/Release",
"%{IncludeDir.RTTR}/lib", "%{IncludeDir.RTTR}/lib",
"%{IncludeDir.ktx}/lib/Debug", "%{IncludeDir.SDL}/lib",
"%{IncludeDir.ktx}/lib/Release", "%{IncludeDir.spdlog}/lib"
} }
links links
@ -56,9 +56,16 @@ project "SHADE_Engine"
"msdf-atlas-gen", "msdf-atlas-gen",
"reactphysics3d", "reactphysics3d",
"imgui", "imgui",
"spdlog",
"vulkan-1.lib", "vulkan-1.lib",
"shaderc_shared.lib" "SDL2.lib",
"SDL2main.lib",
"shaderc_shared.lib",
"shlwapi"
}
disablewarnings
{
"4251"
} }
defines defines
@ -66,7 +73,8 @@ project "SHADE_Engine"
"_LIB", "_LIB",
"_GLFW_INCLUDE_NONE", "_GLFW_INCLUDE_NONE",
"MSDFGEN_USE_CPP11", "MSDFGEN_USE_CPP11",
"NOMINMAX" "NOMINMAX",
"SH_API_EXPORT"
} }
flags flags
@ -81,7 +89,12 @@ project "SHADE_Engine"
"msdf-atlas-gen", "msdf-atlas-gen",
"reactphysics3d", "reactphysics3d",
"imgui", "imgui",
"spdlog", }
postbuildcommands
{
"xcopy /s /r /y /q \"%{IncludeDir.spdlog}/bin\" \"$(OutDir)\"",
"xcopy /r /y /q \"%{IncludeDir.SDL}/lib/SDL2.dll\" \"$(OutDir)\""
} }
warnings 'Extra' warnings 'Extra'
@ -89,11 +102,11 @@ project "SHADE_Engine"
filter "configurations:Debug" filter "configurations:Debug"
symbols "On" symbols "On"
defines {"_DEBUG"} defines {"_DEBUG"}
links{"assimp-vc142-mtd.lib", "ktxd.lib", "librttr_core_d.lib"} links{"assimp-vc142-mtd.lib", "librttr_core_d.lib", "spdlogd.lib"}
--links{"fmodstudioL_vc.lib", "fmodL_vc.lib"} --links{"fmodstudioL_vc.lib", "fmodL_vc.lib"}
filter "configurations:Release" filter "configurations:Release"
optimize "On" optimize "On"
defines{"_RELEASE"} defines{"_RELEASE"}
links{"assimp-vc142-mt.lib", "ktx.lib", "librttr_core.lib"} links{"assimp-vc142-mt.lib", "librttr_core.lib", "spdlog.lib"}
--links{"fmodstudio_vc.lib", "fmod_vc.lib"} --links{"fmodstudio_vc.lib", "fmod_vc.lib"}

View File

@ -13,13 +13,14 @@
#include "SHpch.h" #include "SHpch.h"
#include "../SHECSMacros.h" #include "../SHECSMacros.h"
#include "SH_API.h"
namespace SHADE namespace SHADE
{ {
class SHComponentManager; class SHComponentManager;
class SHComponent class SH_API SHComponent
{ {
friend SHComponentManager; friend SHComponentManager;

View File

@ -14,6 +14,7 @@
#include "../Components/SHComponent.h" #include "../Components/SHComponent.h"
#include "../Managers/SHComponentManager.h" #include "../Managers/SHComponentManager.h"
//#include "../../Scene/SHSceneNode.h" //#include "../../Scene/SHSceneNode.h"
#include "SH_API.h"
@ -22,7 +23,7 @@ namespace SHADE
class SHComponentManager; class SHComponentManager;
class SHEntityManager; class SHEntityManager;
class SHEntity class SH_API SHEntity
{ {
public: public:

View File

@ -18,17 +18,16 @@
#include "../Components/SHComponent.h" #include "../Components/SHComponent.h"
#include "../Components/SHComponentGroup.h" #include "../Components/SHComponentGroup.h"
//#include "Scene/SHSceneNode.h" //#include "Scene/SHSceneNode.h"
#include "SH_API.h"
#include <cassert> #include <cassert>
namespace SHADE namespace SHADE
{ {
typedef SHFamilyID<SHComponent> ComponentFamily; typedef SHFamilyID<SHComponent> ComponentFamily;
class SHComponentManager class SH_API SHComponentManager
{ {
private: private:

View File

@ -20,11 +20,12 @@
#include "../Components/SHComponent.h" #include "../Components/SHComponent.h"
#include "../General/SHHandleGenerator.h" #include "../General/SHHandleGenerator.h"
#include "../SHECSMacros.h" #include "../SHECSMacros.h"
#include "SH_API.h"
namespace SHADE namespace SHADE
{ {
class SHEntityManager class SH_API SHEntityManager
{ {
private: private:
static std::vector<std::unique_ptr<SHEntity>> entityVec; static std::vector<std::unique_ptr<SHEntity>> entityVec;

View File

@ -0,0 +1,134 @@
/*********************************************************************
* \file SHFramerateController.cpp
* \author Ryan Wang Nian Jing
* \brief Definition for functions of the framerate controller
* Handles changing of scenes and manages loop (timestep, etc.)
*
* \copyright 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.
*********************************************************************/
#include <chrono>
#include <cassert>
#include <SHpch.h>
#include "SHFramerateController.h"
#include "../Tools/SHLogger.h"
namespace SHADE
{
//Init statics
double SHFramerateController::fixedTimestep = 0.01;
SHScene* SHFramerateController::previousScene = nullptr;
SHScene* SHFramerateController::currentScene = nullptr;
SHScene* SHFramerateController::nextScene = nullptr;
bool SHFramerateController::toRestart = false;
bool SHFramerateController::toQuit = false;
//Scene manager loop
void SHFramerateController::Run(SHScene* firstScene)
{
if (firstScene == nullptr)
{
SHLOG_ERROR("Do not pass a nullptr as the firstScene");
return;
}
//Set quit and restart flags to false
toQuit = false;
toRestart = false;
//Set the first scene to run
previousScene = firstScene;
currentScene = firstScene;
nextScene = firstScene;
while (!toQuit)
{
if (toRestart)
{
//Restart current scene
currentScene = previousScene;
nextScene = previousScene;
toRestart = false;
}
else
{
//Move to a new scene
currentScene->Load();
}
//Call init function of current scene
currentScene->Init();
//Have an initial value
//This frame time will fluctuate
//SHOULD be larger than the fixed timestep
//TODO this might need to be changed
double variableLastFrameTime = fixedTimestep;
//Time accumulator for meshing between fixed and variable timesteps
double accumulator = 0.0;
//Start state loop
while (currentScene == nextScene && !toQuit && !toRestart)
{
//Use of new STL timing functions
//https://en.cppreference.com/w/cpp/chrono
std::chrono::duration<double> deltaTime;
auto startTime = std::chrono::high_resolution_clock::now();
//Whittle down the accumulator by continuously simulating
for (; accumulator > fixedTimestep; accumulator -= fixedTimestep)
{
MSG msg;
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
//TODO change to double
currentScene->Update((float)fixedTimestep);
}
//Interpolation
//Manage the alpha value well
//https://randomascii.wordpress.com/2012/02/13/dont-store-that-in-a-float/
//Key points:
//1) Any time you add or subtract floats of widely varying
// magnitudes, you need to watch for loss of precision
//2) Sometimes using double instead of float is the correct
// solution, but often a more stable algorithm is more important
//3) calcT() should probably use double (to give sufficient
// precision after many hours of gameplay)
//TODO awaiting approval to use this
//double alpha = accumulator / fixedTimestep;
//assert alpha does not go out of range
currentScene->Render();
auto endTime = std::chrono::high_resolution_clock::now();
deltaTime = endTime - startTime;
variableLastFrameTime = deltaTime.count();
//Increase accumulator
accumulator += variableLastFrameTime;
}
//Free once out of scene loop
currentScene->Free();
//Check if not to restart state
//If so, unload
if (!toRestart) currentScene->Unload();
//Shift forward scenes
previousScene = currentScene;
currentScene = nextScene;
}
}
}

View File

@ -0,0 +1,62 @@
/*********************************************************************
* \file SHFramerateController.h
* \author Ryan Wang Nian Jing
* \brief Declaration for the framerate controller
* Handles changing of scenes and manages loop (timestep, etc.)
*
* \copyright 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.
*********************************************************************/
#ifndef SH_FRAMERATECONTROLLER_H
#define SH_FRAMERATECONTROLLER_H
#pragma once
#include "../Scene/SHScene.h"
namespace SHADE
{
class SHFramerateController
{
private:
//scene pointers
static SHScene* previousScene;
static SHScene* currentScene;
static SHScene* nextScene;
//Flags
//Whether the flag has been raised for the game to be quit
static bool toQuit;
//Whether the flag has been raised for the current scene to restart
static bool toRestart;
public:
//Fixed timestep value for physics. Default at 1/100th of a second.
//Should be lower than the variable refresh rate
static double fixedTimestep;
//Scene Manager Loop
//This loop is vital to the game because it runs for as long as the game
//runs. Before entering, initialise vital systems for game. After exiting,
//free these vital systems before finishing the main() function and
//terminating the game
//Parameter of firstScene is what scene the game should start with
static void Run(SHScene* firstScene);
//Set the flag to restart the current game scene
static inline void RestartScene() { toRestart = true; }
//Set the flag to halt running of the scene manager and quit the game
static inline void QuitGame() { toQuit = true; }
//Set the next scene to be excuted
//This will tell the scene manager to
//halt execution of the current scene and prepare
//execution of the next
static inline void SetNextScene(SHScene* const next) { nextScene = next; }
};
}
#endif

View File

@ -5,6 +5,7 @@
#include <functional> #include <functional>
#include <unordered_map> #include <unordered_map>
#include "SHWindowMap.h" #include "SHWindowMap.h"
#include "SH_API.h"
namespace SHADE namespace SHADE
{ {
@ -67,7 +68,7 @@ namespace SHADE
std::string icoPath = ""; std::string icoPath = "";
}; };
class SHWindow class SH_API SHWindow
{ {
public: public:
using SHVec2 = std::pair<uint32_t, uint32_t>; using SHVec2 = std::pair<uint32_t, uint32_t>;

View File

@ -0,0 +1,28 @@
/************************************************************************************//*!
\file SHCommonTypes.h
\author Tng Kah Wei, kahwei.tng, 390009620
\par email: kahwei.tng\@digipen.edu
\date Sep 8, 2022
\brief Contains the definitions of type alias for commonly used units for
clarity and convenience.
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
namespace SHADE
{
/*---------------------------------------------------------------------------------*/
/* Type Definitions */
/*---------------------------------------------------------------------------------*/
/***********************************************************************************/
/*!
\brief
Type used to mark a value that is supposed to represent a size in bytes.
*/
/***********************************************************************************/
using Byte = size_t;
}

36
SHADE_Engine/src/SH_API.h Normal file
View File

@ -0,0 +1,36 @@
/************************************************************************************//*!
\file SH_API.h
\author Tng Kah Wei, kahwei.tng, 390009620
\par email: kahwei.tng\@digipen.edu
\date Sep 13, 2022
\brief Contains dllexport and dllimport macros for the SHADE Engine.
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
// Select the correct export system based on the compiler
#if defined SH_LIB
# define SH_API
#else
# if defined _WIN32 || defined __CYGWIN__ || defined _MSC_VER
# define SH_EXPORT __declspec(dllexport)
# define SH_IMPORT __declspec(dllimport)
# elif defined __GNUC__ && __GNUC__ >= 4
# define SH_EXPORT __attribute__((visibility("default")))
# define SH_IMPORT __attribute__((visibility("default")))
# else /* Unsupported compiler */
# define SH_EXPORT
# define SH_IMPORT
# endif
// Define the correct
# ifndef SH_API
# if defined SH_API_EXPORT
# define SH_API SH_EXPORT
# else
# define SH_API SH_IMPORT
# endif
# endif
#endif

View File

@ -30,3 +30,5 @@
#include <functional> #include <functional>
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
#include "SHCommonTypes.h"

View File

@ -12,13 +12,15 @@
#include <exception> #include <exception>
#include "SH_API.h"
namespace SHADE namespace SHADE
{ {
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
/* Type Definitions */ /* Type Definitions */
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
class SHExceptionHandler class SH_API SHExceptionHandler
{ {
public: public:
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/

View File

@ -0,0 +1,30 @@
/************************************************************************************//*!
\file SHFileUtilities.cpp
\author Tng Kah Wei, kahwei.tng, 390009620
\par email: kahwei.tng\@digipen.edu
\date Sep 15, 2022
\brief Contains the definition of functions of the SHFileUtilities static class.
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 Header
#include "SHpch.h"
// Primary Header
#include "SHFileUtilties.h"
// Standard Libraries
#include <filesystem>
// External Dependencies
#include <shlwapi.h> // GetModuleFileName, PathRemoveFileSpec
namespace SHADE
{
void SHFileUtilities::SetWorkDirToExecDir()
{
TCHAR currentExecFilePath[MAX_PATH] = { '\0' };
GetModuleFileName(nullptr, currentExecFilePath, MAX_PATH);
PathRemoveFileSpec(currentExecFilePath);
std::filesystem::current_path(currentExecFilePath);
}
}

View File

@ -0,0 +1,38 @@
/************************************************************************************//*!
\file SHFileUtilities.h
\author Tng Kah Wei, kahwei.tng, 390009620
\par email: kahwei.tng\@digipen.edu
\date Sep 15, 2022
\brief Contains the SHFileUtilities static class.
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.
*//*************************************************************************************/
// Project Headers
#include "SH_API.h"
namespace SHADE
{
/*!************************************************************************************
\class SHFileUtilities
\brief
Static class that contains functions for working with files and directories.
**************************************************************************************/
class SH_API SHFileUtilities
{
public:
/*!**********************************************************************************
\brief
Sets the application's current working directory to the application executable's
directory.
************************************************************************************/
static void SetWorkDirToExecDir();
};
}

View File

@ -32,6 +32,7 @@ namespace SHADE
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
unsigned char SHLogger::configFlags = DEFAULT_CONFIG_FLAG; unsigned char SHLogger::configFlags = DEFAULT_CONFIG_FLAG;
SHLogger::DateFormat SHLogger::dateFormat = SHLogger::DateFormat::DD_MM_YY; SHLogger::DateFormat SHLogger::dateFormat = SHLogger::DateFormat::DD_MM_YY;
SHLogger::Logger SHLogger::logger = nullptr;
std::string SHLogger::trivialPattern; std::string SHLogger::trivialPattern;
std::string SHLogger::verbosePattern; std::string SHLogger::verbosePattern;
@ -142,7 +143,7 @@ namespace SHADE
/* Public Function Member Definitions */ /* Public Function Member Definitions */
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
void SHLogger::Initialise(const Config& config) SHLogger::Logger SHLogger::Initialise(const Config& config)
{ {
SetConfig(config); SetConfig(config);
@ -176,10 +177,10 @@ namespace SHADE
FILE_SINK->set_pattern(trivialPattern + "%v"); FILE_SINK->set_pattern(trivialPattern + "%v");
// Create and register logger with spdlog // Create and register logger with spdlog
const auto LOGGER = std::make_shared<spdlog::logger>(SHLOGGER_NAME, sinks.begin(), sinks.end()); logger = std::make_shared<spdlog::logger>(SHLOGGER_NAME, sinks.begin(), sinks.end());
LOGGER->set_level(spdlog::level::trace); logger->set_level(spdlog::level::trace);
LOGGER->flush_on(spdlog::level::trace); logger->flush_on(spdlog::level::trace);
register_logger(LOGGER); spdlog::register_logger(logger);
// Flush every 3 seconds // Flush every 3 seconds
spdlog::flush_every(std::chrono::seconds(config.flushTime)); spdlog::flush_every(std::chrono::seconds(config.flushTime));
@ -190,6 +191,8 @@ namespace SHADE
{ {
std::cout << "Log initialisation failed: " << e.what() << std::endl; std::cout << "Log initialisation failed: " << e.what() << std::endl;
} }
return logger;
} }
void SHLogger::Shutdown() noexcept void SHLogger::Shutdown() noexcept
@ -211,6 +214,143 @@ namespace SHADE
sinks[1]->set_pattern(verbosePattern + "%v"); // File Sink sinks[1]->set_pattern(verbosePattern + "%v"); // File Sink
} }
void SHLogger::LogInfo(const std::string& msg) noexcept
{
SHLOG_INFO(msg)
}
void SHLogger::LogVerboseInfo(const std::string& msg, const std::source_location& src) noexcept
{
const bool SHOW_SRC_FILE = configFlags & (1U << 3);
const bool SHOW_SRC_LINE = configFlags & (1U << 4);
std::stringstream ss;
ss << "[";
if (SHOW_SRC_FILE)
{
ss << std::filesystem::path(src.file_name()).filename().string() << ", ";
if (SHOW_SRC_LINE)
{
ss << src.line() << ", ";
}
}
ss << src.function_name() << "] " << msg;
SHLOG_INFO(ss.str())
}
void SHLogger::LogWarning(const std::string& msg) noexcept
{
SHLOG_WARNING(msg)
}
void SHLogger::LogVerboseWarning(const std::string& msg, const std::source_location& src) noexcept
{
const bool SHOW_SRC_FILE = configFlags & (1U << 3);
const bool SHOW_SRC_LINE = configFlags & (1U << 4);
std::stringstream ss;
ss << "[";
if (SHOW_SRC_FILE)
{
ss << std::filesystem::path(src.file_name()).filename().string() << ", ";
if (SHOW_SRC_LINE)
{
ss << src.line() << ", ";
}
}
ss << src.function_name() << "] " << msg;
SHLOG_WARNING(ss.str())
}
void SHLogger::LogError(const std::string& msg) noexcept
{
SHLOG_ERROR(msg)
}
void SHLogger::LogVerboseError(const std::string& msg, const std::source_location& src) noexcept
{
const bool SHOW_SRC_FILE = configFlags & (1U << 3);
const bool SHOW_SRC_LINE = configFlags & (1U << 4);
std::stringstream ss;
ss << "[";
if (SHOW_SRC_FILE)
{
ss << std::filesystem::path(src.file_name()).filename().string() << ", ";
if (SHOW_SRC_LINE)
{
ss << src.line() << ", ";
}
}
ss << src.function_name() << "] " << msg;
SHLOG_ERROR(ss.str())
}
void SHLogger::LogCritical(const std::string& msg) noexcept
{
SHLOG_CRITICAL(msg)
}
void SHLogger::LogVerboseCritical(const std::string& msg, const std::source_location& src) noexcept
{
const bool SHOW_SRC_FILE = configFlags & (1U << 3);
const bool SHOW_SRC_LINE = configFlags & (1U << 4);
std::stringstream ss;
ss << "[";
if (SHOW_SRC_FILE)
{
ss << std::filesystem::path(src.file_name()).filename().string() << ", ";
if (SHOW_SRC_LINE)
{
ss << src.line() << ", ";
}
}
ss << src.function_name() << "] " << msg;
SHLOG_CRITICAL(ss.str())
}
void SHLogger::LogFloor() noexcept
{
SHLOG_FLOOR()
}
#ifdef _DEBUG
void SHLogger::LogTrace(const std::string& msg) noexcept
{
SHLOG_TRACE(msg)
}
void SHLogger::LogVerboseTrace(const std::string& msg, const std::source_location& src) noexcept
{
const bool SHOW_SRC_FILE = configFlags & (1U << 3);
const bool SHOW_SRC_LINE = configFlags & (1U << 4);
std::stringstream ss;
ss << "[";
if (SHOW_SRC_FILE)
{
ss << std::filesystem::path(src.file_name()).filename().string() << ", ";
if (SHOW_SRC_LINE)
{
ss << src.line() << ", ";
}
}
ss << src.function_name() << "] " << msg;
SHLOG_TRACE(ss.str())
}
#endif
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
/* Private Function Member Definitions */ /* Private Function Member Definitions */
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/

View File

@ -12,9 +12,11 @@
#include <string_view> #include <string_view>
#include <filesystem> #include <filesystem>
#include <source_location>
#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
#include "SH_API.h"
/*-------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------*/
/* Macros */ /* Macros */
@ -27,13 +29,15 @@ namespace SHADE
/* Type Definitions */ /* Type Definitions */
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
class SHLogger class SH_API SHLogger
{ {
public: public:
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* Type Definitions */ /* Type Definitions */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
using Logger = std::shared_ptr<spdlog::logger>;
enum class ClockFormat { _12HR, _24HR }; enum class ClockFormat { _12HR, _24HR };
enum class DateFormat enum class DateFormat
@ -106,7 +110,7 @@ namespace SHADE
* @brief Creates a console and a file to log to. * @brief Creates a console and a file to log to.
* @param[in] config The configuration parameters for the logger. * @param[in] config The configuration parameters for the logger.
*/ */
static void Initialise (const Config& config = Config{}); static Logger Initialise (const Config& config = Config{});
static void Shutdown () noexcept; static void Shutdown () noexcept;
/** /**
@ -118,6 +122,23 @@ namespace SHADE
*/ */
static void UseVerbosePattern () noexcept; static void UseVerbosePattern () noexcept;
/// Logging Functions to interface with C++/CLI.
static void LogInfo (const std::string& msg) noexcept;
static void LogVerboseInfo (const std::string& msg, const std::source_location& src= std::source_location::current()) noexcept;
static void LogWarning (const std::string& msg) noexcept;
static void LogVerboseWarning (const std::string& msg, const std::source_location& src = std::source_location::current()) noexcept;
static void LogError (const std::string& msg) noexcept;
static void LogVerboseError (const std::string& msg, const std::source_location& src = std::source_location::current()) noexcept;
static void LogCritical (const std::string& msg) noexcept;
static void LogVerboseCritical (const std::string& msg, const std::source_location& src = std::source_location::current()) noexcept;
static void LogFloor () noexcept;
#ifdef _DEBUG
static void LogTrace (const std::string& msg) noexcept;
static void LogVerboseTrace (const std::string& msg, const std::source_location& src = std::source_location::current()) noexcept;
#endif
private: private:
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* Data Members */ /* Data Members */
@ -128,6 +149,8 @@ namespace SHADE
static unsigned char configFlags; // Initialised 0 0 FuncLine# FuncFileName Date TimeFormat Time static unsigned char configFlags; // Initialised 0 0 FuncLine# FuncFileName Date TimeFormat Time
static DateFormat dateFormat; static DateFormat dateFormat;
static Logger logger;
static std::string trivialPattern; static std::string trivialPattern;
static std::string verbosePattern; static std::string verbosePattern;
@ -172,3 +195,6 @@ namespace SHADE
// Misc Logging Macros // Misc Logging Macros
#define SHLOG_FLOOR() SHADE::SHLogger::UseTrivialPattern(); SPDLOG_LOGGER_INFO(spdlog::get(SHLOGGER_NAME), "--------------------------------"); #define SHLOG_FLOOR() SHADE::SHLogger::UseTrivialPattern(); SPDLOG_LOGGER_INFO(spdlog::get(SHLOGGER_NAME), "--------------------------------");
// For use outside the library to register the logger
#define SHLOG_REGISTER(logger) spdlog::register_logger(logger); spdlog::set_level(spdlog::level::level_enum::trace);

View File

@ -15,15 +15,15 @@ workspace "SHADE"
"MultiProcessorCompile" "MultiProcessorCompile"
} }
outputdir = "%{cfg.buildcfg}_%{cfg.architecture}" outputdir = "%{wks.location}/bin/%{cfg.buildcfg}"
interdir = "%{wks.location}/bin_int"
include "SHADE_Application"
include "SHADE_Engine" include "SHADE_Engine"
include "SHADE_Application"
group "Dependencies" group "Dependencies"
include "Dependencies/msdf" include "Dependencies/msdf"
include "Dependencies/imgui" include "Dependencies/imgui"
include "Dependencies/spdlog"
--include "Dependencies/tracy" --include "Dependencies/tracy"
include "Dependencies/yamlcpp" include "Dependencies/yamlcpp"
include "Dependencies/reactphysics3d" include "Dependencies/reactphysics3d"