working on new font engine

This commit is contained in:
2021-08-26 13:59:25 +02:00
parent 5768c1f7a2
commit e93aba2522
11 changed files with 160 additions and 176 deletions

View File

@@ -74,7 +74,7 @@ void Director::init()
} }
// Sección // Sección
mSection.name = PROG_SECTION_LOGO; mSection.name = PROG_SECTION_GAME;
mSection.subsection = 0; mSection.subsection = 0;
// Textos // Textos
@@ -231,10 +231,12 @@ void Director::setFileList()
mFileList[44] = mExecutablePath + "/" + "../media/gfx/player2_legs.png"; mFileList[44] = mExecutablePath + "/" + "../media/gfx/player2_legs.png";
mFileList[45] = mExecutablePath + "/" + "../media/gfx/player2_head.png"; mFileList[45] = mExecutablePath + "/" + "../media/gfx/player2_head.png";
// Fuentes
mFileList[27] = mExecutablePath + "/" + "../media/font/8bithud.png"; mFileList[27] = mExecutablePath + "/" + "../media/font/8bithud.png";
mFileList[46] = mExecutablePath + "/" + "../media/font/8bithud.txt";
mFileList[28] = mExecutablePath + "/" + "../media/font/nokia.png"; mFileList[28] = mExecutablePath + "/" + "../media/font/nokia.png";
mFileList[29] = mExecutablePath + "/" + "../media/font/smb2_big.png"; mFileList[29] = mExecutablePath + "/" + "../media/font/smb2_big.png";
mFileList[30] = mExecutablePath + "/" + "../media/font/smb.png"; mFileList[30] = mExecutablePath + "/" + "../media/font/smb2.png";
} }
// Comprueba que todos los ficheros existen // Comprueba que todos los ficheros existen

View File

