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.


Messages - Fortas

Pages: [1]
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.

Quote
void GameScreen::Draw(sf::RenderWindow &window)
{
       players.Draw(window); // <-- PlayerClass object;
}

void PlayerClass::Draw(sf::RenderWindow &window)
{
    window.draw(playerSprite);
}
I loaded texture in PlayerClass by using constructor.
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?

Pages: [1]
anything