Merge pull request #98 from SHADE-DP/SP3-6-c-scripting

Added Time class for C#
This commit is contained in:
XiaoQiDigipen 2022-10-19 16:08:38 +08:00 committed by GitHub
commit 2dcf367bc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 70 additions and 1 deletions

View File

@ -14,7 +14,6 @@
#pragma once #pragma once
#include <chrono> #include <chrono>
#include "Tools/SHLogger.h"
#include "SH_API.h" #include "SH_API.h"
namespace SHADE namespace SHADE

View File

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

View File

@ -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
{
/// <summary>
/// Static class that contains the functions for working with time.
/// </summary>
public ref class Time abstract sealed
{
public:
/*-----------------------------------------------------------------------------*/
/* Properties */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// 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.
/// </summary>
static property double DeltaTime
{
double get();
}
};
}