@@ -44,8 +44,8 @@ Game::Game(int numPlayers, SDL_Renderer *renderer, std::string *filelist, std::s
mTextureText = new LTexture(); mTextureText = new LTexture();
mTextureText2 = new LTexture(); mTextureText2 = new LTexture();
mText = new Text(mTextureText, mRenderer); mText = new Text(mFileList[46], mTextureText, mRenderer);
mTextX2 = new Text(mTextureText2, mRenderer); mTextX2 = new Text(mFileList[46], mTextureText2, mRenderer);
mMenuGameOver = new Menu(mRenderer, mText, mInput[0], mFileList); mMenuGameOver = new Menu(mRenderer, mText, mInput[0], mFileList);
mMenuPause = new Menu(mRenderer, mText, mInput[0], mFileList); mMenuPause = new Menu(mRenderer, mText, mInput[0], mFileList);
@@ -344,8 +344,8 @@ void Game::init()
mFade->init(); mFade->init();
// Inicializa los objetos de texto // Inicializa los objetos de texto
mText->init(TEXT_FIXED, BLOCK); mText->init();
mTextX2->init(TEXT_FIXED, BLOCK * 2); mTextX2->init();
// Inicializa el objeto con el menu de pausa // Inicializa el objeto con el menu de pausa
mMenuPause->init("PAUSE", 0, 12 * BLOCK, MENU_BACKGROUND_SOLID); mMenuPause->init("PAUSE", 0, 12 * BLOCK, MENU_BACKGROUND_SOLID);
@@ -485,7 +485,7 @@ bool Game::loadMedia()
bool success = true; bool success = true;
// Texturas // Texturas
success &= loadTextureFromFile(mTextureText, mFileList[30], mRenderer); success &= loadTextureFromFile(mTextureText, mFileList[27], mRenderer);
success &= loadTextureFromFile(mTextureText2, mFileList[29], mRenderer); success &= loadTextureFromFile(mTextureText2, mFileList[29], mRenderer);
success &= loadTextureFromFile(mTexturePlayer1Legs, mFileList[39], mRenderer); success &= loadTextureFromFile(mTexturePlayer1Legs, mFileList[39], mRenderer);
@@ -1552,8 +1552,8 @@ void Game::renderScoreBoard()
// Si el jugador esta muerto, no pintes el fondo del marcador, así que pase por encima cuando sale despedido // Si el jugador esta muerto, no pintes el fondo del marcador, así que pase por encima cuando sale despedido
//if (mPlayer[0]->isAlive()) //if (mPlayer[0]->isAlive())
mSpriteScoreBoard->render(); mSpriteScoreBoard->render();
/*
// SCORE // SCORE
mText->writeCentered(PLAY_AREA_CENTER_FIRST_QUARTER_X, SCORE_WORD_Y - 6, mTextStrings[39], 0); mText->writeCentered(PLAY_AREA_CENTER_FIRST_QUARTER_X, SCORE_WORD_Y - 6, mTextStrings[39], 0);
mText->writeCentered(PLAY_AREA_CENTER_FIRST_QUARTER_X, SCORE_NUMBER_Y - 6, updateScoreText(mPlayer[0]->getScore()), 0); mText->writeCentered(PLAY_AREA_CENTER_FIRST_QUARTER_X, SCORE_NUMBER_Y - 6, updateScoreText(mPlayer[0]->getScore()), 0);
@@ -1580,6 +1580,52 @@ void Game::renderScoreBoard()
const float percent = (mStage[mCurrentStage].currentPower * 40.0f) / mStage[mCurrentStage].powerToComplete; const float percent = (mStage[mCurrentStage].currentPower * 40.0f) / mStage[mCurrentStage].powerToComplete;
mSpritePowerMeter->setSpriteClip(296, 184, (int)percent, 8); mSpritePowerMeter->setSpriteClip(296, 184, (int)percent, 8);
mSpritePowerMeter->render(); mSpritePowerMeter->render();
*/
const int offset1 = 163;
const int offset2 = offset1 + 7;
const int offset3 = offset2 + 7;
const int offset4 = offset3 + 7;
// PLAYER1 - SCORE
mText->write(PLAY_AREA_LEFT, offset1, mTextStrings[53], 0);
mText->write(PLAY_AREA_LEFT, offset2, updateScoreText(mPlayer[0]->getScore()), 0);
// PLAYER1 - MULT
mText->write(PLAY_AREA_LEFT, offset3, mTextStrings[55], 0);
mText->write(PLAY_AREA_LEFT + (8 * 7), offset3, std::to_string(mPlayer[0]->getScoreMultiplier()), 0);
if (mNumPlayers == 2)
{
// PLAYER2 - SCORE
mText->write(PLAY_AREA_RIGHT - (8 * 8), offset1, mTextStrings[54], 0);
mText->write(PLAY_AREA_RIGHT - (8 * 7), offset2, updateScoreText(mPlayer[1]->getScore()), 0);
// PLAYER2 - MULT
mText->write(PLAY_AREA_RIGHT - (8 * 10), offset3, mTextStrings[55], 0);
mText->write(PLAY_AREA_RIGHT - (8 * 5), offset3, std::to_string(mPlayer[1]->getScoreMultiplier()), 0);
}
else
{
// PLAYER2 - SCORE
mText->write(PLAY_AREA_RIGHT - (8 * 9), offset1, mTextStrings[54], 0);
mText->write(PLAY_AREA_RIGHT - (8 * 7), offset2, "0000000", 0);
// PLAYER2 - MULT
mText->write(PLAY_AREA_RIGHT - (8 * 10), offset3, mTextStrings[55], 0);
mText->write(PLAY_AREA_RIGHT - (8 * 3), offset3, "1.0", 0);
}
// STAGE
mText->writeCentered(PLAY_AREA_CENTER_X, offset1, mTextStrings[42] + std::to_string(mStage[mCurrentStage].number), 0);
// POWER
//mSpritePowerMeter->setSpriteClip(256, 184, 40, 8);
//mSpritePowerMeter->render();
//const float percent = (mStage[mCurrentStage].currentPower * 40.0f) / mStage[mCurrentStage].powerToComplete;
//mSpritePowerMeter->setSpriteClip(296, 184, (int)percent, 8);
//mSpritePowerMeter->render();
// HI-SCORE
mText->writeCentered(PLAY_AREA_CENTER_X, offset4, mTextStrings[40] + "0000000", 0);
} }
// Actualiza las variables del jugador // Actualiza las variables del jugador

