16
Graphics / Re: Texture won't display when loaded from within a class?
« on: July 07, 2012, 07:48:02 pm »
Thanks guys, actually gameObj inherits from sf::sprite...it's just used for the collisions really (some code I borrowed from someone else!). I'm really confused lol
I do normally have the if(!loadfromfile) exit_result type stuff to check for the result, but would that make a difference here or is that just for good practice?
gameObj is just like this, and it all compiles with no errors...just doesn't display the bomb though it's certainly there...
I do normally have the if(!loadfromfile) exit_result type stuff to check for the result, but would that make a difference here or is that just for good practice?
gameObj is just like this, and it all compiles with no errors...just doesn't display the bomb though it's certainly there...
class gameObj : public sf::Sprite {
private:
sf::FloatRect colliderResult;
sf::IntRect relativeCollider;
sf::FloatRect getCollider();
public:
gameObj();
bool isCollidingWith( gameObj object );
void setRelativeCollider( sf::IntRect collider );
void collide( gameObj collidingObject );
bool operator< (const gameObj &other ) const {
return getPosition().y < other.getPosition().y;
}
void update();
int objectId;
bool isDestructable;
};
private:
sf::FloatRect colliderResult;
sf::IntRect relativeCollider;
sf::FloatRect getCollider();
public:
gameObj();
bool isCollidingWith( gameObj object );
void setRelativeCollider( sf::IntRect collider );
void collide( gameObj collidingObject );
bool operator< (const gameObj &other ) const {
return getPosition().y < other.getPosition().y;
}
void update();
int objectId;
bool isDestructable;
};