Author Topic: Object not created properly inside a class  (Read 2439 times)

0 Members and 1 Guest are viewing this topic.

Offline Scipi

  • Omni Kitten Meow~ =^ω^=
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1547
  • Rating: +192/-3
  • Meow :3
    • View Profile
    • ScipiSoftware
Object not created properly inside a class
« on: July 22, 2011, 01:46:20 pm »
I'm getting an error with some of my C++ code for Daemons (It's the last in a long list of errors preventing screenshots) and I have no idea how to fix it.

The error is: Game.Game::App does not have class type.

Here's the code for the creation of App
Code: [Select]
class Game
{
public:

        sf::RenderWindow App();
        vector <sf::Sprite> SpriteFiles;

        void Setup();
        void MainMenu();
        void GetEvents();

        void LevelUp(string, int*);//Daemon name, pointer to Daemon stats array

Game();
~Game();
private:
bool FilesExist;
stringstream PictureName;
char ImageNum;
vector <sf::Image> ImageFiles;
};

And here's one example of it's usage

Code: [Select]
void Map::Display()
{
Game.App.Clear();

for (int y=PosY; y<ScreenHeight; y++)
{
for (int x=PosX; x<ScreenWidth; x++)
{
if (y >= 0 && x >= 0)
{
if (MapData[x + (y * MapWidth)] == -1)
continue;

Game.SpriteFiles[MapData[x + (y * MapWidth)]].SetPosition(x * 64, y * 64);

Game.App.Draw(Game.SpriteFiles[MapData[x + (y * MapWidth)]]);
}
}

}
Game.App.Display();
return;
}

Any ideas on how to get App to work? It has a class type (An sf::RenderWindow) which is a drawable window. :(

Imma Cat! =^_^= :3 (It's an emoticon now!)
Spoiler For Things I find interesting:
Spoiler For AI Programming:
Spoiler For Shameless advertising:

Spoiler For OldSig:





Spoiler For IMPORTANT NEWS!:
Late last night, Quebec was invaded by a group calling themselves, "Omnimaga". Not much is known about these mysterious people except that they all carried calculators of some kind and they all seemed to converge on one house in particular. Experts estimate that the combined power of their fabled calculators is greater than all the worlds super computers put together. The group seems to be holding out in the home of a certain DJ_O, who the Omnimagians claim to be their founder. Such power has put the world at a standstill with everyone waiting to see what the Omnimagians will do...

Wait... This just in, the Omnimagians have sent the UN a list of demands that must be met or else the world will be "submitted to the wrath of Netham45's Lobster Army". Such demands include >9001 crates of peanuts, sacrificial blue lobsters, and a wide assortment of cherry flavored items. With such computing power stored in the hands of such people, we can only hope these demands are met.

In the wake of these events, we can only ask, Why? Why do these people make these demands, what caused them to gather, and what are their future plans...

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Object not created properly inside a class
« Reply #1 on: July 24, 2011, 09:40:39 am »
How many files are there? Could you upload all of them and tell us how to compile please? That would make it easier for us to help you :)

Offline Scipi

  • Omni Kitten Meow~ =^ω^=
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1547
  • Rating: +192/-3
  • Meow :3
    • View Profile
    • ScipiSoftware
Re: Object not created properly inside a class
« Reply #2 on: July 25, 2011, 06:51:59 pm »
I found out what was going wrong. I had to remove the () from sf::RenderWindow App();

Imma Cat! =^_^= :3 (It's an emoticon now!)
Spoiler For Things I find interesting:
Spoiler For AI Programming:
Spoiler For Shameless advertising:

Spoiler For OldSig:





Spoiler For IMPORTANT NEWS!:
Late last night, Quebec was invaded by a group calling themselves, "Omnimaga". Not much is known about these mysterious people except that they all carried calculators of some kind and they all seemed to converge on one house in particular. Experts estimate that the combined power of their fabled calculators is greater than all the worlds super computers put together. The group seems to be holding out in the home of a certain DJ_O, who the Omnimagians claim to be their founder. Such power has put the world at a standstill with everyone waiting to see what the Omnimagians will do...

Wait... This just in, the Omnimagians have sent the UN a list of demands that must be met or else the world will be "submitted to the wrath of Netham45's Lobster Army". Such demands include >9001 crates of peanuts, sacrificial blue lobsters, and a wide assortment of cherry flavored items. With such computing power stored in the hands of such people, we can only hope these demands are met.

In the wake of these events, we can only ask, Why? Why do these people make these demands, what caused them to gather, and what are their future plans...