#include <string>
#define PREV_OBJECT 0
#define NEXT_OBJECT 1
#define LAST_OBJECT 2
class Object{
private:
struct idPropeties{
constint id;//Object setup id, must always be set for all registered data to load
const string type;//Type of Object i.e. Mob; Scene; Other;
const string name;//Name of the Object (for in-game use and clarity)
const string image;//Name of the image file for the Object
constfloat sizeBounds[4]; //Size and shape --- 0=maxX; 1=maxY; mins will always be 0;
constfloat mass; //Object mass/kg --- Wall = 100; Player = 50;
constfloat friction; //Decceleration for Object passing over
};
struct objectList{
Object* nextObject;//Used to create an internal list between Objects
Object* prevObject;//Used to create an internal list between Objects
static Object * lastObject[6];//A LAST Object for each layer
void removeFrom();//remove Object from Internal-List
void addTo(int arg);//addObject to Internal-List
};
struct posPropeties{
int layer; //Collision Layer --- 0=disabled; 1=BG; 2=scene; 3=common; 4=sceneGhost; 5=fullGhost
float pos[3]; //Pos & Rot --- 0=BLx; 1=BLy; 2=IMAGE rotation
float speed[2]; //X velocity; Y velocity; 1m/s = 1 Scenery block past per second
float hitBounds[2][4]; //[x|y][mm, mM, Mm, MM]
bool isCollidable;//If the Object is Collidable
bool staticHit;
void updateHitBounds();//set new hitBounds (hitBounds is also Object postition)
};
public:
//Rest of class Object not relevant for this question//
};
So using the above code would I be able to edit the position of my Object using
Object::posPropeties.pos[<x|y|r>] = <val>;
OR would I have to make an instance of these classes within my object like
Please don't tell me that it wouldn't work because the value's private, I do know this and yes I know I'll need public class function (which I already have) todo this (or of course a friend-ed function, but I don't need that).
So, Which will I need? (I hope it's the former somehow)
defining a class/struct inside another class/struct isn't anything special. The only thing that's different is adding a level of scope and visibility from outside.
So yes: you need an instance of an interior class/struct in order to access non static members. Just as any other class/struct