From a3c4c347bb4fb899a6bcaf9b03b9ffafd82b1a77 Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Wed, 19 Oct 2022 16:06:26 +0800 Subject: [PATCH] Added Time class for C# --- SHADE_Engine/src/FRC/SHFramerateController.h | 1 - SHADE_Managed/src/Engine/Time.cxx | 29 ++++++++++++++ SHADE_Managed/src/Engine/Time.hxx | 41 ++++++++++++++++++++ 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 SHADE_Managed/src/Engine/Time.cxx create mode 100644 SHADE_Managed/src/Engine/Time.hxx diff --git a/SHADE_Engine/src/FRC/SHFramerateController.h b/SHADE_Engine/src/FRC/SHFramerateController.h index b9637cf2..dbabbac5 100644 --- a/SHADE_Engine/src/FRC/SHFramerateController.h +++ b/SHADE_Engine/src/FRC/SHFramerateController.h @@ -14,7 +14,6 @@ #pragma once #include -#include "Tools/SHLogger.h" #include "SH_API.h" namespace SHADE diff --git a/SHADE_Managed/src/Engine/Time.cxx b/SHADE_Managed/src/Engine/Time.cxx new file mode 100644 index 00000000..ff0628e7 --- /dev/null +++ b/SHADE_Managed/src/Engine/Time.cxx @@ -0,0 +1,29 @@ +/************************************************************************************//*! +\file Time.cxx +\author Tng Kah Wei, kahwei.tng, 390009620 +\par email: kahwei.tng\@digipen.edu +\date Oct 19, 2022 +\brief This file is present so that the properties in Time.hxx would be compiled + into the DLL. + + Note: This file is written in C++17/CLI. + +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 Headers +#include "SHpch.h" +// Primary Header +#include "Time.hxx" + +namespace SHADE +{ + /*---------------------------------------------------------------------------------*/ + /* Properties */ + /*---------------------------------------------------------------------------------*/ + double Time::DeltaTime::get() + { + return SHFrameRateController::GetRawDeltaTime(); + } +} \ No newline at end of file diff --git a/SHADE_Managed/src/Engine/Time.hxx b/SHADE_Managed/src/Engine/Time.hxx new file mode 100644 index 00000000..969eea03 --- /dev/null +++ b/SHADE_Managed/src/Engine/Time.hxx @@ -0,0 +1,41 @@ +/************************************************************************************//*! +\file Time.hxx +\author Tng Kah Wei, kahwei.tng, 390009620 +\par email: kahwei.tng\@digipen.edu +\date Oct 19, 2022 +\brief Contains the definition of the Time static class and the definition of + its properties. + + Note: This file is written in C++17/CLI. + +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 + +#include "FRC/SHFramerateController.h" + +namespace SHADE +{ + /// + /// Static class that contains the functions for working with time. + /// + public ref class Time abstract sealed + { + public: + /*-----------------------------------------------------------------------------*/ + /* Properties */ + /*-----------------------------------------------------------------------------*/ + /// + /// Time taken to process the previous frame. + /// Note, is affected by TimeScale. Use UnscaledDeltaTime if you wish to retrieve + /// real world time. This is also affected by MaxDeltaTime clamping that + /// UnscaledDeltaTime is subject to. + /// + static property double DeltaTime + { + double get(); + } + }; +} \ No newline at end of file