Skip to content

Commit

Permalink
clang format
Browse files Browse the repository at this point in the history
  • Loading branch information
GlynLeine committed Nov 28, 2024
1 parent efc8c50 commit 9d16c2c
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 70 deletions.
6 changes: 3 additions & 3 deletions src/core/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
namespace rythe
{
namespace core
{
}
}
{
}
} // namespace rythe

namespace rte = rythe;
127 changes: 60 additions & 67 deletions src/core/program/program.hpp
Original file line number Diff line number Diff line change
@@ -1,85 +1,78 @@
#pragma once
#include <memory>
#include <unordered_map>
#include <vector>
#include <memory>

#include <rsl/primitives>
#include <rsl/logging>
#include <rsl/primitives>

namespace rythe::core
{
class Program;
class Program;

class Engine
{
private:
Program* programPtr = nullptr;
rsl::id_type engineId = 0;

public:
Engine(rsl::id_type id)
: engineId(id)
{
}

class Engine
{
private:
Program* programPtr = nullptr;
rsl::id_type engineId = 0;
public:
Engine(rsl::id_type id) : engineId(id) {}
void setup(Program* ptr);

void setup(Program* ptr);
void update() { rsl::log::debug("Engine[{}] Update", engineId); }

void update()
{
rsl::log::debug("Engine[{}] Update", engineId);
}
void shutdown() { rsl::log::debug("Engine[{}] Shutdown", engineId); }
};

void shutdown()
{
rsl::log::debug("Engine[{}] Shutdown", engineId);
}
};
class Program
{
private:
std::unordered_map<rsl::id_type, std::unique_ptr<Engine>> m_engines;
rsl::id_type m_lastIdx = 0;
bool m_running = false;

class Program
{
private:
std::unordered_map<rsl::id_type, std::unique_ptr<Engine>> m_engines;
rsl::id_type m_lastIdx = 0;
bool m_running = false;
public:
void initialize()
{
rsl::log::debug("Initializing Program Instance");
for (auto& [id, engine] : m_engines)
{
engine->setup(this);
}
m_running = true;
}
public:
void initialize()
{
rsl::log::debug("Initializing Program Instance");
for (auto& [id, engine] : m_engines)
{
engine->setup(this);
}
m_running = true;
}

void update()
{
//In the final version the updates will be handled by a process chain
rsl::log::debug("Program Update");
for (auto& [id, engine] : m_engines)
{
engine->update();
}
}
void update()
{
// In the final version the updates will be handled by a process chain
rsl::log::debug("Program Update");
for (auto& [id, engine] : m_engines)
{
engine->update();
}
}

void shutdown()
{
rsl::log::debug("Program Shutdown");
for (auto& [id, engine] : m_engines)
{
engine->shutdown();
}
}
void shutdown()
{
rsl::log::debug("Program Shutdown");
for (auto& [id, engine] : m_engines)
{
engine->shutdown();
}
}

bool isRunning()
{
return m_running;
}
bool isRunning() { return m_running; }

void stop()
{
m_running = false;
}
void stop() { m_running = false; }

Engine& addEngineInstance()
{
return *(m_engines.emplace(m_lastIdx, std::make_unique<Engine>(Engine{ m_lastIdx++})).first->second);
}
};
}
Engine& addEngineInstance()
{
return *(m_engines.emplace(m_lastIdx, std::make_unique<Engine>(Engine{m_lastIdx++})).first->second);
}
};
} // namespace rythe::core

0 comments on commit 9d16c2c

Please sign in to comment.