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 - C++AndChill

Pages: [1]
1
int main(){

    sf::RenderWindow window(sf::VideoMode(800, 600), "Game");

    sf::RectangleShape rectangle(sf::Vector2f(100, 50));
    shape.setFillColor(sf::Color(211, 211, 211));

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {

            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear(sf::Color::Black);

        window.draw(shape);

        window.display();
}

    sf::Music music;

    if (!music.openFromFile("audio/ambwon.ogg")){}

    music.setVolume(50);
    music.play();

}
 

My compiler, GNU GCC, gives me "error: 'shape' was not declared in this scope" on line 17 (shape.setFillColor(sf::Color(211, 211, 211));.

shape.setFillColor worked just fine earlier, so why is it throwing errors all of a sudden?  ???

Any insight would be greatly appreciated.

Pages: [1]
anything