lang class

This commit is contained in:
2021-08-28 12:23:04 +02:00
parent cc8ef6e927
commit a54d71c990
16 changed files with 596 additions and 430 deletions

View File

@@ -2,7 +2,6 @@
#include "text.h"
#include <iostream>
#include <fstream>
//#include <cstdlib>
// Constructor
Text::Text(std::string file, LTexture *texture, SDL_Renderer *renderer)
@@ -20,11 +19,6 @@ Text::~Text()
mSprite = nullptr;
}
// en el constructor se le pasa la ruta del fichero de descripcion
// el fichero tendra el alto y ancho del cuadrado donde esta cada letra
// y el listado de anchos de cada una
// el init ya no necesita type ni size
// Inicializador
void Text::init()
{
@@ -138,12 +132,10 @@ void Text::initOffsetFromFile()
std::getline(rfile, buffer);
std::getline(rfile, buffer);
mBoxWidth = std::stoi(buffer);
//printf("mBoxWidth: %i\n", mBoxWidth);
std::getline(rfile, buffer);
std::getline(rfile, buffer);
mBoxHeight = std::stoi(buffer);
//printf("mBoxHeight: %i\n", mBoxHeight);
// lee el resto de datos del fichero
int index = 32;
@@ -152,11 +144,9 @@ void Text::initOffsetFromFile()
{
// Almacena solo las lineas impares
if (line_read % 2 == 1)
{
//printf("%i - %i - %s\n", line_read, index, buffer.c_str());
mOffset[index++].w = std::stoi(buffer);
}
//Then clear the buffer once you're done with it.
// Limpia el buffer
buffer.clear();
line_read++;
};