Added tracy for debugging. further optimizations

This commit is contained in:
Ethan Adams 2025-02-05 22:03:11 -05:00
parent 95fa07b183
commit f7f68e500b
6 changed files with 24 additions and 7 deletions

View file

@ -1,4 +1,4 @@
{ {
"version": 3, "version": 3,
"configurePresets": [ "configurePresets": [
{ {
@ -97,5 +97,13 @@
} }
} }
} }
],
"buildPresets": [
{
"name": "x64-release",
"description": "",
"displayName": "",
"configurePreset": "x64-release"
}
] ]
} }

View file

@ -13,7 +13,11 @@ include_directories(SYSTEM "C:/sdks/sol2-3.3.0/single/single/include")
include_directories(SYSTEM "c:/sdks/lua-5.4.6/include") include_directories(SYSTEM "c:/sdks/lua-5.4.6/include")
include_directories(SYSTEM "C:/sdks/freetype-2.13.2/include") include_directories(SYSTEM "C:/sdks/freetype-2.13.2/include")
link_directories(SYSTEM "C:/sdks/freetype-2.13.2/objs") link_directories(SYSTEM "C:/sdks/freetype-2.13.2/objs")
link_directories(SYSTEM "c:/sdks/tinyxml2-10.0.0/debug/lib") if (CMAKE_BUILD_TYPE STREQUAL "Debug")
link_directories(SYSTEM "c:/sdks/tinyxml2-10.0.0/debug/lib")
else()
link_directories(SYSTEM "c:/sdks/tinyxml2-10.0.0/release/lib")
endif()
link_directories(SYSTEM "c:/sdks/lua-5.4.6/lib") link_directories(SYSTEM "c:/sdks/lua-5.4.6/lib")
include_directories("${PROJECT_SOURCE_DIR}/YuppleMayham/include") include_directories("${PROJECT_SOURCE_DIR}/YuppleMayham/include")

View file

@ -28,7 +28,7 @@ bool Game::init()
#if _DEBUG #if _DEBUG
LOG_LEVEL(DEBUG); LOG_LEVEL(DEBUG);
#elif #else
LOG_LEVEL(INFO); LOG_LEVEL(INFO);
#endif #endif

View file

@ -51,9 +51,9 @@ void GameActor::update(double deltaTime)
{ {
Entity::update(deltaTime); Entity::update(deltaTime);
for (auto& component : components) for (const auto& component : components)
component->update(); component->update();
for (auto& weapon : weapons) for (const auto& weapon : weapons)
weapon->update(deltaTime); weapon->update(deltaTime);
if (eventManager) if (eventManager)
@ -78,7 +78,7 @@ void GameActor::draw()
// regular loop through components, but if the component returns true to kill, we erase it. // regular loop through components, but if the component returns true to kill, we erase it.
// Components are always assumed to be smart pointers! // Components are always assumed to be smart pointers!
for (auto& component : components) for (const auto& component : components)
{ {
component->bind(); component->bind();
component->render(); component->render();

View file

@ -17,6 +17,8 @@
#include "utility/raycaster.h" #include "utility/raycaster.h"
#include "utility/debugdraw.h" #include "utility/debugdraw.h"
#include <tracy/Tracy.hpp>
#include <execution> #include <execution>
// Scene xml files, should contain a node called <player> that holds the sprite location // Scene xml files, should contain a node called <player> that holds the sprite location
@ -126,6 +128,7 @@ std::shared_ptr<GameActor> Scene::getPlayer() const
void Scene::update(double deltaTime) void Scene::update(double deltaTime)
{ {
ZoneScoped;
for (const auto& [id, e] : entities) for (const auto& [id, e] : entities)
{ {
e->update(deltaTime); e->update(deltaTime);
@ -138,6 +141,7 @@ void Scene::update(double deltaTime)
void Scene::render(std::shared_ptr<Renderer> renderer) void Scene::render(std::shared_ptr<Renderer> renderer)
{ {
ZoneScoped;
renderer->clear(); renderer->clear();
renderer->setProjAndViewMatrix(camera->getProjectionMatrix(), camera->getViewMatrix()); renderer->setProjAndViewMatrix(camera->getProjectionMatrix(), camera->getViewMatrix());

View file

@ -2,6 +2,7 @@
#include <SDL_image.h> #include <SDL_image.h>
#include <iostream> #include <iostream>
#include <tracy/Tracy.hpp>
// TODO: Fix circular dependency issues, mostly with input.h needing gameactor.h and command.h // TODO: Fix circular dependency issues, mostly with input.h needing gameactor.h and command.h
#include "gameplay/game.h" #include "gameplay/game.h"