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

Pages: [1]
1
SFML projects / Re: Procedurally generated starfield
« on: June 04, 2017, 08:36:18 pm »
Just a little addition, these guards can help you to run just fine (windows build)

void Starfield::drawStarField(sf::Texture& texture)
{
    for (auto it = smallStars.begin(); it != smallStars.end(); ++it)
    {
        auto xCoord = it->getXPos();
        auto yCoord = it->getYPos();

        if ((xCoord > 0 && xCoord < 1280) && (yCoord > 0 && yCoord < 960))
            texture.update(smallStarImage, it->getXPos(), it->getYPos());
    }

    for (auto it = mediumStars.begin(); it != mediumStars.end(); ++it)
    {
        auto xCoord = it->getXPos();
        auto yCoord = it->getYPos();

        if ((xCoord > 0 && xCoord < 1279) && (yCoord > 0 && yCoord < 959))
            texture.update(mediumStarImage, it->getXPos(), it->getYPos());
    }

    for (auto it = largeStars.begin(); it != largeStars.end(); ++it)
    {
        auto xCoord = it->getXPos();
        auto yCoord = it->getYPos();

        if ((xCoord > 0 && xCoord < 1276) && (yCoord > 0 && yCoord < 956))
            texture.update(largeStarImage, it->getXPos(), it->getYPos());
    }
}

Pages: [1]
anything