So I've managed to narrow my problem down to these 6 lines of code:
sf::Sprite charSpr;
charSpr.setTexture(charTex);
int _characterSets[] = {1, 8, 8};
AnimatedObject characterObj(&charSpr, 51, 75, 3, _characterSets);
PlayerObject character(&characterObj);
Somehow, through the course of these lines it always comes to pass that the default constructor is called for the AnimatedObject class even though I'm clearly only calling the constructor for AnimatedObject that takes an sf::sprite
, two int
s and an int
array.
PlayerObject Constructor
PlayerObject::PlayerObject(AnimatedObject* _animObj){
anim = *_animObj;
dynamic = false;
for(int i = 0; i < 2; i++){
position[i] = 0;
velocity[i] = 0;
acceleration[i] = 0;
gravity[i] = 0;
}
}
AnimatedObject Constructor
AnimatedObject::AnimatedObject(sf::Sprite* _s, int _w, int _h, int _st, int _fs[]){
sprite = *_s;
width = _w;
height = _h;
sets = _st;
set = 1;
frames.insert(frames.end(), &_fs[0], &_fs[sets]);
frame = 1;
}
Error Message with AnimatedObject default constructor made private
In file included from PlayerObject.cpp:3:0:
AnimatedObject.hpp: In constructor ‘PlayerObject::PlayerObject()’:
AnimatedObject.hpp:9:3: error: ‘AnimatedObject::AnimatedObject()’ is private
AnimatedObject();
^
PlayerObject.cpp:6:28: error: within this context
PlayerObject::PlayerObject(){
^
In file included from PlayerObject.cpp:3:0:
AnimatedObject.hpp: In constructor ‘PlayerObject::PlayerObject(AnimatedObject*)’:
AnimatedObject.hpp:9:3: error: ‘AnimatedObject::AnimatedObject()’ is private
AnimatedObject();
^
PlayerObject.cpp:13:52: error: within this context
PlayerObject::PlayerObject(AnimatedObject* _animObj){