I have two classes, Player and Wall, that each of a SDL_Rect data member. I need to access the SDL_Rect in Wall from a function in my Player class in order to check for collision.
Here are some code snippets (NOTE: They are in the same header file):
Wall
1 2 3 4 5 6 7 8 9 10 11 12 13
class Wall
{
public:
Wall(int x, int y, int w, int h, std::string filename);
~Wall();
SDL_Rect wall_outline;void show();
private:
SDL_Surface *wall;
};
Player
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
class Player
{
public:
Player(int x, int y, int w, int h, std::string filename);
~Player();
SDL_Rect player_outline;void show();
void handle_input();
void move();
private:
int its_x, its_y;
int xVel, yVel;
int SPEED;
SDL_Surface *player;
};