Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Mastax

Pages: [1]
1
Graphics / Missing Template Arguments - Sprite.SetSubRect [RESOLVED]
« on: November 28, 2011, 01:33:59 am »
I'm making a space invaders clone using MinGW CodeBlocks on Windows 7.  When compiling, I get this error:

C:\Users\Jim\Desktop\Programming\Face Invaders\invaders.h||In member function 'void invader0::spriteSetRect()':|
C:\Users\Jim\Desktop\Programming\Face Invaders\invaders.h|43|error: missing template arguments before '(' token|
C:\Users\Jim\Desktop\Programming\Face Invaders\invaders.h|44|error: missing template arguments before '(' token|
||=== Build finished: 2 errors, 0 warnings ===|

I'm guessing it has something to do with my class:

Code: [Select]
class invader0
{
    private:
        short posX, posY;  // (0-800, 0-600)
        static sf::Image Image0;
        sf::Sprite Sprite;
    public:
        static bool state0;  // (0-1)
        void setPos(short, short);
        static bool init (const std::string& ImageFile) {return Image0.LoadFromFile(ImageFile);}
        invader0() {
            Sprite.SetImage(Image0);
        }
        void spriteSetRect() {
            if (state0 == 0) {
            invader0::Sprite.SetSubRect(sf::Rect(0, 0, 16, 16));  // Error goes here
            } else {invader0::Sprite.SetSubRect(sf::Rect(16, 0, 32, 16));}
        }
};


Probably some simple mistake, but I can't think of what could be wrong.

Pages: [1]