196
Graphics / Error with calling sf::Sprite
« on: December 18, 2011, 08:51:42 pm »
You need the first solution that I've sugested earlier.
Like this:
You wont even need to pass them as parameters, as they'll be global.
Like this:
Code: [Select]
sf::Sprite* Title;
int LoadMedia();
int Menu(sf::Sprite*);
int Game();
int LoadMedia() {
sf::Image* ITitle = new sf::Image();
if(!ITitle->LoadFromFile("media/images/UI/title.png")) {return EXIT_FAILURE;}
Title = new sf::Sprite(ITitle);
Title->SetCenter(221,51.5);
}
int Menu () {
Title->SetPosition(Menu.GetWidth()/2,100);
}
int Game() {
//The usual stuff
}
int main() {
LoadMedia();
Menu();
Game();
return EXIT_SUCCESS;
}
You wont even need to pass them as parameters, as they'll be global.