Fixed wrong include
This commit is contained in:
@@ -19,18 +19,17 @@
|
||||
|
||||
namespace Nuake
|
||||
{
|
||||
Ref<Project> Engine::currentProject;
|
||||
Ref<Window> Engine::currentWindow;
|
||||
|
||||
Ref<Project> Engine::s_CurrentProject;
|
||||
Ref<Window> Engine::s_CurrentWindow;
|
||||
GameState Engine::gameState = GameState::Stopped;
|
||||
|
||||
GameState Engine::s_GameState = GameState::Stopped;
|
||||
|
||||
float Engine::s_LastFrameTime = 0.0f;
|
||||
float Engine::s_FixedUpdateRate = 1.0f / 90.0f;
|
||||
float Engine::s_FixedUpdateDifference = 0.f;
|
||||
float Engine::s_Time = 0.f;
|
||||
Timestep Engine::s_TimeStep = 0.f;
|
||||
float Engine::s_TimeScale = 1.0f;
|
||||
float Engine::lastFrameTime = 0.0f;
|
||||
float Engine::fixedUpdateRate = 1.0f / 90.0f;
|
||||
float Engine::fixedUpdateDifference = 0.f;
|
||||
float Engine::time = 0.f;
|
||||
Timestep Engine::timeStep = 0.f;
|
||||
float Engine::timeScale = 1.0f;
|
||||
|
||||
void Engine::Init()
|
||||
{
|
||||
@@ -39,7 +38,7 @@ namespace Nuake
|
||||
NavManager::Get().Initialize();
|
||||
|
||||
// Creates the window
|
||||
s_CurrentWindow = Window::Get();
|
||||
currentWindow = Window::Get();
|
||||
|
||||
Input::Init();
|
||||
Renderer2D::Init();
|
||||
@@ -54,15 +53,15 @@ namespace Nuake
|
||||
|
||||
JobSystem::Get().Update();
|
||||
|
||||
s_Time = static_cast<float>(glfwGetTime());
|
||||
s_TimeStep = s_Time - s_LastFrameTime;
|
||||
s_LastFrameTime = s_Time;
|
||||
time = static_cast<float>(glfwGetTime());
|
||||
timeStep = time - lastFrameTime;
|
||||
lastFrameTime = time;
|
||||
|
||||
// Dont update if no scene is loaded.
|
||||
if (s_CurrentWindow->GetScene())
|
||||
if (currentWindow->GetScene())
|
||||
{
|
||||
float scaledTimeStep = s_TimeStep * s_TimeScale;
|
||||
s_CurrentWindow->Update(scaledTimeStep);
|
||||
float scaledTimeStep = timeStep * timeScale;
|
||||
currentWindow->Update(scaledTimeStep);
|
||||
|
||||
// Play mode update all the entities, Editor does not.
|
||||
if (!Engine::IsPlayMode())
|
||||
@@ -70,14 +69,14 @@ namespace Nuake
|
||||
GetCurrentScene()->EditorUpdate(scaledTimeStep);
|
||||
}
|
||||
|
||||
s_FixedUpdateDifference += s_TimeStep;
|
||||
fixedUpdateDifference += timeStep;
|
||||
|
||||
// Fixed update
|
||||
while (s_FixedUpdateDifference >= s_FixedUpdateRate)
|
||||
while (fixedUpdateDifference >= fixedUpdateRate)
|
||||
{
|
||||
s_CurrentWindow->FixedUpdate(s_FixedUpdateRate * s_TimeScale);
|
||||
currentWindow->FixedUpdate(fixedUpdateRate * timeScale);
|
||||
|
||||
s_FixedUpdateDifference -= s_FixedUpdateRate;
|
||||
fixedUpdateDifference -= fixedUpdateRate;
|
||||
}
|
||||
|
||||
Input::Update();
|
||||
@@ -87,7 +86,7 @@ namespace Nuake
|
||||
|
||||
void Engine::EnterPlayMode()
|
||||
{
|
||||
s_LastFrameTime = (float)glfwGetTime(); // Reset timestep timer.
|
||||
lastFrameTime = (float)glfwGetTime(); // Reset timestep timer.
|
||||
|
||||
// Dont trigger init if already in player mode.
|
||||
if (GetGameState() == GameState::Playing)
|
||||
@@ -112,11 +111,11 @@ namespace Nuake
|
||||
void Engine::ExitPlayMode()
|
||||
{
|
||||
// Dont trigger exit if already not in play mode.
|
||||
if (s_GameState != GameState::Stopped)
|
||||
if (gameState != GameState::Stopped)
|
||||
{
|
||||
GetCurrentScene()->OnExit();
|
||||
Input::ShowMouse();
|
||||
s_GameState = GameState::Stopped;
|
||||
gameState = GameState::Stopped;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,9 +151,9 @@ namespace Nuake
|
||||
|
||||
Ref<Scene> Engine::GetCurrentScene()
|
||||
{
|
||||
if (s_CurrentWindow)
|
||||
if (currentWindow)
|
||||
{
|
||||
return s_CurrentWindow->GetScene();
|
||||
return currentWindow->GetScene();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
@@ -162,19 +161,19 @@ namespace Nuake
|
||||
|
||||
bool Engine::LoadScene(Ref<Scene> scene)
|
||||
{
|
||||
return s_CurrentWindow->SetScene(scene);
|
||||
return currentWindow->SetScene(scene);
|
||||
}
|
||||
|
||||
Ref<Project> Engine::GetProject()
|
||||
{
|
||||
return s_CurrentProject;
|
||||
return currentProject;
|
||||
}
|
||||
|
||||
bool Engine::LoadProject(Ref<Project> project)
|
||||
{
|
||||
s_CurrentProject = project;
|
||||
currentProject = project;
|
||||
|
||||
if (!Engine::LoadScene(s_CurrentProject->DefaultScene))
|
||||
if (!Engine::LoadScene(currentProject->DefaultScene))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -188,6 +187,6 @@ namespace Nuake
|
||||
|
||||
Ref<Window> Engine::GetCurrentWindow()
|
||||
{
|
||||
return s_CurrentWindow;
|
||||
return currentWindow;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
#pragma once
|
||||
#include "NuakePCH.h"
|
||||
#include "src/Core/Core.h"
|
||||
#include "src/Core/Logger.h"
|
||||
#include "src/Window.h"
|
||||
#include "src/Scene/Scene.h"
|
||||
#include "src/Resource/Project.h"
|
||||
#include "src/Core/Logger.h"
|
||||
|
||||
/* TODOS:
|
||||
|
||||
*/
|
||||
|
||||
// Welcome to the Nuake source code.
|
||||
namespace Nuake
|
||||
@@ -21,19 +18,7 @@ namespace Nuake
|
||||
|
||||
class Engine
|
||||
{
|
||||
private:
|
||||
static Ref<Window> s_CurrentWindow;
|
||||
static Ref<Project> s_CurrentProject;
|
||||
static Ref<Scene> s_CurrentScene;
|
||||
|
||||
static GameState s_GameState;
|
||||
|
||||
static float s_LastFrameTime;
|
||||
static float s_FixedUpdateRate;
|
||||
static float s_FixedUpdateDifference;
|
||||
static float s_Time;
|
||||
static Timestep s_TimeStep;
|
||||
static float s_TimeScale;
|
||||
public:
|
||||
static void Init(); // Initialize the engine.
|
||||
static void Tick(); // Updates everything, called every frame.
|
||||
@@ -46,16 +31,16 @@ namespace Nuake
|
||||
static void Draw(); // Start new frame
|
||||
static void EndDraw(); // Swap buffer
|
||||
|
||||
static void SetGameState(GameState gameState) { s_GameState = gameState; }
|
||||
static GameState GetGameState() { return s_GameState; }
|
||||
static bool IsPlayMode() { return s_GameState == GameState::Playing; }
|
||||
static void SetGameState(GameState gameState) { gameState = gameState; }
|
||||
static GameState GetGameState() { return gameState; }
|
||||
static bool IsPlayMode() { return gameState == GameState::Playing; }
|
||||
|
||||
static inline float GetTime() { return s_Time; }
|
||||
static inline Timestep GetTimestep() { return s_TimeStep; }
|
||||
static inline void SetPhysicsStep(int amount) { s_FixedUpdateRate = 1.0f / static_cast<float>(amount); }
|
||||
static inline float GetFixedTimeStep() { return s_FixedUpdateRate; }
|
||||
static inline void SetTimeScale(float timeScale) { s_TimeScale = timeScale; }
|
||||
static inline float GetTimeScale() { return s_TimeScale; }
|
||||
static inline float GetTime() { return time; }
|
||||
static inline Timestep GetTimestep() { return timeStep; }
|
||||
static inline void SetPhysicsStep(int amount) { fixedUpdateRate = 1.0f / static_cast<float>(amount); }
|
||||
static inline float GetFixedTimeStep() { return fixedUpdateRate; }
|
||||
static inline void SetTimeScale(float timeScale) { timeScale = timeScale; }
|
||||
static inline float GetTimeScale() { return timeScale; }
|
||||
|
||||
static Ref<Window> GetCurrentWindow();
|
||||
|
||||
@@ -65,6 +50,20 @@ namespace Nuake
|
||||
static bool LoadProject(Ref<Project> project);
|
||||
static Ref<Project> GetProject();
|
||||
|
||||
private:
|
||||
static Ref<Window> currentWindow;
|
||||
static Ref<Project> currentProject;
|
||||
static Ref<Scene> currentScene;
|
||||
|
||||
static GameState gameState;
|
||||
|
||||
static float lastFrameTime;
|
||||
static float fixedUpdateRate;
|
||||
static float fixedUpdateDifference;
|
||||
static float time;
|
||||
static Timestep timeStep;
|
||||
static float timeScale;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "Components/AudioEmitterComponent.h"
|
||||
#include "Components/BaseComponent.h"
|
||||
#include "Components/BoneComponent.h"
|
||||
@@ -20,6 +21,8 @@
|
||||
#include "Components/QuakeMap.h"
|
||||
#include "Components/RigidbodyComponent.h"
|
||||
#include "Components/SkinnedModelComponent.h"
|
||||
#include "Components/SphereCollider.h"
|
||||
#include "Components/SpriteComponent.h"
|
||||
#include "Components/TransformComponent.h"
|
||||
#include "Components/WrenScriptComponent.h"
|
||||
|
||||
|
||||
@@ -1,24 +1,7 @@
|
||||
#include "Entity.h"
|
||||
|
||||
#include "src/Scene/Components/ParentComponent.h"
|
||||
#include "src/Scene/Components/NameComponent.h"
|
||||
#include "src/Scene/Components/TransformComponent.h"
|
||||
#include "src/Scene/Components/CameraComponent.h"
|
||||
#include "src/Scene/Components/QuakeMap.h"
|
||||
#include "src/Scene/Components/LightComponent.h"
|
||||
#include "src/Scene/Components/QuakeMap.h"
|
||||
#include "src/Scene/Components/WrenScriptComponent.h"
|
||||
#include "src/Scene/Components/CharacterControllerComponent.h"
|
||||
#include "src/Scene/Components/RigidbodyComponent.h"
|
||||
#include "src/Scene/Components/BSPBrushComponent.h"
|
||||
#include "src/Scene/Components/Components.h"
|
||||
#include "src/Scene/Components/BoxCollider.h"
|
||||
#include "src/Scene/Components/CapsuleColliderComponent.h"
|
||||
#include "src/Scene/Components/SpriteComponent.h"
|
||||
#include "src/Scene/Components/ParticleEmitterComponent.h"
|
||||
#include "src/Scene/Components/BoneComponent.h"
|
||||
#include "src/Scene/Components/SkinnedModelComponent.h"
|
||||
#include <src/Scene/Components/NavMeshVolumeComponent.h>
|
||||
#include "src/Scene/Components.h"
|
||||
|
||||
|
||||
namespace Nuake
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user