Removing named namespace from code base.

This commit is contained in:
2026-08-22 21:39:21 -04:00
parent 678795b793
commit 4180622d6a
158 changed files with 12260 additions and 12648 deletions
+25 -25
View File
@@ -1,4 +1,4 @@
#include <Controller/DebugCameraController.h>
#include <Controller/DebugCameraController.h>
#include <Controller/ControllerUtils.h>
#include <Core/Common/CoreUtils.h>
@@ -24,10 +24,10 @@ void ActivateDebugController()
{
Assert(gIsDebugCameraActive == false);
Juliet::Camera* currentCam = Juliet::GetCurrentCamera();
Camera* currentCam = GetCurrentCamera();
gPreviousCameraIndex = currentCam->Index;
Juliet::SetCurrentCamera(kDebugCamera);
SetCurrentCamera(kDebugCamera);
gIsDebugCameraActive = true;
gFirstUpdate = true;
@@ -41,7 +41,7 @@ void DeactivateDebugController()
gIsDebugCameraActive = false;
Juliet::SetCurrentCamera(gPreviousCameraIndex);
SetCurrentCamera(gPreviousCameraIndex);
}
bool IsDebugControllerActive()
@@ -51,26 +51,26 @@ bool IsDebugControllerActive()
void UpdateDebugController(float dt)
{
Juliet::Camera* currentCam = Juliet::GetCurrentCamera();
Camera* currentCam = GetCurrentCamera();
if (gFirstUpdate)
{
Juliet::Vector3 dir = Juliet::Vector3{ 0.0f, 0.0f, 0.0f } - currentCam->Position;
dir = Juliet::Normalize(dir);
Vector3 dir = Vector3{ 0.0f, 0.0f, 0.0f } - currentCam->Position;
dir = Normalize(dir);
gPitch = asinf(dir.z);
gYaw = atan2f(dir.y, dir.x);
gFirstUpdate = false;
Juliet::Vector3 forward;
Vector3 forward;
forward.x = cosf(gPitch) * cosf(gYaw);
forward.y = cosf(gPitch) * sinf(gYaw);
forward.z = sinf(gPitch);
Juliet::Vector3 right = Juliet::Normalize(Juliet::Cross(Juliet::Vector3{ 0.0f, 0.0f, 1.0f }, forward));
Vector3 right = Normalize(Cross(Vector3{ 0.0f, 0.0f, 1.0f }, forward));
currentCam->Target = currentCam->Position + forward;
currentCam->Up = Juliet::Cross(forward, right);
currentCam->Up = Cross(forward, right);
}
bool isRightMouseButtonDown = Juliet::IsMouseButtonDown(Juliet::MouseButton::Right);
bool isRightMouseButtonDown = IsMouseButtonDown(MouseButton::Right);
if (isRightMouseButtonDown && !gWasRightMouseButtonDown)
{
gIsFpsModeActive = !gIsFpsModeActive;
@@ -82,7 +82,7 @@ void UpdateDebugController(float dt)
return;
}
Juliet::MousePosition mouseDelta = Juliet::GetMouseDelta();
MousePosition mouseDelta = GetMouseDelta();
float sensitivity = 0.005f;
gYaw += mouseDelta.X * sensitivity;
@@ -91,52 +91,52 @@ void UpdateDebugController(float dt)
gPitch = std::min(gPitch, 1.5f);
gPitch = std::max(gPitch, -1.5f);
if (Juliet::IsKeyDown(Juliet::ScanCode::Q))
if (IsKeyDown(ScanCode::Q))
{
gYaw -= 2.0f * dt;
}
if (Juliet::IsKeyDown(Juliet::ScanCode::E))
if (IsKeyDown(ScanCode::E))
{
gYaw += 2.0f * dt;
}
Juliet::Vector3 forward;
Vector3 forward;
forward.x = cosf(gPitch) * cosf(gYaw);
forward.y = cosf(gPitch) * sinf(gYaw);
forward.z = sinf(gPitch);
Juliet::Vector3 right = Juliet::Normalize(Juliet::Cross(Juliet::Vector3{ 0.0f, 0.0f, 1.0f }, forward));
Juliet::Vector3 defaultUp = Juliet::Cross(forward, right);
Vector3 right = Normalize(Cross(Vector3{ 0.0f, 0.0f, 1.0f }, forward));
Vector3 defaultUp = Cross(forward, right);
static const float kMovementPerFrame = 10.f; // 10m/s
float speedPerFrame = kMovementPerFrame;
if (Juliet::IsKeyDown(Juliet::ScanCode::LeftShift))
if (IsKeyDown(ScanCode::LeftShift))
{
speedPerFrame *= 10.f; // 100m/s
}
if (Juliet::IsKeyDown(Juliet::ScanCode::W))
if (IsKeyDown(ScanCode::W))
{
currentCam->Position = currentCam->Position + forward * (speedPerFrame * dt);
}
if (Juliet::IsKeyDown(Juliet::ScanCode::S))
if (IsKeyDown(ScanCode::S))
{
currentCam->Position = currentCam->Position - forward * (speedPerFrame * dt);
}
if (Juliet::IsKeyDown(Juliet::ScanCode::D))
if (IsKeyDown(ScanCode::D))
{
currentCam->Position = currentCam->Position + right * (speedPerFrame * dt);
}
if (Juliet::IsKeyDown(Juliet::ScanCode::A))
if (IsKeyDown(ScanCode::A))
{
currentCam->Position = currentCam->Position - right * (speedPerFrame * dt);
}
if (Juliet::IsKeyDown(Juliet::ScanCode::Space))
if (IsKeyDown(ScanCode::Space))
{
currentCam->Position = currentCam->Position + defaultUp * (speedPerFrame * dt);
}
if (Juliet::IsKeyDown(Juliet::ScanCode::LeftControl))
if (IsKeyDown(ScanCode::LeftControl))
{
currentCam->Position = currentCam->Position - defaultUp * (speedPerFrame * dt);
}
@@ -148,7 +148,7 @@ void UpdateDebugController(float dt)
#if JULIET_DEBUG
void RenderImGuiDebugController(float dt)
{
Juliet::Camera* currentCam = Juliet::GetCurrentCamera();
Camera* currentCam = GetCurrentCamera();
ImGui::Text("Delta time: %f", dt);
+2 -3
View File
@@ -1,13 +1,12 @@
#include <Debug/DebugTopBar.h>
#include <Debug/DebugTopBar.h>
#include <game.h>
#include <imgui.h>
namespace
{
Juliet::String GetGameModeName(GameMode gameMode)
String GetGameModeName(GameMode gameMode)
{
using namespace Juliet;
switch (gameMode)
{
case GameMode::Editor: return WrapString("Editor");
+7 -7
View File
@@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <Core/Common/CoreUtils.h>
#include <Core/Memory/Allocator.h>
@@ -8,19 +8,19 @@
#define DECLARE_ENTITY() \
Entity* Base; \
static const Juliet::Class* Kind;
static const Class* Kind;
// Will register the class globally at launch
#define DEFINE_ENTITY(entity) \
constexpr Juliet::Class entityKind##entity(#entity, sizeof(#entity) / sizeof(char)); \
const Juliet::Class* entity::Kind = &entityKind##entity;
constexpr Class entityKind##entity(#entity, sizeof(#entity) / sizeof(char)); \
const Class* entity::Kind = &entityKind##entity;
using DerivedType = void*;
struct Entity final
{
EntityID ID;
const Juliet::Class* Kind;
const Class* Kind;
DerivedType Derived;
float X, Y;
index_t MeshInstance = indexMax;
@@ -28,7 +28,7 @@ struct Entity final
template <typename EntityType>
concept EntityConcept = requires(EntityType entity) {
requires std::same_as<decltype(entity.Kind), const Juliet::Class*>;
requires std::same_as<decltype(entity.Kind), const Class*>;
requires std::same_as<decltype(entity.Base), Entity*>;
};
@@ -44,7 +44,7 @@ template <typename EntityType>
EntityType* MakeEntity(EntityManager& manager, float x, float y)
{
auto* arena = manager.Arena;
EntityType* result = Juliet::ArenaPushStruct<EntityType>(arena);
EntityType* result = ArenaPushStruct<EntityType>(arena);
Entity base;
base.X = x;
base.Y = y;
+6 -6
View File
@@ -1,18 +1,18 @@
#include <Entity/EntityManager.h>
#include <Entity/EntityManager.h>
#include <Entity/Entity.h>
#include <Graphics/MeshRenderer.h>
EntityID EntityManager::ID = 0;
void InitEntityManager(Juliet::NonNullPtr<World> world)
void InitEntityManager(NonNullPtr<World> world)
{
EntityManager* newManager = Juliet::ArenaPushStruct<EntityManager>(world->WorldArena);
EntityManager* newManager = ArenaPushStruct<EntityManager>(world->WorldArena);
world->EntityManager = newManager;
newManager->Entities.Create(world->WorldArena JULIET_DEBUG_PARAM("Entities"));
newManager->Arena = Juliet::ArenaAllocate({ .Name = "Entity Arena" });
newManager->Arena = ArenaAllocate({ .Name = "Entity Arena" });
}
void ShutdownEntityManager()
@@ -22,7 +22,7 @@ void ShutdownEntityManager()
EntityManager& GetEntityManager()
{
Juliet::NonNullPtr entityManager = GetGameState()->World->EntityManager;
NonNullPtr entityManager = GetGameState()->World->EntityManager;
return *entityManager;
}
@@ -37,7 +37,7 @@ void UpdateEntityManager(EntityManager& manager)
{
if (ent.MeshInstance != indexMax)
{
Juliet::SetMeshInstanceTransform(ent.MeshInstance, Juliet::MatrixTranslation(ent.X, ent.Y, 0.0f));
SetMeshInstanceTransform(ent.MeshInstance, MatrixTranslation(ent.X, ent.Y, 0.0f));
}
}
}
+4 -4
View File
@@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <Core/Common/CoreTypes.h>
#include <Core/Container/Vector.h>
@@ -11,13 +11,13 @@ struct EntityManager
{
static EntityID ID;
Juliet::Arena* Arena;
Arena* Arena;
// TODO: Should be a pool
Juliet::VectorArena<Entity, 1024> Entities;
VectorArena<Entity, 1024> Entities;
};
void InitEntityManager(Juliet::NonNullPtr<World> world);
void InitEntityManager(NonNullPtr<World> world);
void ShutdownEntityManager();
EntityManager& GetEntityManager();
void RegisterEntity(EntityManager& manager, Entity* entity);
+2 -4
View File
@@ -1,4 +1,4 @@
#include <game.h>
#include <game.h>
#include <Controller/DebugCameraController.h>
#include <Core/HAL/Filesystem/Filesystem.h>
@@ -31,14 +31,12 @@ extern "C" JULIET_API void __cdecl GameShutdown()
{
printf("Shutting down game...\n");
using namespace Juliet;
ShutdownEntityManager();
}
extern "C" JULIET_API void __cdecl GameUpdate(Juliet::GameData* params, [[maybe_unused]] float deltaTime)
extern "C" JULIET_API void __cdecl GameUpdate(GameData* params, [[maybe_unused]] float deltaTime)
{
using namespace Juliet;
gGameState = params->GameState;
if (!gGameState)
+3 -3
View File
@@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <Core/Memory/MemoryArena.h>
@@ -6,7 +6,7 @@ struct EntityManager;
struct World
{
Juliet::Arena* WorldArena;
Arena* WorldArena;
EntityManager* EntityManager;
};
@@ -19,7 +19,7 @@ enum class GameMode
struct GameState
{
Juliet::Arena* TotalArena;
Arena* TotalArena;
World* World;