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

Pages: [1]
1
Alright, I'm still having issues but I just found something interesting.

Still using the release client for SFML2, in Codeblocks.  I've completely uninstalled codeblocks, MinGW, and removed everything SFML2 related from my computer. 

I reinstalled CodeBlocks, it has a default version of MinGW included (I believe is 4.4.1).  I've reset every one of the build options within code blocks and tried using dynamic libraries instead of static (the same result).

HOWEVER.

I copied the code on the getting started page on the SFML2 Tutorial page...the one that just draws a circle. It didn't do it.  I tried commenting out the code related to the shape, and it still worked fine.  I then added an or statement to the window.close if statement in the loop.

#include <SFML/Graphics.hpp>
#include <iostream>
using namespace std;
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 || event.key.code == sf::Keyboard::Escape)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
        cout << sf::Mouse::getPosition(window).x << endl;
    }

    return 0;
}
 

This causes the program to close and return no error when X is equal to 36.

While this works normally:

#include <SFML/Graphics.hpp>
#include <iostream>
using namespace std;
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();
        cout << sf::Mouse::getPosition(window).x << endl;
    }

    return 0;
}
 

Does anyone have any ideas while this is. I have also tried moving the sf::Keyboard::Escape to it's own else if statement and it still has the same result.  Then if you replace sf::Keyboard::Escape with sf::Keyboard::_____ where ____ = any other keyboard Key all it does is crash at a different X location. A crashes all the way at the left of the Window. Return crashes near the 57 mark somewhere.

Is this really just me? Does anyone have any ideas.  I'm using the correct debug libraries and not mixing them up.

Edit: I just realized that it is not a crash. For some reason, the mouse hitting those coordinates causes the statement to execute that block of code.  So it is executing window.close().  If I change the content  of the block to cout << "derp" << endl; then it will output derp to the command prompt.

2
Was using the sfml2-rc currently downloadable from the site.  Was using MiniGW 4.4 and just downloaded 4.7.  I'm going to give that a try.  All library were statically linked. I will double check my settings to make sure that they aren't mixed up.

Oh, and the crash didn't say anything.  It produced no error, it just shut down the program and returned 0.

3
Hey there. So I've read through the documentation for the sf::Mouse class and scoured through google and haven't come up with anyone even mentioning they are having the same problem.

In order to ensure the problem was not with another factor I made a simple program that does nothing but draw a window, and output to the console via cout << the X,Y Coords of the mouse cursor relative to the RenderWindow...if I start from the left side of the Window in the negative X's and move right, the last number in the console that prints is 35.  If I start from the right and work my way towards the left edge of the window it crashes and the last printed number is 37.

TL;DR is this a bug? Anyone else experience the same thing?  I've experienced it on my desktop PC and my bootcamped MacBook Pro.

#include <SFML/Graphics.hpp>
#include <iostream>
using namespace std;

int main()
{
sf::RenderWindow Window(sf::VideoMode(800, 600, 32), "Double-yew tee eff ITZ BROKEN!");

int mouseX, mouseY;


while(Window.isOpen())
{
     sf::Event event;
     while(Window.pollEvent(event))
{
        if(event.type == sf::Event::Closed)
               Window.close();
}
mouseX = sf::Mouse::getPosition().x;
mouseY = sf::Mouse::getPosition().y;

Window.clear();
Window.display();
cout << "MouseX: " << mouseX << "\tMouseY: " << mouseY << endl;

}

return 0;
}

 

Pages: [1]
anything