refactored MainWindow and Engine, changed project structure

This commit is contained in:
2025-04-26 00:59:47 +05:00
parent bb00392e3a
commit d659dcde10
54 changed files with 1662 additions and 339 deletions

View File

@@ -2,7 +2,7 @@
#include <bit>
#include <cstring>
namespace ougge {
namespace ougge::game {
GameObjectPool::GameObjectPool(u32 size)
{
@@ -75,9 +75,9 @@ u32 GameObjectPool::getNearestUsedIndex(u32 startIndex)
GameObject& GameObjectPool::get(u32 index)
{
if(index >= size)
throw UsefulException(format("index %i is out of size %i", index, size));
throw UsefulException(ougge_format("index %i is out of size %i", index, size));
if(!isIndexUsed(index))
throw UsefulException(format("there is no object at index %i", index));
throw UsefulException(ougge_format("there is no object at index %i", index));
return buffer[index];
}
@@ -97,9 +97,9 @@ std::pair<u32, GameObject&> GameObjectPool::emplace(GameObject&& new_obj)
void GameObjectPool::erase(u32 index)
{
if(index >= size)
throw UsefulException(format("index %i is out of size %i", index, size));
throw UsefulException(ougge_format("index %i is out of size %i", index, size));
if(!isIndexUsed(index))
throw UsefulException(format("there is no object at index %i", index));
throw UsefulException(ougge_format("there is no object at index %i", index));
buffer[index] = GameObject();
used_indices[index/64] &= ~(u64(1)<<(index%64)); // mark index bit as unused