Skip to content

Commit

Permalink
Add sample character controller
Browse files Browse the repository at this point in the history
  • Loading branch information
ducphamhong committed Sep 27, 2024
1 parent 4191bd7 commit 0da6ad6
Show file tree
Hide file tree
Showing 20 changed files with 1,418 additions and 3 deletions.
1 change: 1 addition & 0 deletions CMakeProjects.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ if (BUILD_EXAMPLES AND BUILD_SKYLICHT_LIGHMAPPER)
subdirs(Samples/PBR)

if (BUILD_SKYLICHT_PHYSIC)
subdirs(Samples/CharacterController)
subdirs(Samples/Physics)
endif()

Expand Down
3 changes: 3 additions & 0 deletions Projects/Skylicht/Client/CBaseApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ namespace Skylicht
#if defined(_WIN32)
m_enableRunWhenPause = true;
#endif

m_appName = "Skylicht Engine";
}

CBaseApp::~CBaseApp()
Expand Down Expand Up @@ -92,6 +94,7 @@ namespace Skylicht
}

m_appEventReceivers.push_back(appEventType(name, pEvent));
m_appName = name;
}

void CBaseApp::unRegisterAppEvent(IApplicationEventReceiver* pEvent)
Expand Down
8 changes: 8 additions & 0 deletions Projects/Skylicht/Client/CBaseApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ namespace Skylicht
bool m_enableRunWhenPause;

video::SColor m_clearColor;

std::string m_appName;

public:

CBaseApp();
Expand All @@ -76,6 +79,11 @@ namespace Skylicht

public:

inline const char* getAppName()
{
return m_appName.c_str();
}

void showDebugConsole();

static void reportLeakMemory();
Expand Down
7 changes: 6 additions & 1 deletion Projects/Skylicht/Client/CrashHandler/CCrashHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ This file is part of the "Skylicht Engine".
#include "pch.h"
#include "CCrashHandler.h"

#include "CApplication.h"
#include "Utils/CStringImp.h"

#ifdef USE_CRASHHANDLER
#define MAX_STACK_DEPTH 64
#define MAX_UNDECORATEDNAME_LENGTH 256
Expand Down Expand Up @@ -76,9 +79,11 @@ namespace Skylicht
SYSTEMTIME time;
GetLocalTime(&time);

std::wstring appName = CStringImp::convertUTF8ToUnicode(getApplication()->getAppName());

wchar_t szFileName[MAX_PATH];
swprintf(szFileName, MAX_PATH, L"%s-%04d-%02d%02d-%02d%02d.dmp",
L"SkylichtApp",
appName.c_str(),
time.wYear,
time.wMonth,
time.wDay,
Expand Down
16 changes: 14 additions & 2 deletions Projects/Skylicht/Engine/Material/CMaterialManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,27 @@ namespace Skylicht
for (int j = 0, n = (int)list.size(); j < n; j++)
{
CMaterial* m = list[j];
m->drop();
if (m->drop() == false)
{
char log[512];
sprintf(log, "[CMaterialManager] Leak material %s - file: %s", m->getName(), m->getMaterialPath());
os::Printer::log(log);
}
}
list.clear();
++i;
}
m_materials.clear();

for (CMaterial* m : m_listGenerateMaterials)
m->drop();
{
if (m->drop() == false)
{
char log[512];
sprintf(log, "[CMaterialManager] Leak material generated %s", m->getName());
os::Printer::log(log);
}
}
m_listGenerateMaterials.clear();
}

Expand Down
Loading

0 comments on commit 0da6ad6

Please sign in to comment.