Here's a quick helpful tip that people often overlook. You can quickly initialize the values of a struct using shorthand notation:
struct SEntity {
int X;
int Y;
};
SEntity Player = {0, 0}; //Coordinates X , Y
Please note you can only do this when you create your struct object. This will not work:
struct SEntity {
int X;
int Y;
};
SEntity Player = {0, 0}; //Coordinates X , Y
Player = {10, 10}; //Error!
You can even nest:
struct SCoords {
int X;
int Y;
};
struct SEntity {
SCoords Pos;
int Speed;
};
SEntity Player = {{0, 0}, 0}; //Coordinates X , Y, and Speed
Email (required, not published):
Website:
Email (required, not published):
Website: