Afegit comptador de frames per segon a la classe Screen
This commit is contained in:
44
source/enter_name.cpp
Normal file
44
source/enter_name.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#include "enter_name.h"
|
||||
|
||||
// Constructor
|
||||
EnterName::EnterName(std::string *name)
|
||||
{
|
||||
characterList = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
this->name = name;
|
||||
pos = 0;
|
||||
numCharacters = (int)characterList.size();
|
||||
for (int i = 0; i < NAME_LENGHT; ++i)
|
||||
{
|
||||
characterIndex[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Destructor
|
||||
EnterName::~EnterName()
|
||||
{
|
||||
}
|
||||
|
||||
// Incrementa la posición
|
||||
void EnterName::incPos()
|
||||
{
|
||||
pos++;
|
||||
pos = std::min(pos, NAME_LENGHT - 1);
|
||||
}
|
||||
|
||||
// Decrementa la posición
|
||||
void EnterName::decPos()
|
||||
{
|
||||
pos--;
|
||||
pos = std::max(pos, 0);
|
||||
}
|
||||
|
||||
// Actualiza la variable
|
||||
void EnterName::updateName()
|
||||
{
|
||||
name->clear();
|
||||
for (int i = 0; i < NAME_LENGHT; ++i)
|
||||
{
|
||||
name->append("a");
|
||||
//name->append(characterIndex[i] = 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user