View File

@@ -19,7 +19,7 @@ Instructions::Instructions(SDL_Renderer *renderer, std::string *fileList, std::s
mItemTexture = new LTexture(); mItemTexture = new LTexture();
mTextTexture = new LTexture(); mTextTexture = new LTexture();
mSprite = new Sprite(); mSprite = new Sprite();
mText = new Text(mTextTexture, mRenderer); mText = new Text(mFileList[46], mTextTexture, mRenderer);
// Crea un backbuffer para el renderizador // Crea un backbuffer para el renderizador
mBackbuffer = SDL_CreateTexture(mRenderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, SCREEN_WIDTH, SCREEN_HEIGHT); mBackbuffer = SDL_CreateTexture(mRenderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, SCREEN_WIDTH, SCREEN_HEIGHT);
@@ -73,7 +73,7 @@ void Instructions::init()
mSprite->init(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, mItemTexture, mRenderer); mSprite->init(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, mItemTexture, mRenderer);
mTicks = 0; mTicks = 0;
mTicksSpeed = 15; mTicksSpeed = 15;
mText->init(TEXT_FIXED, BLOCK); mText->init();
mManualQuit = false; mManualQuit = false;
mCounter = 0; mCounter = 0;
} }

View File

@@ -21,7 +21,7 @@ Intro::Intro(SDL_Renderer *renderer, std::string *fileList, std::string *textStr
mBitmap[i] = new SmartSprite(); mBitmap[i] = new SmartSprite();
for (int i = 0; i < INTRO_TOTAL_TEXTS; i++) for (int i = 0; i < INTRO_TOTAL_TEXTS; i++)
mText[i] = new Text2(mTextTexture, mRenderer); mText[i] = new Text2(mFileList[46], mTextTexture, mRenderer);
} }
// Destructor // Destructor
@@ -133,7 +133,7 @@ void Intro::init()
// Inicializa los textos de la intro // Inicializa los textos de la intro
for (int i = 0; i < INTRO_TOTAL_TEXTS; i++) for (int i = 0; i < INTRO_TOTAL_TEXTS; i++)
{ {
mText[i]->init(TEXT_VARIABLE, 10); mText[i]->init();
mText[i]->setId(6 + i); mText[i]->setId(6 + i);
mText[i]->setIntroEvents(&mEvents[0]); mText[i]->setIntroEvents(&mEvents[0]);
mText[i]->setPosX(BLOCK * 0); mText[i]->setPosX(BLOCK * 0);

View File

@@ -280,6 +280,28 @@ const std::string gTextStrings[MAX_TEXT_STRINGS][3] =
"2 JUGADORS", "2 JUGADORS",
"2 PLAYERS"}, "2 PLAYERS"},
// MARCADOR
// 53 - MENU DEL TITULO (2 JUGADORES)
{"jugador 1",
"jugador 2",
"player 1"},
// 54 - MENU DEL TITULO (2 JUGADORES)
{"jugador 2",
"jugador 2",
"player 2"},
// 55 - MENU DEL TITULO (2 JUGADORES)
{"mult - ",
"mult - ",
"mult - "},
// 56 - MENU DEL TITULO (2 JUGADORES)
{"max. puntuacion - ",
"max. puntuacio - ",
"high score - "},
}; };
void initTextStrings(std::string *textStrings, Uint8 lang); void initTextStrings(std::string *textStrings, Uint8 lang);

View File

