forked from migon25/EclipseEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from migon25/Structure_Remake
Structure remake
- Loading branch information
Showing
228 changed files
with
6,179,917 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -399,4 +399,4 @@ FodyWeavers.xsd | |
|
||
# vcpkg_installed | ||
vcpkg_installed/ | ||
vcpkg/ | ||
vcpkg/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "vcpkg"] | ||
path = vcpkg | ||
url = https://github.com/microsoft/vcpkg.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<VcpkgRoot>$(MSBuildThisFileDirectory)vcpkg</VcpkgRoot> | ||
<VcpkgEnableManifest>true</VcpkgEnableManifest> | ||
<VcpkgManifestInstall>true</VcpkgManifestInstall> | ||
<VcpkgManifestRoot>$(MSBuildThisFileDirectory)</VcpkgManifestRoot> | ||
</PropertyGroup> | ||
<Import Project="$(MSBuildThisFileDirectory)vcpkg\scripts\buildsystems\msbuild\vcpkg.props" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Project> | ||
|
||
<Target Name="VcPkgBootstrap" BeforeTargets="ClCompile" Condition="!Exists('$(MSBuildThisFileDirectory)vcpkg\vcpkg.exe')"> | ||
<Exec Command="$(MSBuildThisFileDirectory)vcpkg\bootstrap-vcpkg.bat" /> | ||
</Target> | ||
|
||
<Target Name="VcPkgClean" AfterTargets="Clean" Condition="Exists('$(MSBuildThisFileDirectory)vcpkg\vcpkg.exe')"> | ||
<Delete Files="$(MSBuildThisFileDirectory)vcpkg\vcpkg.exe" /> | ||
</Target> | ||
|
||
<Import Project="$(MSBuildThisFileDirectory)vcpkg\scripts\buildsystems\msbuild\vcpkg.targets" /> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
#include "EclipseEngine/Logger.h" | ||
#include "App.h" | ||
|
||
Core* core = NULL; | ||
|
||
App::App(int argc, char* args[]) | ||
{ | ||
core = new Core(); | ||
panelHandler = new PanelHandler(this); | ||
editorCamera = new Camera(core->window->GetWidth(), core->window->GetHeight(), glm::vec3(38.0f, 20.0f, -37.0f)); | ||
editorRenderer = new EditorRenderer(); | ||
|
||
AddModule(editorRenderer, true); | ||
AddModule(panelHandler, true); | ||
} | ||
|
||
App::~App() | ||
{ | ||
} | ||
|
||
bool App::Initialize() | ||
{ | ||
if(!core->Initialize()) return false; | ||
for (std::list<Module*>::iterator it = modules.begin(); it != modules.end(); it++) | ||
{ | ||
if (!(*it)->Initialize()) return false; | ||
} | ||
m_fpsPanel = std::dynamic_pointer_cast<FPSPanel>(panelHandler->GetPanel("FPS Panel")); | ||
return true; | ||
} | ||
|
||
bool App::Start() | ||
{ | ||
Initialize(); | ||
return true; | ||
} | ||
|
||
bool App::Update() | ||
{ | ||
float currentFrame = glfwGetTime(); | ||
dt = currentFrame - lastFrame; | ||
lastFrame = currentFrame; | ||
float fps = 1.0f / dt; // Assuming dt is the delta time (time since last frame in seconds) | ||
float ms = dt * 1000.0f; // Convert delta time to milliseconds | ||
|
||
if (m_fpsPanel) { | ||
if (auto fpsPanel = dynamic_cast<FPSPanel*>(m_fpsPanel.get())) { | ||
fpsPanel->Update(fps, ms); | ||
} | ||
} | ||
|
||
// Pass these values to the FPS panel | ||
if (!PreUpdate()) return false; | ||
if (!DoUpdate()) return false; | ||
if (!PostUpdate()) return false; | ||
return true; | ||
} | ||
|
||
bool App::CleanUp() | ||
{ | ||
for (std::list<Module*>::iterator it = modules.begin(); it != modules.end(); it++) | ||
{ | ||
(*it)->CleanUp(); | ||
} | ||
core->CleanUp(); | ||
return true; | ||
} | ||
|
||
void App::AddModule(Module* module, bool activate) | ||
{ | ||
if (activate) module->Enable(); | ||
modules.push_back(module); | ||
} | ||
|
||
bool App::PreUpdate() | ||
{ | ||
editorCamera->UpdateMatrix(0.1f, 200.0f); | ||
for (std::list<Module*>::iterator it = modules.begin(); it != modules.end(); it++) | ||
{ | ||
if ((*it)->active == false) continue; | ||
if (!(*it)->PreUpdate()) return false; | ||
} | ||
editorRenderer->Render(core->scene, editorCamera, panelHandler->hierarchyPanel->GetSelectedObject()); | ||
if (!core->PreUpdate()) return false; | ||
return true; | ||
} | ||
|
||
bool App::DoUpdate() | ||
{ | ||
if (!core->Update(dt)) return false; | ||
for (std::list<Module*>::iterator it = modules.begin(); it != modules.end(); it++) | ||
{ | ||
if ((*it)->active == false) continue; | ||
if (!(*it)->Update(dt)) return false; | ||
} | ||
return true; | ||
} | ||
|
||
bool App::PostUpdate() | ||
{ | ||
if (!core->PostUpdate()) return false; | ||
for (std::list<Module*>::iterator it = modules.begin(); it != modules.end(); it++) | ||
{ | ||
if ((*it)->active == false) continue; | ||
if (!(*it)->PostUpdate()) return false; | ||
} | ||
|
||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#ifndef APP_H | ||
#define APP_H | ||
|
||
#include <memory> | ||
#include <vector> | ||
#include <string> | ||
#include <list> | ||
|
||
#include "EclipseEngine/Core.h" | ||
#include "EclipseEngine/Logger.h" | ||
#include "EclipseEngine/Camera.h" | ||
|
||
#include "Module.h" | ||
#include "Panel.h" | ||
#include "PanelHandler.h" | ||
#include "FPSpanel.h" | ||
#include "EditorRenderer.h" | ||
|
||
class PanelHandler; | ||
|
||
class App | ||
{ | ||
public: | ||
App(int argc, char* args[]); | ||
virtual ~App(); | ||
|
||
bool Initialize(); | ||
bool Start(); // Called before the first frame | ||
bool Update(); // Called each loop iteration | ||
bool CleanUp(); // Called before quitting | ||
|
||
// used for adding new modules we are going to have | ||
void AddModule(Module* module, bool activate); | ||
|
||
public: | ||
PanelHandler* panelHandler = nullptr; | ||
Camera* editorCamera = nullptr; | ||
EditorRenderer* editorRenderer = nullptr; | ||
|
||
private: | ||
// these functions are called in each llop iteration | ||
bool PreUpdate(); | ||
bool DoUpdate(); | ||
bool PostUpdate(); | ||
|
||
private: | ||
std::string name; | ||
|
||
// List of modules | ||
std::list<Module*> modules; | ||
std::shared_ptr<FPSPanel> m_fpsPanel; | ||
|
||
double dt = 0.0f; | ||
double lastFrame = 0.0f; | ||
|
||
}; | ||
|
||
#endif // APP_H |
Oops, something went wrong.