Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualCryusaki

Posted 15 August 2013 - 10:47 PM

The seperate class to load, display and destroy the sprites is my form a Sprite Manager class, instead of having a wall of text in the main main.cpp file that loads all the files in I want to move it to another class and call that method (sorry I think I used the word function incorrectly in my last post) just as a way to sort the code up visually and mentally. The class will have a seperate methods to handle displaying at the end of the loop and then kill the images once the loop has ended completely. Not during the loop

 

Also my bad about the snippit of code that is showing the sprite to texture bit. I left out a line, embarassing :S

It should be edited back in now but incase it isnt here is the revised version

    sf::Texture paddle; // Here is the missing line
    if(!paddle.loadFromFile("Paddle.png"))
        std::cout << "Could not load paddle." << std::endl;
    sf::Sprite sPaddle;
    sPaddle.setTexture(paddle);

I have not taken an official programming language courses so my terminoligy is unsurprisingly poor, all my knowledge comes from free online help all over the web. Good to know though!

    sPaddle.setPosition(0, SCREENHEIGHT/2 - (PADDLEHEIGHT/2));  // Line 31

And ther Error message that is coming up in the build log is saying 

|31|error: 'sPaddle' was not declared in this scope|

#2Cryusaki

Posted 15 August 2013 - 10:45 PM

The seperate class to load, display and destroy the sprites is my form a Sprite Manager class, instead of having a wall of text in the main main.cpp file that loads all the files in I want to move it to another class and call that method (sorry I think I used the word function incorrectly in my last post) just as a way to sort the code up visually and mentally. The class will have a seperate methods to handle displaying at the end of the loop and then kill the images once the loop has ended completely. Not during the loop

 

Also my bad about the snippit of code that is showing the sprite to texture bit. I left out a line, embarassing :S

It should be edited back in now but incase it isnt here is the revised version

    sf::Texture paddle; // Here is the missing line
    if(!paddle.loadFromFile("Paddle.png"))
        std::cout << "Could not load paddle." << std::endl;
    sf::Sprite sPaddle;
    sPaddle.setTexture(paddle);

I have not taken and official programming language courses so my terminoligy is unsurprisingly poor, all my knowledge comes from free online help all over the web. Good to know though!

    sPaddle.setPosition(0, SCREENHEIGHT/2 - (PADDLEHEIGHT/2));  // Line 31

And ther Error message that is coming up in the build log is saying 

|31|error: 'sPaddle' was not declared in this scope|

#1Cryusaki

Posted 15 August 2013 - 10:41 PM

The seperate class to load, display and destroy the sprites is my form a Sprite Manager class, instead of having a wall of text in the main main.cpp file that loads all the files in I want to move it to another class and call that method (sorry I think I used the word function incorrectly in my last post) just as a way to sort the code up visually and mentally. The class will have a seperate methods to handle displaying at the end of the loop and then kill the images once the loop has ended completely. Not during the loop

 

Also my bad about the snippit of code that is showing the sprite to texture bit. I left out a line, embarassing :S

It should be edited back in now but incase it isnt here is the revised version

    sf::Texture paddle; // Here is the missing line
    if(!paddle.loadFromFile("Paddle.png"))
        std::cout << "Could not load paddle." << std::endl;
    sf::Sprite sPaddle;
    sPaddle.setTexture(paddle);

I have not taken and official programming language courses so my terminoligy is unsurprisingly poor, all my knowledge comes from free online help all over the web. Good to know though!


PARTNERS