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

Pages: [1]
1
That fixed my issue. Thank you.

2
I am using x86 libs.
I am using VS 2012, and I downloaded the SFML 2.3 package for VS 2012.
I am only using debug mode for the time being.
I don't think I am using old headers. Only those that came with the SFML 2.3 package for VS 2012.

Edit: I just tested this code on another computer with a different version of Visual Studio, and I got the same error. This makes me think the problem is with my code somewhere.

3
I am receiving an unhandled exception error when trying to draw a Text object. Here is the error message:

Quote
Unhandled exception at 0x59085815 (sfml-graphics-2.dll) in Program.exe: 0xC0000005: Access violation reading location 0x3F800058.

The thing is, I am telling main to draw a Drawable object (InputBox), which is telling another Drawable object (Button) to draw the Text. If I replace the Text object with another Drawable, such as a CircleShape, the program works. Also, if I draw the Button in main directly, it works as well. Here is my code:

My main Program
int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "My window");
        InputBox inputBox;
    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(inputBox);
        window.display();
    }

    return 0;
}

InputBox class
class InputBox : public sf::Transformable, public sf::Drawable
{
public:
        InputBox()
        {
                button = Button();
        }
        virtual void draw(sf::RenderTarget &target, sf::RenderStates states) const
        {
                states.transform *= getTransform();
                target.draw(button, states);
        }
private:
        Button button;
};

Button class
class Button : public sf::Transformable, public sf::Drawable
{
public:
        Button()
        {
                font.loadFromFile("arial.ttf");
                text.setFont(font);
                text.setString("Button");
        }
        virtual void draw(sf::RenderTarget &target, sf::RenderStates states) const
        {
                states.transform *= getTransform();
                target.draw(text, states);
        }
private:
        sf::Font font;
        sf::Text text;
};

Pages: [1]
anything