@@ -316,19 +316,19 @@ void Menu::setRectSize()
} }
// La anchura de la cadena más larga, mas un caracter, mas la anchura del sprite del selector // La anchura de la cadena más larga, mas un caracter, mas la anchura del sprite del selector
mRectBG.rect.w += (mText->getSize() * 1); // + mSelectorSprite.getWidth(); mRectBG.rect.w += (mText->getCharacterWidth() * 1); // + mSelectorSprite.getWidth();
// La altura de la suma de los items mas un caracter y menos un pixel (porque el texto en realidad es de 7 pixeles) // La altura de la suma de los items mas un caracter y menos un pixel (porque el texto en realidad es de 7 pixeles)
mRectBG.rect.h += (mText->getSize() * 1) - 1; mRectBG.rect.h += (mText->getCharacterWidth() * 1) - 1;
// La posición X es la del menú menos la anchura del sprite del selector y menos medio caracter // La posición X es la del menú menos la anchura del sprite del selector y menos medio caracter
mRectBG.rect.x = mPosX - (mText->getSize() / 2); // - mSelectorSprite.getWidth(); mRectBG.rect.x = mPosX - (mText->getCharacterWidth() / 2); // - mSelectorSprite.getWidth();
// La posición Y es la del menu menos la altura de medio caracter i el padding // La posición Y es la del menu menos la altura de medio caracter i el padding
mRectBG.rect.y = mPosY - (mText->getSize() / 2) - mVerticalPadding; mRectBG.rect.y = mPosY - (mText->getCharacterWidth() / 2) - mVerticalPadding;
// Establecemos los valores del rectangulo del selector a partir de los valores del rectangulo de fondo // Establecemos los valores del rectangulo del selector a partir de los valores del rectangulo de fondo
mSelector.rect.h = (mText->getSize() * 1) + 1; mSelector.rect.h = (mText->getCharacterWidth() * 1) + 1;
mSelector.rect.w = mRectBG.rect.w; mSelector.rect.w = mRectBG.rect.w;
mSelector.rect.x = mRectBG.rect.x; mSelector.rect.x = mRectBG.rect.x;
} }
@@ -418,7 +418,7 @@ void Menu::addItem(std::string text, const Uint8 hPaddingUp, const Uint8 hPaddin
{ {
mItem[mTotalItems].label = text; mItem[mTotalItems].label = text;
mItem[mTotalItems].w = mText->lenght(mItem[mTotalItems].label, 0); mItem[mTotalItems].w = mText->lenght(mItem[mTotalItems].label, 0);
mItem[mTotalItems].h = mText->getSize() + (mVerticalPadding * 2); mItem[mTotalItems].h = mText->getCharacterWidth() + (mVerticalPadding * 2);
mItem[mTotalItems].x = mPosX; mItem[mTotalItems].x = mPosX;
mItem[mTotalItems].y = mPosY; mItem[mTotalItems].y = mPosY;
mItem[mTotalItems].hPaddingUp = hPaddingUp; mItem[mTotalItems].hPaddingUp = hPaddingUp;
@@ -431,7 +431,7 @@ void Menu::addItem(std::string text, const Uint8 hPaddingUp, const Uint8 hPaddin
{ {
mItem[mTotalItems].label = text; mItem[mTotalItems].label = text;
mItem[mTotalItems].w = mText->lenght(mItem[mTotalItems].label, 0); mItem[mTotalItems].w = mText->lenght(mItem[mTotalItems].label, 0);
mItem[mTotalItems].h = mText->getSize() + (mVerticalPadding * 2); mItem[mTotalItems].h = mText->getCharacterWidth() + (mVerticalPadding * 2);
mItem[mTotalItems].x = mPosX; mItem[mTotalItems].x = mPosX;
mItem[mTotalItems].y = mItem[mTotalItems - 1].y + mItem[mTotalItems - 1].h + mItem[mTotalItems - 1].hPaddingDown; mItem[mTotalItems].y = mItem[mTotalItems - 1].y + mItem[mTotalItems - 1].h + mItem[mTotalItems - 1].hPaddingDown;
mItem[mTotalItems].hPaddingUp = hPaddingUp; mItem[mTotalItems].hPaddingUp = hPaddingUp;

View File

@@ -1,12 +1,16 @@
#include "const.h" #include "const.h"
#include "text.h" #include "text.h"
#include <iostream>
#include <fstream>
//#include <cstdlib>
// Constructor // Constructor
Text::Text(LTexture *texture, SDL_Renderer *renderer) Text::Text(std::string file, LTexture *texture, SDL_Renderer *renderer)
{ {
mSprite = new Sprite(); mSprite = new Sprite();
mSprite->setTexture(texture); mSprite->setTexture(texture);
mSprite->setRenderer(renderer); mSprite->setRenderer(renderer);
mFile = file;
} }
// Destructor // Destructor
@@ -21,24 +25,9 @@ Text::~Text()
// y el listado de anchos de cada una // y el listado de anchos de cada una
// el init ya no necesita type ni size // el init ya no necesita type ni size
// Inicializador // Inicializador
void Text::init(Uint8 type, Uint8 size) void Text::init()
{ {
// Inicializa variables
mType = type;
mSize = size;
// Inicia los valores del sprite que dibuja las letras
mSprite->setWidth(size);
mSprite->setHeight(size);
mSprite->setPosX(0);
mSprite->setPosY(0);
mSprite->setSpriteClip(0, 0, mSprite->getWidth(), mSprite->getHeight());
// Cadena con los caracteres ascii que se van a inicializar
const std::string text = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ{\\[]]^_`abcdefghijklmnopqrstuvwxyz";
// Inicializa a cero el vector con las coordenadas // Inicializa a cero el vector con las coordenadas
for (int i = 0; i < 128; i++) for (int i = 0; i < 128; i++)
{ {
@@ -47,106 +36,21 @@ void Text::init(Uint8 type, Uint8 size)
mOffset[i].w = 0; mOffset[i].w = 0;
} }
// Carga los offsets desde el fichero
initOffsetFromFile();
// Inicia los valores del sprite que dibuja las letras
mSprite->setWidth(mBoxWidth);
mSprite->setHeight(mBoxHeight);
mSprite->setPosX(0);
mSprite->setPosY(0);
mSprite->setSpriteClip(0, 0, mSprite->getWidth(), mSprite->getHeight());
// Establece las coordenadas para cada caracter ascii de la cadena y su ancho // Establece las coordenadas para cada caracter ascii de la cadena y su ancho
for (int i = 0; i < text.length(); ++i) for (int i = 32; i < 128; i++)
{ {
mOffset[int(text[i])].x = ((int(text[i]) - 32) % 15) * mSprite->getWidth(); mOffset[i].x = ((i - 32) % 16) * mBoxWidth;
mOffset[int(text[i])].y = ((int(text[i]) - 32) / 15) * mSprite->getHeight(); mOffset[i].y = ((i - 32) / 16) * mBoxHeight;
if (type == TEXT_FIXED)
mOffset[int(text[i])].w = size;
}
// Establece las coordenadas de forma manual para la ñ
mOffset[int('^')].x = mOffset[int('z')].x + size;
mOffset[int('^')].y = mOffset[int('z')].y;
mOffset[int('^')].w = size;
// Establece las coordenadas de forma manual para la ñç
mOffset[int('~')].x = mOffset[int('z')].x + size * 2;
mOffset[int('~')].y = mOffset[int('z')].y;
mOffset[int('~')].w = size;
// Establece el ancho de cada caracter
if (type == TEXT_VARIABLE)
{
mOffset[int(' ')].w = 7;
mOffset[int('-')].w = 6;
mOffset[int('/')].w = 5;
mOffset[int('(')].w = 5;
mOffset[int(')')].w = 5;
mOffset[int('.')].w = 4;
mOffset[int(':')].w = 4;
mOffset[int('#')].w = 7;
mOffset[int('!')].w = 7;
mOffset[int('\'')].w = 3;
mOffset[int('0')].w = 7;
mOffset[int('1')].w = 5;
mOffset[int('2')].w = 7;
mOffset[int('3')].w = 7;
mOffset[int('4')].w = 7;
mOffset[int('5')].w = 7;
mOffset[int('6')].w = 7;
mOffset[int('7')].w = 7;
mOffset[int('8')].w = 7;
mOffset[int('9')].w = 7;
mOffset[int('A')].w = 7;
mOffset[int('B')].w = 7;
mOffset[int('C')].w = 7;
mOffset[int('D')].w = 7;
mOffset[int('E')].w = 7;
mOffset[int('F')].w = 7;
mOffset[int('G')].w = 7;
mOffset[int('H')].w = 7;
mOffset[int('I')].w = 4;
mOffset[int('J')].w = 6;
mOffset[int('K')].w = 8;
mOffset[int('L')].w = 6;
mOffset[int('M')].w = 9;
mOffset[int('N')].w = 8;
mOffset[int('O')].w = 8;
mOffset[int('P')].w = 7;
mOffset[int('Q')].w = 8;
mOffset[int('R')].w = 7;
mOffset[int('S')].w = 6;
mOffset[int('T')].w = 8;
mOffset[int('U')].w = 7;
mOffset[int('V')].w = 8;
mOffset[int('W')].w = 9;
mOffset[int('X')].w = 8;
mOffset[int('Y')].w = 8;
mOffset[int('Z')].w = 7;
mOffset[int('^')].w = 7;
mOffset[int('~')].w = 7;
mOffset[int('a')].w = 7;
mOffset[int('b')].w = 7;
mOffset[int('c')].w = 6;
mOffset[int('d')].w = 7;
mOffset[int('e')].w = 7;
mOffset[int('f')].w = 5;
mOffset[int('g')].w = 7;
mOffset[int('h')].w = 7;
mOffset[int('i')].w = 4;
mOffset[int('j')].w = 5;
mOffset[int('k')].w = 7;
mOffset[int('l')].w = 4;
mOffset[int('m')].w = 10;
mOffset[int('n')].w = 7;
mOffset[int('o')].w = 7;
mOffset[int('p')].w = 7;
mOffset[int('q')].w = 7;
mOffset[int('r')].w = 6;
mOffset[int('s')].w = 6;
mOffset[int('t')].w = 5;
mOffset[int('u')].w = 7;
mOffset[int('v')].w = 7;
mOffset[int('w')].w = 9;
mOffset[int('x')].w = 7;
mOffset[int('y')].w = 7;
mOffset[int('z')].w = 7;
} }
} }
@@ -222,26 +126,41 @@ Uint16 Text::lenght(std::string text, int kerning)
return shift; return shift;
} }
// Obtiene el valor de la variable // Inicializa el vector de offsets desde un fichero
Uint8 Text::getType() void Text::initOffsetFromFile()
{ {
return mType; std::ifstream rfile(mFile);
if (rfile.is_open() && rfile.good())
{
std::string buffer;
// Lee los dos primeros valores del fichero
std::getline(rfile, buffer);
std::getline(rfile, buffer);
mBoxWidth = std::stoi(buffer);
std::getline(rfile, buffer);
std::getline(rfile, buffer);
mBoxHeight = std::stoi(buffer);
// lee el resto de datos del fichero
int index = 32;
int line_read = 0;
while (std::getline(rfile, buffer))
{
// Almacena solo las lineas impares
if (line_read % 2 == 1)
mOffset[index++].w = std::stoi(buffer);
//Then clear the buffer once you're done with it.
buffer.clear();
line_read++;
};
}
} }
// Establece el valor de la variable // Devuelve el valor de la variable
void Text::setType(Uint8 type) Uint8 Text::getCharacterWidth()
{ {
mType = type; return mBoxWidth;
}
// Obtiene el valor de la variable
Uint8 Text::getSize()
{
return mSize;
}
// Establece el valor de la variable
void Text::setSize(Uint8 size)
{
mSize = size;
} }

View File

@@ -21,20 +21,24 @@ private:
int y; int y;
Uint8 w; Uint8 w;
}; };
Offset mOffset[255]; // Vector con las posiciones y ancho de cada letra Offset mOffset[128]; // Vector con las posiciones y ancho de cada letra
Uint8 mType; // Indica si el texto es de anchura fija o variable Uint8 mBoxWidth; // Anchura de la caja de cada caracter en el png
Uint8 mSize; // Altura del texto Uint8 mBoxHeight; // Altura de la caja de cada caracter en el png
std::string mFile; // Fichero con los descriptores de la fuente
// Inicializa el vector de offsets desde un fichero
void initOffsetFromFile();
public: public:
// Constructor // Constructor
Text(LTexture *texture, SDL_Renderer *renderer); Text(std::string file, LTexture *texture, SDL_Renderer *renderer);
// Destructor // Destructor
~Text(); ~Text();
// Inicializador // Inicializador
void init(Uint8 type, Uint8 size); void init();
// Escribe el texto en pantalla // Escribe el texto en pantalla
void write(int x, int y, std::string text, int kerning = 0, int lenght = -1); void write(int x, int y, std::string text, int kerning = 0, int lenght = -1);
@@ -54,17 +58,8 @@ public:
// Obtiene la longitud en pixels de una cadena // Obtiene la longitud en pixels de una cadena
Uint16 lenght(std::string text, int kerning); Uint16 lenght(std::string text, int kerning);
// Obtiene el valor de la variable // Devuelve el valor de la variable
Uint8 getType(); Uint8 getCharacterWidth();
// Establece el valor de la variable
void setType(Uint8 type);
// Obtiene el valor de la variable
Uint8 getSize();
// Establece el valor de la variable
void setSize(Uint8 size);
}; };
#endif #endif

View File

@@ -2,7 +2,7 @@
#include "text2.h" #include "text2.h"
// Constructor // Constructor
Text2::Text2(LTexture *texture, SDL_Renderer *renderer) : Text(texture, renderer) Text2::Text2(std::string file, LTexture *texture, SDL_Renderer *renderer) : Text(file, texture, renderer)
{ {
} }
@@ -12,9 +12,9 @@ Text2::~Text2()
} }
// Inicializador // Inicializador
void Text2::init(Uint8 type, Uint8 size) void Text2::init()
{ {
Text::init(type, size); Text::init();
mPosX = 0; mPosX = 0;
mPosY = 0; mPosY = 0;
mKerning = 0; mKerning = 0;

View File

@@ -10,13 +10,13 @@ class Text2 : public Text
{ {
public: public:
// Constructor // Constructor
Text2(LTexture *texture, SDL_Renderer *renderer); Text2(std::string file, LTexture *texture, SDL_Renderer *renderer);
// Destructor // Destructor
~Text2(); ~Text2();
// Inicializador // Inicializador
void init(Uint8 type, Uint8 size); void init();
// Establece el valor de la variable // Establece el valor de la variable
void setPosX(int value); void setPosX(int value);

View File

@@ -26,7 +26,7 @@ Title::Title(SDL_Window *window, SDL_Renderer *renderer, Input *input, std::stri
mDustBitmapL = new AnimatedSprite(); mDustBitmapL = new AnimatedSprite();
mDustBitmapR = new AnimatedSprite(); mDustBitmapR = new AnimatedSprite();
mTile = new Sprite(); mTile = new Sprite();
mText = new Text(mTextTexture, mRenderer); mText = new Text(mFileList[46], mTextTexture, mRenderer);
mMenu.title = new Menu(mRenderer, mText, mInput, mFileList); mMenu.title = new Menu(mRenderer, mText, mInput, mFileList);
mMenu.options = new Menu(mRenderer, mText, mInput, mFileList); mMenu.options = new Menu(mRenderer, mText, mInput, mFileList);
@@ -113,7 +113,7 @@ void Title::init(bool demo, Uint8 subsection)
mPostFade = 0; mPostFade = 0;
mTicks = 0; mTicks = 0;
mTicksSpeed = 15; mTicksSpeed = 15;
mText->init(TEXT_FIXED, BLOCK); mText->init();
mFade->init(); mFade->init();
mDemo = demo; mDemo = demo;