diff --git a/media/font/nokia.txt b/media/font/nokia.txt index afb8106..d03198e 100644 --- a/media/font/nokia.txt +++ b/media/font/nokia.txt @@ -1,194 +1,194 @@ # box width -8 +10 # box height -8 +10 # 32 espacio ( ) -2 +3 # 33 ! -2 +4 # 34 " 5 # 35 # -6 +7 # 36 $ -6 +7 # 37 % -6 +8 # 38 & -6 +8 # 39 ' -2 +3 # 40 ( -3 +5 # 41 ) -3 +5 # 42 * -4 +7 # 43 + -3 +7 # 44 , -2 +4 # 45 - -3 +6 # 46 . -2 +4 # 47 / -4 +5 # 48 0 -6 +7 # 49 1 -3 +5 # 50 2 -6 +7 # 51 3 -6 +7 # 52 4 -6 +7 # 53 5 -6 +7 # 54 6 -6 +7 # 55 7 -6 +7 # 56 8 -6 +7 # 57 9 -6 +7 # 58 : -2 +4 # 59 ; -2 +4 # 60 < -4 -# 61 = -3 -# 62 > -4 -# 63 ? 6 +# 61 = +6 +# 62 > +6 +# 63 ? +7 # 64 @ 8 # 65 A -6 +7 # 66 B -6 +7 # 67 C -6 +7 # 68 D -6 +7 # 69 E -6 +7 # 70 F -6 +7 # 71 G -6 +7 # 72 H -6 +7 # 73 I -6 +4 # 74 J 6 # 75 K -6 +8 # 76 L 6 # 77 M -6 +9 # 78 N -6 +8 # 79 O -6 +8 # 80 P -6 +7 # 81 Q -6 +8 # 82 R -6 +7 # 83 S 6 # 84 T -6 +8 # 85 U -6 +7 # 86 V -5 +8 # 87 W -6 +9 # 88 X -6 +8 # 89 Y -6 +8 # 90 Z -6 +7 # 91 [ -3 +4 # 92 \ 5 # 93 ] -3 -# 94 ^ 4 +# 94 ^ +5 # 95 _ -6 +8 # 96 ` -2 +4 # 97 a -5 +7 # 98 b -5 +7 # 99 c -5 +6 # 100 d -5 +7 # 101 e -5 +7 # 102 f 5 # 103 g -5 +7 # 104 h -5 +7 # 105 i 4 # 106 j 5 # 107 k -5 +7 # 108 l -5 +4 # 109 m -6 +10 # 110 n -5 +7 # 111 o -5 +7 # 112 p -5 +7 # 113 q -5 +7 # 114 r -5 -# 115 s -5 -# 116 t -4 -# 117 u -5 -# 118 v -5 -# 119 w 6 -# 120 x -4 -# 121 y -4 -# 122 z +# 115 s +6 +# 116 t 5 -# 123 { -3 -# 124 | -2 +# 117 u +7 +# 118 v +7 +# 119 w +9 +# 120 x +7 +# 121 y +7 +# 122 z +7 +# 123 { -> ñ +7 +# 124 | -> ç +7 # 125 } -3 +0 # 126 ~ -3 \ No newline at end of file +0 \ No newline at end of file diff --git a/source/text2.cpp b/source/writer.cpp similarity index 72% rename from source/text2.cpp rename to source/writer.cpp index d9cb519..b3be273 100644 --- a/source/text2.cpp +++ b/source/writer.cpp @@ -1,18 +1,18 @@ #include "const.h" -#include "text2.h" +#include "writer.h" // Constructor -Text2::Text2(std::string file, LTexture *texture, SDL_Renderer *renderer) : Text(file, texture, renderer) +Writer::Writer(std::string file, LTexture *texture, SDL_Renderer *renderer) { } // Destructor -Text2::~Text2() +Writer::~Writer() { } // Inicializador -void Text2::init() +void Writer::init() { Text::init(); mPosX = 0; @@ -31,63 +31,63 @@ void Text2::init() } // Establece el valor de la variable -void Text2::setPosX(int value) +void Writer::setPosX(int value) { mPosX = value; } // Establece el valor de la variable -void Text2::setPosY(int value) +void Writer::setPosY(int value) { mPosY = value; } // Establece el valor de la variable -void Text2::setKerning(int value) +void Writer::setKerning(int value) { mKerning = value; } // Establece el valor de la variable -void Text2::setCaption(std::string text) +void Writer::setCaption(std::string text) { mCaption = text; mLenght = text.length(); } // Establece el valor de la variable -void Text2::setWrittingSpeed(Uint16 value) +void Writer::setWrittingSpeed(Uint16 value) { mWrittingSpeed = value; mWrittingTimer = value; } // Establece el valor de la variable -void Text2::setEnabled(bool value) +void Writer::setEnabled(bool value) { mEnabled = value; } // Obtiene el valor de la variable -bool Text2::IsEnabled() +bool Writer::IsEnabled() { return mEnabled; } // Establece el valor de la variable -void Text2::setEnabledTimer(Uint16 value) +void Writer::setEnabledTimer(Uint16 value) { mEnabledTimer = value; } // Obtiene el valor de la variable -Uint16 Text2::getEnabledTimer() +Uint16 Writer::getEnabledTimer() { return mEnabledTimer; } // Actualiza el objeto -void Text2::update() +void Writer::update() { if (mEnabled) { @@ -95,11 +95,11 @@ void Text2::update() { if (mWrittingTimer > 0) { - --mWrittingTimer; + mWrittingTimer--; } if (mWrittingTimer == 0) { - ++mIndex; + mIndex++; mWrittingTimer = mWrittingSpeed; } if (mIndex == mLenght) @@ -111,7 +111,7 @@ void Text2::update() { if (mEnabledTimer > 0) { - --mEnabledTimer; + mEnabledTimer--; } else if (mEnabledTimer == 0) { @@ -129,7 +129,7 @@ void Text2::update() } // Dibuja el objeto en pantalla -void Text2::render() +void Writer::render() { if (mEnabled) { @@ -138,19 +138,19 @@ void Text2::render() } // Centra la cadena de texto a un punto X -void Text2::center(int x) +void Writer::center(int x) { setPosX(x - (lenght(mCaption, mKerning) / 2)); } // Establece el valor de la variable -void Text2::setId(int id) +void Writer::setId(int id) { mId = id; } // Establece el valor de la variable -void Text2::setIntroEvents(Uint8 *value) +void Writer::setIntroEvents(Uint8 *value) { mIntroEvents = value; } diff --git a/source/text2.h b/source/writer.h similarity index 51% rename from source/text2.h rename to source/writer.h index 4b3f008..b3a4051 100644 --- a/source/text2.h +++ b/source/writer.h @@ -1,102 +1,80 @@ -#pragma once -#include "sprite.h" -#include "text.h" - -#ifndef TEXT2_H -#define TEXT2_H - -// Clase texto. Pinta texto en pantalla a partir de un bitmap -class Text2 : public Text -{ -public: - // Constructor - Text2(std::string file, LTexture *texture, SDL_Renderer *renderer); - - // Destructor - ~Text2(); - - // Inicializador - void init(); - - // Establece el valor de la variable - void setPosX(int value); - - // Establece el valor de la variable - void setPosY(int value); - - // Establece el valor de la variable - void setKerning(int value); - - // Establece el valor de la variable - void setCaption(std::string text); - - // Establece el valor de la variable - void setWrittingSpeed(Uint16 value); - - // Establece el valor de la variable - void setEnabled(bool value); - - // Obtiene el valor de la variable - bool IsEnabled(); - - // Establece el valor de la variable - void setEnabledTimer(Uint16 value); - - // Obtiene el valor de la variable - Uint16 getEnabledTimer(); - - // Actualiza el objeto - void update(); - - // Dibuja el objeto en pantalla - void render(); - - // Centra la cadena de texto a un punto X - void center(int x); - - // Establece el valor de la variable - void setId(int id); - - // Establece el valor de la variable - void setIntroEvents(Uint8 *value); - -private: - // Posicion X/Y donde empezar a escribir el texto - int mPosX; - int mPosY; - - // Kerning del texto - int mKerning; - - // Texto para escribir - std::string mCaption; - - // Velocidad de escritura - Uint16 mWrittingSpeed; - - // Temporizador de escritura para cada caracter - Uint16 mWrittingTimer; - - // Posición del texto que se está escribiendo - Uint16 mIndex; - - // Longitud de la cadena a escribir - Uint16 mLenght; - - // Indica si se ha escrito todo el texto - bool mWrittingCompleted; - - // Indica si el objeto está habilitado - bool mEnabled; - - // Temporizador para deshabilitar el objeto - Uint16 mEnabledTimer; - - // Identificador - int mId; - - // Dirección del array de eventos donde notificar el estado - Uint8 *mIntroEvents; -}; - -#endif +#pragma once +#include "sprite.h" +#include "text.h" + +#ifndef WRITER_H +#define WRITER_H + +// Clase texto. Pinta texto en pantalla a partir de un bitmap +class Writer +{ +private: + int mPosX; // Posicion en el eje X donde empezar a escribir el texto + int mPosY; // Posicion en el eje Y donde empezar a escribir el texto + int mKerning; // Kerning del texto, es decir, espaciado entre caracteres + std::string mCaption; // El texto para escribir + Uint16 mSpeed; // Velocidad de escritura + Uint16 mTimer; // Temporizador de escritura para cada caracter + Uint16 mIndex; // Posición del texto que se está escribiendo + Uint16 mLenght; // Longitud de la cadena a escribir + bool mCompleted; // Indica si se ha escrito todo el texto + bool mEnabled; // Indica si el objeto está habilitado + Uint16 mEnabledTimer; // Temporizador para deshabilitar el objeto + int mId; // Temporizador para deshabilitar el objeto + Uint8 *mIntroEvents; // Dirección del array de eventos donde notificar el estado + Text *mText; // Objeto encargado de escribir el texto + +public: + // Constructor + Writer(Text *text); + + // Destructor + ~Writer(); + + // Inicializador + void init(); + + // Establece el valor de la variable + void setPosX(int value); + + // Establece el valor de la variable + void setPosY(int value); + + // Establece el valor de la variable + void setKerning(int value); + + // Establece el valor de la variable + void setCaption(std::string text); + + // Establece el valor de la variable + void setSpeed(Uint16 value); + + // Establece el valor de la variable + void setEnabled(bool value); + + // Obtiene el valor de la variable + bool IsEnabled(); + + // Establece el valor de la variable + void setEnabledTimer(Uint16 value); + + // Obtiene el valor de la variable + Uint16 getEnabledTimer(); + + // Actualiza el objeto + void update(); + + // Dibuja el objeto en pantalla + void render(); + + // Centra la cadena de texto a un punto X + void center(int x); + + // Establece el valor de la variable + void setId(int id); + + // Establece el valor de la variable + void setIntroEvents(Uint8 *value); +}; + +#endif