Acomodats els estats del jugador
El compte enrrere per a continuar ara ix al acabar la animació de morir Afegit el estat "entering_name"
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
#include "enter_name.h"
|
||||
#include <algorithm> // for max, min
|
||||
#include <algorithm> // for max, min
|
||||
|
||||
// Constructor
|
||||
EnterName::EnterName(std::string *name)
|
||||
{
|
||||
characterList = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
// Obtiene el puntero al nombre
|
||||
this->name = name;
|
||||
|
||||
// Inicia la lista de caracteres permitidos
|
||||
characterList = " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
pos = 0;
|
||||
numCharacters = (int)characterList.size();
|
||||
|
||||
for (int i = 0; i < NAME_LENGHT; ++i)
|
||||
{
|
||||
characterIndex[i] = 0;
|
||||
@@ -33,13 +37,32 @@ void EnterName::decPos()
|
||||
pos = std::max(pos, 0);
|
||||
}
|
||||
|
||||
// Incrementa el índice
|
||||
void EnterName::incIndex()
|
||||
{
|
||||
++characterIndex[pos];
|
||||
if (characterIndex[pos] >= numCharacters)
|
||||
{
|
||||
characterIndex[pos] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Decrementa el índice
|
||||
void EnterName::decIndex()
|
||||
{
|
||||
--characterIndex[pos];
|
||||
if (characterIndex[pos] < 0)
|
||||
{
|
||||
characterIndex[pos] = numCharacters - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Actualiza la variable
|
||||
void EnterName::updateName()
|
||||
{
|
||||
name->clear();
|
||||
for (int i = 0; i < NAME_LENGHT; ++i)
|
||||
{
|
||||
name->append("a");
|
||||
//name->append(characterIndex[i] = 0;
|
||||
name->push_back(characterList[characterIndex[i]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user