debuging memory leaks
This commit is contained in:
@@ -13,6 +13,7 @@ Text::Text(LTexture *texture, SDL_Renderer *renderer)
|
||||
Text::~Text()
|
||||
{
|
||||
delete mSprite;
|
||||
mSprite = nullptr;
|
||||
}
|
||||
|
||||
// Inicializador
|
||||
@@ -131,11 +132,11 @@ void Text::init(Uint8 type, Uint8 size)
|
||||
}
|
||||
|
||||
// Escribe texto en pantalla
|
||||
void Text::write(int x, int y, std::string text, int kerning, Uint8 lenght)
|
||||
void Text::write(int x, int y, std::string text, int kerning, int lenght)
|
||||
{
|
||||
Uint16 shift = 0;
|
||||
|
||||
if (lenght == 0)
|
||||
if (lenght == -1)
|
||||
lenght = text.length();
|
||||
|
||||
for (int i = 0; i < lenght; ++i)
|
||||
@@ -149,7 +150,7 @@ void Text::write(int x, int y, std::string text, int kerning, Uint8 lenght)
|
||||
}
|
||||
|
||||
// Escribe el texto con colores
|
||||
void Text::writeColored(int x, int y, std::string text, color_t color, int kerning, Uint8 lenght)
|
||||
void Text::writeColored(int x, int y, std::string text, color_t color, int kerning, int lenght)
|
||||
{
|
||||
mSprite->getTexture()->setColor(color.r, color.g, color.b);
|
||||
write(x, y, text, kerning, lenght);
|
||||
@@ -157,7 +158,7 @@ void Text::writeColored(int x, int y, std::string text, color_t color, int kerni
|
||||
}
|
||||
|
||||
// Escribe el texto con sombra
|
||||
void Text::writeShadowed(int x, int y, std::string text, color_t color, Uint8 shadowDistance, int kerning, Uint8 lenght)
|
||||
void Text::writeShadowed(int x, int y, std::string text, color_t color, Uint8 shadowDistance, int kerning, int lenght)
|
||||
{
|
||||
mSprite->getTexture()->setColor(color.r, color.g, color.b);
|
||||
write(x + shadowDistance, y + shadowDistance, text, kerning, lenght);
|
||||
@@ -166,14 +167,14 @@ void Text::writeShadowed(int x, int y, std::string text, color_t color, Uint8 sh
|
||||
}
|
||||
|
||||
// Escribe el texto centrado en un punto x
|
||||
void Text::writeCentered(int x, int y, std::string text, int kerning, Uint8 lenght)
|
||||
void Text::writeCentered(int x, int y, std::string text, int kerning, int lenght)
|
||||
{
|
||||
x -= (Text::lenght(text, kerning) / 2);
|
||||
write(x, y, text, kerning, lenght);
|
||||
}
|
||||
|
||||
// Escribe texto con extras
|
||||
void Text::writeDX(Uint8 flags, int x, int y, std::string text, int kerning, color_t textColor, Uint8 shadowDistance, color_t shadowColor, Uint8 lenght)
|
||||
void Text::writeDX(Uint8 flags, int x, int y, std::string text, int kerning, color_t textColor, Uint8 shadowDistance, color_t shadowColor, int lenght)
|
||||
{
|
||||
const bool centered = ((flags & TXT_CENTER) == TXT_CENTER);
|
||||
const bool shadowed = ((flags & TXT_SHADOW) == TXT_SHADOW);
|
||||
|
||||
Reference in New Issue
Block a user