mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-09-02 18:32:49 -04:00
fix memory leaks, avoid invalidate texture (#207)
* Fixed macos * More stupid fixes * update with main and update torch and lus and enable action on this branch * Update FrameInterpolation.h * Update FrameInterpolation.cpp * fix some memory leak * Update torch * Update torch * update torch and lus * reduce texture import * don't use fork of torch and lus * Update torch * Update torch --------- Co-authored-by: Lywx <kiritodev01@gmail.com>
This commit is contained in:
+6
-1
@@ -298,6 +298,9 @@ void GameEngine::Destroy() {
|
||||
#ifdef __SWITCH__
|
||||
Ship::Switch::Exit();
|
||||
#endif
|
||||
GameUI::Destroy();
|
||||
delete GameEngine::Instance;
|
||||
GameEngine::Instance = nullptr;
|
||||
}
|
||||
|
||||
bool ShouldClearTextureCacheAtEndOfFrame = false;
|
||||
@@ -509,7 +512,9 @@ ImFont* GameEngine::CreateFontWithSize(float size, std::string fontPath) {
|
||||
initData->Path = fontPath;
|
||||
std::shared_ptr<Ship::Font> fontData = std::static_pointer_cast<Ship::Font>(
|
||||
Ship::Context::GetInstance()->GetResourceManager()->LoadResource(fontPath, false, initData));
|
||||
font = mImGuiIo->Fonts->AddFontFromMemoryTTF(fontData->Data, fontData->DataSize, size);
|
||||
char* fontDataPtr = (char*)malloc(fontData->DataSize);
|
||||
memcpy(fontDataPtr, fontData->Data, fontData->DataSize);
|
||||
font = mImGuiIo->Fonts->AddFontFromMemoryTTF(fontDataPtr, fontData->DataSize, size);
|
||||
}
|
||||
// FontAwesome fonts need to have their sizes reduced by 2.0f/3.0f in order to align correctly
|
||||
float iconFontSize = size * 2.0f / 3.0f;
|
||||
|
||||
Reference in New Issue
Block a user