diff --git a/SHADE_Application/SHADE_Application.vcxproj b/SHADE_Application/SHADE_Application.vcxproj index 89d28988..f49865b3 100644 --- a/SHADE_Application/SHADE_Application.vcxproj +++ b/SHADE_Application/SHADE_Application.vcxproj @@ -66,7 +66,7 @@ false MultiThreadedDebugDLL true - stdcpplatest + stdcpp20 Windows @@ -88,7 +88,7 @@ true MultiThreadedDLL true - stdcpplatest + stdcpp20 Windows diff --git a/SHADE_Application/premake5.lua b/SHADE_Application/premake5.lua index 44abdd6c..468eac39 100644 --- a/SHADE_Application/premake5.lua +++ b/SHADE_Application/premake5.lua @@ -1,7 +1,7 @@ project "SHADE_Application" kind "WindowedApp" language "C++" - cppdialect "C++latest" + cppdialect "C++20" targetdir (outputdir) objdir (interdir) systemversion "latest" diff --git a/SHADE_Application/src/Application/SBApplication.cpp b/SHADE_Application/src/Application/SBApplication.cpp index aa0f5a9b..3e5e116d 100644 --- a/SHADE_Application/src/Application/SBApplication.cpp +++ b/SHADE_Application/src/Application/SBApplication.cpp @@ -6,6 +6,9 @@ #include "Scenes/SBEditorScene.h" #endif // SHEDITOR +#include "Tools/SHLogger.h" +#include "Tools/SHFileUtilties.h" + #include #include #include @@ -23,7 +26,9 @@ namespace Sandbox _In_ INT nCmdShow ) { - + // Set working directory + SHADE::SHFileUtilities::SetWorkDirToExecDir(); + window.Create(hInstance, hPrevInstance, lpCmdLine, nCmdShow); #ifdef SHEDITOR diff --git a/SHADE_Engine/SHADE_Engine.vcxproj b/SHADE_Engine/SHADE_Engine.vcxproj index 301827df..9c568502 100644 --- a/SHADE_Engine/SHADE_Engine.vcxproj +++ b/SHADE_Engine/SHADE_Engine.vcxproj @@ -66,7 +66,7 @@ false MultiThreadedDebugDLL true - stdcpplatest + stdcpp20 Windows @@ -94,7 +94,7 @@ xcopy /s /r /y /q "$(SolutionDir)/Dependencies/dotnet/bin" "$(OutDir)"true MultiThreadedDLL true - stdcpplatest + stdcpp20 Windows @@ -195,6 +195,7 @@ xcopy /s /r /y /q "$(SolutionDir)/Dependencies/dotnet/bin" "$(OutDir)" + @@ -205,6 +206,7 @@ xcopy /s /r /y /q "$(SolutionDir)/Dependencies/dotnet/bin" "$(OutDir)" + @@ -282,6 +284,7 @@ xcopy /s /r /y /q "$(SolutionDir)/Dependencies/dotnet/bin" "$(OutDir)" + diff --git a/SHADE_Engine/SHADE_Engine.vcxproj.filters b/SHADE_Engine/SHADE_Engine.vcxproj.filters index 9877e494..cafb3da3 100644 --- a/SHADE_Engine/SHADE_Engine.vcxproj.filters +++ b/SHADE_Engine/SHADE_Engine.vcxproj.filters @@ -375,6 +375,7 @@ Resource + @@ -401,6 +402,9 @@ Tools + + Tools + Tools @@ -620,6 +624,9 @@ Tools + + Tools + Tools diff --git a/SHADE_Engine/premake5.lua b/SHADE_Engine/premake5.lua index 2b110e45..6d6cb17f 100644 --- a/SHADE_Engine/premake5.lua +++ b/SHADE_Engine/premake5.lua @@ -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)\"" } diff --git a/SHADE_Engine/src/SHCommonTypes.h b/SHADE_Engine/src/SHCommonTypes.h new file mode 100644 index 00000000..97ef7928 --- /dev/null +++ b/SHADE_Engine/src/SHCommonTypes.h @@ -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; +} diff --git a/SHADE_Engine/src/SHpch.h b/SHADE_Engine/src/SHpch.h index 0342eedb..1db73cb9 100644 --- a/SHADE_Engine/src/SHpch.h +++ b/SHADE_Engine/src/SHpch.h @@ -30,3 +30,5 @@ #include #include #include + +#include "SHCommonTypes.h" \ No newline at end of file diff --git a/SHADE_Engine/src/Tools/SHFileUtilties.cpp b/SHADE_Engine/src/Tools/SHFileUtilties.cpp new file mode 100644 index 00000000..0e75b16a --- /dev/null +++ b/SHADE_Engine/src/Tools/SHFileUtilties.cpp @@ -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 +// External Dependencies +#include // GetModuleFileName, PathRemoveFileSpec + +namespace SHADE +{ + void SHFileUtilities::SetWorkDirToExecDir() + { + TCHAR currentExecFilePath[MAX_PATH] = { '\0' }; + GetModuleFileName(nullptr, currentExecFilePath, MAX_PATH); + PathRemoveFileSpec(currentExecFilePath); + std::filesystem::current_path(currentExecFilePath); + } +} diff --git a/SHADE_Engine/src/Tools/SHFileUtilties.h b/SHADE_Engine/src/Tools/SHFileUtilties.h new file mode 100644 index 00000000..b9ba164b --- /dev/null +++ b/SHADE_Engine/src/Tools/SHFileUtilties.h @@ -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(); + }; +}