1
Graphics / Texture lifetime.
« on: December 12, 2013, 08:05:41 pm »
Hello.
I use 4 classes in my project atm:
-ScreenMenager: use to menage screens;
-VirtualClass: using virtual methods;
-GameScreen: main screen which I want to use for interactions between other classes;
-PlayerClass;
ScreenMenager has a pointer to VirtualClass. I use it to display GameScreens methods by virtual ones. PlayerClass has private Sprite and Texture which I want to display. Its going like:
GameScreen class has no Texture and no Sprite.
My question is how can I transfer the texture to PlayerClass or how can I display it from PlayerClass level? Is it even possible or I have to find other way?
I use 4 classes in my project atm:
-ScreenMenager: use to menage screens;
-VirtualClass: using virtual methods;
-GameScreen: main screen which I want to use for interactions between other classes;
-PlayerClass;
ScreenMenager has a pointer to VirtualClass. I use it to display GameScreens methods by virtual ones. PlayerClass has private Sprite and Texture which I want to display. Its going like:
GameScreen class has no Texture and no Sprite.
Quote
void GameScreen::Draw(sf::RenderWindow &window)I loaded texture in PlayerClass by using constructor.
{
players.Draw(window); // <-- PlayerClass object;
}
void PlayerClass::Draw(sf::RenderWindow &window)
{
window.draw(playerSprite);
}
My question is how can I transfer the texture to PlayerClass or how can I display it from PlayerClass level? Is it even possible or I have to find other way?