Files
neoStudiosLCE-neoLegacy/Minecraft.Client/MemTexture.h
Joud Kandeel ef0dad4ffc fix: memory leaks and heavily optimize the game (#117)
* fixed performance issue on getting texture height for rendering the player model as it loades the player texture on every frame

* updated the lifetime of the texture

* fixed 20 MB memory leak

* delay window display until engine init is done
2026-05-25 22:13:28 +03:00

24 lines
847 B
C++

#pragma once
class BufferedImage;
class MemTextureProcessor;
using namespace std;
class MemTexture {
public:
BufferedImage *loadedImage;
int count;
int id;
bool isLoaded;
int ticksSinceLastUse;
// @CDevJoud
// changing the lifetime of the texture from 20 ticks(1 sec) to 200 ticks (10 sec)
// as it helps the texture to have longer lifetime and reducing the usage of loadTexture for every second/frame
// note that we dont remove the code that removes the textures from `tick()` as it is required in memory limited environment such as older Consoles(PS3/XBOX360)
static const int UNUSED_TICKS_TO_FREE = 200;
//default ctor for int Texture::getHeight(const wstring& url, int backup)
MemTexture() = default;
MemTexture(const wstring& _name, PBYTE pbData, DWORD dwBytes, MemTextureProcessor *processor);
~MemTexture();
};