Merge branch 'main' into SP3-6-c-scripting

# Conflicts:
#	Premake/premake5.exe
#	SHADE_Application/src/Application/SBApplication.cpp
#	SHADE_Engine/SHADE_Engine.vcxproj
#	SHADE_Engine/SHADE_Engine.vcxproj.filters
#	SHADE_Engine/premake5.lua
This commit is contained in:
Kah Wei 2022-09-15 09:17:17 +08:00
commit ad7df083bf
10 changed files with 120 additions and 8 deletions

View File

@ -66,7 +66,7 @@
<MinimalRebuild>false</MinimalRebuild>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -88,7 +88,7 @@
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@ -1,7 +1,7 @@
project "SHADE_Application"
kind "WindowedApp"
language "C++"
cppdialect "C++latest"
cppdialect "C++20"
targetdir (outputdir)
objdir (interdir)
systemversion "latest"

View File

@ -6,6 +6,9 @@
#include "Scenes/SBEditorScene.h"
#endif // SHEDITOR
#include "Tools/SHLogger.h"
#include "Tools/SHFileUtilties.h"
#include <chrono>
#include <ratio>
#include <ctime>
@ -23,6 +26,8 @@ namespace Sandbox
_In_ INT nCmdShow
)
{
// Set working directory
SHADE::SHFileUtilities::SetWorkDirToExecDir();
window.Create(hInstance, hPrevInstance, lpCmdLine, nCmdShow);

View File

@ -66,7 +66,7 @@
<MinimalRebuild>false</MinimalRebuild>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -94,7 +94,7 @@ xcopy /s /r /y /q "$(SolutionDir)/Dependencies/dotnet/bin" "$(OutDir)"</Command
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -195,6 +195,7 @@ xcopy /s /r /y /q "$(SolutionDir)/Dependencies/dotnet/bin" "$(OutDir)"</Command
<ClInclude Include="src\Resource\ResourceLibrary.hpp" />
<ClInclude Include="src\Resource\SparseSet.h" />
<ClInclude Include="src\Resource\SparseSet.hpp" />
<ClInclude Include="src\SHCommonTypes.h" />
<ClInclude Include="src\SH_API.h" />
<ClInclude Include="src\SHpch.h" />
<ClInclude Include="src\Scene\SHScene.h" />
@ -205,6 +206,7 @@ xcopy /s /r /y /q "$(SolutionDir)/Dependencies/dotnet/bin" "$(OutDir)"</Command
<ClInclude Include="src\Scripting\SHScriptEngine.h" />
<ClInclude Include="src\Tools\SHException.h" />
<ClInclude Include="src\Tools\SHExceptionHandler.h" />
<ClInclude Include="src\Tools\SHFileUtilties.h" />
<ClInclude Include="src\Tools\SHLogger.h" />
<ClInclude Include="src\Tools\SHStringUtils.h" />
<ClInclude Include="src\Tools\SHStringUtils.hpp" />
@ -282,6 +284,7 @@ xcopy /s /r /y /q "$(SolutionDir)/Dependencies/dotnet/bin" "$(OutDir)"</Command
<ClCompile Include="src\Scripting\SHScriptEngine.cpp" />
<ClCompile Include="src\Tools\SHException.cpp" />
<ClCompile Include="src\Tools\SHExceptionHandler.cpp" />
<ClCompile Include="src\Tools\SHFileUtilties.cpp" />
<ClCompile Include="src\Tools\SHLogger.cpp" />
<ClCompile Include="src\Tools\SHStringUtils.cpp" />
</ItemGroup>

View File

@ -375,6 +375,7 @@
<ClInclude Include="src\Resource\SparseSet.hpp">
<Filter>Resource</Filter>
</ClInclude>
<ClInclude Include="src\SHCommonTypes.h" />
<ClInclude Include="src\SH_API.h" />
<ClInclude Include="src\SHpch.h" />
<ClInclude Include="src\Scene\SHScene.h">
@ -401,6 +402,9 @@
<ClInclude Include="src\Tools\SHExceptionHandler.h">
<Filter>Tools</Filter>
</ClInclude>
<ClInclude Include="src\Tools\SHFileUtilties.h">
<Filter>Tools</Filter>
</ClInclude>
<ClInclude Include="src\Tools\SHLogger.h">
<Filter>Tools</Filter>
</ClInclude>
@ -620,6 +624,9 @@
<ClCompile Include="src\Tools\SHExceptionHandler.cpp">
<Filter>Tools</Filter>
</ClCompile>
<ClCompile Include="src\Tools\SHFileUtilties.cpp">
<Filter>Tools</Filter>
</ClCompile>
<ClCompile Include="src\Tools\SHLogger.cpp">
<Filter>Tools</Filter>
</ClCompile>

View File

@ -1,7 +1,7 @@
project "SHADE_Engine"
kind "SharedLib"
language "C++"
cppdialect "C++latest"
cppdialect "C++20"
targetdir (outputdir)
objdir (interdir)
systemversion "latest"
@ -88,7 +88,6 @@ project "SHADE_Engine"
postbuildcommands
{
"xcopy /s /r /y /q \"%{IncludeDir.spdlog}/bin\" \"$(OutDir)\"",
"xcopy /s /r /y /q \"%{IncludeDir.dotnet}/bin\" \"$(OutDir)\""
}

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;
}

View File

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

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();
};
}