working on new text engine

This commit is contained in:
2021-08-26 18:14:56 +02:00
parent 6d2fd16ec2
commit 3cb822ee6c
11 changed files with 664 additions and 60 deletions

View File

@@ -49,8 +49,8 @@ void Text::init()
// Establece las coordenadas para cada caracter ascii de la cadena y su ancho
for (int i = 32; i < 128; i++)
{
mOffset[i].x = ((i - 32) % 16) * mBoxWidth;
mOffset[i].y = ((i - 32) / 16) * mBoxHeight;
mOffset[i].x = ((i - 32) % 15) * mBoxWidth;
mOffset[i].y = ((i - 32) / 15) * mBoxHeight;
}
}
@@ -138,10 +138,12 @@ 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;
@@ -150,8 +152,10 @@ 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.
buffer.clear();
line_read++;