I have a class (inheritance is virtual cause I use multiple inheritance ahead): class XGE_Texture : virtualpublic XGE_Object
Its constructor (rect() prints the SDL_Rect struct which is basically formed by 4 ints):
XGE_Object::XGE_Object(int x, int y, int w, int h){
std::cout<<"O1: "<<x<<" "<<y<<" "<<w<<" "<<h<<"\n";
bounds = {x, y, w, h};
std::cout<<"O2: "<<rect(bounds);
}
The example you posted works fine, and gives the expected result. I don't know why it's not working in my project... Could it have something to do with the inheritance being virtual?
EDIT:
I tried this:
No, instead it does, but it receives the wrong parameters. In my 2nd test I pass to it directly (300, 200, 200, 200) and it prints (0, 0, 0, 0). So the received parameters are wrong, but why?
XGE_Object::XGE_Object(int x, int y, int w, int h){
std::cout<<"O1: "<<x<<" "<<y<<" "<<w<<" "<<h<<"\n";
bounds = {x, y, w, h};
std::cout<<"O2: "<<rect(bounds);
}
At O1 it prints 0, 0, 0, 0 so it's not even receiving the correct parameters...