Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Passing sf::sprites  (Read 1650 times)

0 Members and 1 Guest are viewing this topic.

Sivak

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Passing sf::sprites
« on: March 30, 2010, 05:08:14 am »
Hey all.  This is something I was questioned about and didn't really pay it mind until now.

Basically, if I want to copy an sf::Sprite, I've been doing things like this...

Code: [Select]

GameObjs.push_back(new GameStageWindow(GFX_GameStageWindow, GFX_GameStageWindowText));  //There's 2 sf::Sprites already declared and this function takes and passes these sprite to a ctor for GameStageWindow"

//The ctor looks like this:
GameStageWindow::GameStageWindow(sf::Sprite passedSprite, sf::Sprite passedSprite2)
{ windowSprite = passedSprite;
windowBorderTopSprite = passedSprite;
windowBorderBotSprite = passedSprite;
windowTextSprite = passedSprite2;
//etc...


Basically what I'm wondering is if what I'm doing is bad.  Objects will need their own sf::sprite instances, but I just am not sure if this implementation is a good idea.  Thanks.