// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
#pragma once
#include "Engine/Level/Types.h"
#include "Engine/Core/Collections/Array.h"
///
/// Scene gameplay updating helper subsystem that boosts the level ticking by providing efficient objects cache.
///
class SceneTicking
{
friend Scene;
public:
///
/// Tick function type.
///
class Tick
{
public:
///
/// Signature of the function to call
///
typedef void (*Signature)();
typedef void (*SignatureObj)(void*);
template
static void MethodCaller(void* callee)
{
(static_cast(callee)->*Method)();
}
public:
void* Callee;
SignatureObj FunctionObj;
public:
template
void Bind(T* callee)
{
Callee = callee;
FunctionObj = &MethodCaller;
}
///
/// Calls the binded function.
///
/// Function result
void Call() const
{
(*FunctionObj)(Callee);
}
};
class TickData
{
public:
Array