So im trying to define a structure that has a render window in it. Having this is not necessary to my program but I would like to learn how to do this if its possible because I am obviously trying to do it wrong.
My code:
typedef struct KeyWindowStruct {
sf::RenderWindow;
}KeyWindow;
Thanks for your help.
Holy fuck i'm a dumbass. Anyway I have one more question this time hopefully its less stupid. So i'm trying to get multiple windows open at once and im trying to do that by having a void that functions like the while loop would. It has a for loop that goes through a array of my structure key.
Key
typedef struct KeyStruct {
sf::Image Img;
sf::Texture Tex;
sf::Sprite Sprite;
sf::RenderWindow* Window;//pointer because it is uncopyable
}NewKey;
This is my void
static void StepWindows()
{
sf::Clock clock;
int i;
for (i = 0; i > KeyArray.size(); i++)
MakeTopWindow(KeyArray[i].Window);
setShape(KeyArray[i].Window, KeyArray[i].Img);
KeyArray[i].Window.clear(sf::Color::Transparent);
KeyArray[i].Window.draw(KeyArray[i].Sprite);
KeyArray[i].Window.display();
if (clock.getElapsedTime().asMicroseconds() > 1000)
{
KeyArray[i].Window.setPosition(MakeKey::Gravity(KeyArray[i].Window, KeyArray[i]));
}
}
When Ever I try to use KeyArray.Window it says expression must have class type. How do I fix this?