i dont understand some things in a code from a tutorial
first one: what is that comma “,” doing in the middle there? is it mb a overloaded operator?
u32 TimeStamp = irrTimer->getTime(), DeltaTime = 0;
next i have a weird constructor from class CharacterDemo, why is there a “:” following some variables with weird brackets? im guesseing they are beeing initialized with the value in the brackets.. ?
CharacterDemo::CharacterDemo()
:
m_indexVertexArrays(0),
m_vertices(0),
m_cameraHeight(4.f),
m_minCameraDistance(3.f),
m_maxCameraDistance(10.f)
{
m_character = 0;
m_cameraPosition = btVector3(30,30,30);
}
im rly curiouse, explanation much appriciated
It’s an initialization list.
It calls the constructors of the members and parent classes of the specified class.
Note that you can only use it in the constructor of a class (because it only happens at its construction).
[edit] For your first question, it’s a way to declare multiple variables of the same type at once. Note that it will not always work as expected :
int * a, bwill declare a variableaof typeint *, and another variablebof typeint(not a pointer).