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 - jhender

Pages: [1]
1
Graphics / Re: Sprite not displaying after successful texture load
« on: June 17, 2024, 07:59:37 pm »
Running that code still didn't work, and honestly I'm thinking it has something to do with the .png file, but I'm not sure what. I ended up using a different image and it's been working, so I suppose all's well that ends okay.

2
Graphics / Sprite not displaying after successful texture load
« on: June 16, 2024, 10:13:37 pm »
I'm loading a texture and passing it to my sprite - I know the texture is being loaded correctly as no error message is displayed (and have tried w/ other images that work correctly), but when trying to draw the Sprite I see no result.

Here is the code:
if (!texture.loadFromFile("Media/Textures/eagle.png")) {
    // Error handling as .loadFromFile() returns a boolean.
    std::cout << "Could not import texture.";
}

mPlayer.setTexture(texture);
 

and the player is being drawn in the following:
void Game::render() {

    mWindow.clear(sf::Color::Black);
    mWindow.draw(mPlayer);
    mWindow.display();

}

I've checked to make sure the image is compatible with SFML, that the file is ACTUALLY a png and not manually renamed, that all linkages & directory paths are working (have tried both relative and absolute paths). At this point I'm completely lost and could use some help.

Pages: [1]