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

Author Topic: Why it doesn't draw?  (Read 1328 times)

0 Members and 1 Guest are viewing this topic.

sensus12

  • Newbie
  • *
  • Posts: 6
    • View Profile
Why it doesn't draw?
« on: November 09, 2014, 11:23:24 pm »
My draw function doesn't work but i've got no compiler errors, i used debugger but it didn't help me(everythink seems fine), so i'm here to ask u why it doesn't actually draw
I've set the position of sprite, and texture. My draw function is:
void Player::render(sf::RenderWindow &window)
{
        window.draw(player);
}
 
but it actually doesn't show anything (yes, i have it in my game loop).
May be this because of textures are .bmp files? I've used .bmp files and everything was okay but now i don't know why it just doesn't draw.
It just seems like anything that i do with sprite isn't working, dunno why.
I know that because i made an circle and set this position to player position but i couldn't even move the sprite position (sprite is a player).
My render function in gameLoop is:
void Game::render()
{
        mWindow.clear();
        player.render(mWindow);
        mWindow.display();
}
 

Sorry for my bad english.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Why it doesn't draw?
« Reply #1 on: November 09, 2014, 11:27:23 pm »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Gambit

  • Sr. Member
  • ****
  • Posts: 283
    • View Profile
Re: Why it doesn't draw?
« Reply #2 on: November 10, 2014, 04:26:01 am »
What Nexus said. The code you posted provides almost no insight into your problem at all. Furthermore, you are not handling your render properly, you should look into deriving your drawable classes from sf::Drawable and include the handling of sf::RenderStates.

 

anything