pasaeta loca de clang-format (despres m'arrepentiré pero bueno)
This commit is contained in:
@@ -1,109 +1,87 @@
|
||||
#include "writer.h"
|
||||
|
||||
#include "text.h" // Para Text
|
||||
#include "text.h" // Para Text
|
||||
|
||||
// Actualiza el objeto
|
||||
void Writer::update()
|
||||
{
|
||||
if (enabled_)
|
||||
{
|
||||
if (!completed_)
|
||||
{
|
||||
// No completado
|
||||
if (writing_counter_ > 0)
|
||||
{
|
||||
writing_counter_--;
|
||||
}
|
||||
else
|
||||
{
|
||||
index_++;
|
||||
writing_counter_ = speed_;
|
||||
}
|
||||
void Writer::update() {
|
||||
if (enabled_) {
|
||||
if (!completed_) {
|
||||
// No completado
|
||||
if (writing_counter_ > 0) {
|
||||
writing_counter_--;
|
||||
} else {
|
||||
index_++;
|
||||
writing_counter_ = speed_;
|
||||
}
|
||||
|
||||
if (index_ == lenght_)
|
||||
{
|
||||
completed_ = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Completado
|
||||
finished_ = enabled_counter_ <= 0;
|
||||
if (!finished_)
|
||||
{
|
||||
enabled_counter_--;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (index_ == lenght_) {
|
||||
completed_ = true;
|
||||
}
|
||||
} else {
|
||||
// Completado
|
||||
finished_ = enabled_counter_ <= 0;
|
||||
if (!finished_) {
|
||||
enabled_counter_--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dibuja el objeto en pantalla
|
||||
void Writer::render() const
|
||||
{
|
||||
if (enabled_)
|
||||
{
|
||||
text_->write(pos_x_, pos_y_, caption_, kerning_, index_);
|
||||
}
|
||||
void Writer::render() const {
|
||||
if (enabled_) {
|
||||
text_->write(pos_x_, pos_y_, caption_, kerning_, index_);
|
||||
}
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Writer::setPosX(int value)
|
||||
{
|
||||
pos_x_ = value;
|
||||
void Writer::setPosX(int value) {
|
||||
pos_x_ = value;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Writer::setPosY(int value)
|
||||
{
|
||||
pos_y_ = value;
|
||||
void Writer::setPosY(int value) {
|
||||
pos_y_ = value;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Writer::setKerning(int value)
|
||||
{
|
||||
kerning_ = value;
|
||||
void Writer::setKerning(int value) {
|
||||
kerning_ = value;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Writer::setCaption(const std::string &text)
|
||||
{
|
||||
caption_ = text;
|
||||
lenght_ = text.length();
|
||||
void Writer::setCaption(const std::string &text) {
|
||||
caption_ = text;
|
||||
lenght_ = text.length();
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Writer::setSpeed(int value)
|
||||
{
|
||||
speed_ = value;
|
||||
writing_counter_ = value;
|
||||
void Writer::setSpeed(int value) {
|
||||
speed_ = value;
|
||||
writing_counter_ = value;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Writer::setEnabled(bool value)
|
||||
{
|
||||
enabled_ = value;
|
||||
void Writer::setEnabled(bool value) {
|
||||
enabled_ = value;
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
bool Writer::IsEnabled() const
|
||||
{
|
||||
return enabled_;
|
||||
bool Writer::IsEnabled() const {
|
||||
return enabled_;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Writer::setFinishedCounter(int time)
|
||||
{
|
||||
enabled_counter_ = time;
|
||||
void Writer::setFinishedCounter(int time) {
|
||||
enabled_counter_ = time;
|
||||
}
|
||||
|
||||
// Centra la cadena de texto a un punto X
|
||||
void Writer::center(int x)
|
||||
{
|
||||
setPosX(x - (text_->lenght(caption_, kerning_) / 2));
|
||||
void Writer::center(int x) {
|
||||
setPosX(x - (text_->lenght(caption_, kerning_) / 2));
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
bool Writer::hasFinished() const
|
||||
{
|
||||
return finished_;
|
||||
bool Writer::hasFinished() const {
|
||||
return finished_;
|
||||
}
|
||||
Reference in New Issue
Block a user