Removing the members from drawBox from the class declaration will do, if I wished to change the values of those members, I would have to create a Creature object. And that's about. Thanks everyone.
'drawBox' does not name a type error
Question
I keep having some weird errors while coding on C++ using SDL as my graphics library.
Today, I was starting to develop a game I wanna make, and suddenly a encountered a quite strange error.
#ifndef CREATURE_H_
#define CREATURE_H_
#include "SDL/SDL.h"
using namespace std;
class Creature
{
private:
SDL_Rect drawBox;
drawBox.x;
drawBox.y;
drawBox.h;
drawBox.w;
SDL_Surface *sprite;
public:
void spawn (SDL_Rect drawBox,SDL_Surface* screen);
bool isTouching (class object);
bool isAlive ();
void move (int x,int y);
bool isFalling ();
void setSprite ();
};
#endif
That's my creature.h header file, and the creature.cpp is empty (it can compile but it wont do anything interesting). So, I can see that SDL_Rect is a struct and all that,but then why won't the SDL_Rect's name be treated as a variable name when it is? See ya guys, and peace.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow