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.


Topics - Erikelelf

Pages: [1]
1
General / SFML Window Won't Draw Anything
« on: August 10, 2019, 03:23:42 pm »
First of all I'd just like to say I greatly appreciate any answers to this question. I know you probably get this question all the time and I'm just doing something dumb but I really can't figure out what I'm doing wrong. I've downloaded SFML and followed the tutorial to get it working with Codeblocks. After some initial trouble, I've managed to link the libraries and get everything setup. With that done, I copy pasted the example code in the tutorial into my file and hit build and run.

The code runs completely fine, but it doesn't work how it should at all. The window to draw the shape appears, but absolutely nothing appears in it. Not a background, not the shape, just a blank white box. I've tried everything, drawing different shapes, making changes to various parts of the code, finding other examples online. I've researched the problem and gone through over two google pages, but the most I could find was something to do with Intel not working well with RenderWindow. I don't think I've made a mistake linking the libraries because the code works just fine and autocomplete pops up with SFML syntax so it's got to be connected. Here's the code.

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}

As you can see, it's copied exactly from the tutorial. This is all that pops up when I build and run:



Can anyone help me?

Pages: [1]