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 - Sir Wolf

Pages: [1]
1
General discussions / Re: A new logo for SFML
« on: February 21, 2013, 07:59:57 pm »
Something simpler this time:


For what it's worth, I rather like this one, most of all I've seen on this thread. I guess it might be a little used idea (much like the gears Laurent doesn't want), and possibly too game focused.

2
Window / Re: SFML 2.0 mouse position
« on: July 25, 2012, 01:45:46 pm »
Sorry,
using the
menuEvent.MouseButtonEvent.x
version, it throws an error (in codeBlocks):
error: invalid use of 'struct sf::Event::MouseButtonEvent'

This is during compilation.

Try menuEvent.mouseButton.x instead.

3
It should work with the latest and probably also a bit older versions, as I'm also using VS10.
Otherwise something is off on your end...

Yes, that seems to be the case. But I have no idea what could be the culprit, where to start even looking. I'm thinking something like a build setting when I build SFML or I'm linking to some wrong binary somewhere despite having triple checked it. Something really silly I must be doing somewhere I have missed.

4
I've used the following minimal code and had no problems closing the window with D or Esc in release mode:

// Code snipped

To me, the code you provided, copy pasted, does not work in Release mode. Esc closes the window if I press it first. D doesn't close the window. If I first press D, and after that press Esc, the Esc doesn't close the window anymore. And I am linking to correct binaries, using release files in release mode as I should.

I'll try pulling a fresh SFML source and building it again to see if it works with the most recent snapshot.

5
What exacte SFML version are you using?
Did you compile dynamically or staticlly?

Dynamically, SFML2, built myself from sources I pulled via Git about a month ago.

I have a feeling I just linked the release build of my project to the debug binaries of SFML or somesuch. I guess that would be the most obvious explanation. Edit: Nope, triple checked this, I'm linking correctly.

Out of curiosity, does someone know of something else that could be causing this?

6
I'm using Visual Studio 2010 with default compiler and all that.
Edit: Also, I'm using dynamic SFML2 binaries I compiled myself. Both a version pulled a bit over a month ago and a recent one I built yesterday do not work.

I noticed that a game I'm working on functioned differently when built in the default Release configuration than in the Debug configuration. It's an early prototype, it only has a sprite moving left and right on the screen from keyboard input, but in Release mode it didn't move at all. After some examination I noticed I could still press Esc to close the SFML window, so not all input was disfunctional.

Edit: So Esc worked, but WASD for movement didn't. I figured I would compare if a same action executed by different keys would work, comparing Esc and WASD. I tried the following minimal code (posted and reported as working by eXpl0it3r).

#include <SFML/Graphics.hpp>

int main ()
{
        sf::RenderWindow window(sf::VideoMode(1024, 768), "Test");
        window.setFramerateLimit(20);

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

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

                if (sf::Keyboard::isKeyPressed(sf::Keyboard::D))
                {
                        window.close();
                }

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

    return 0;
}

For me, this piece of code does not work in Release mode. Esc closes the window if I press it first. D doesn't close the window. If I first press D, and after that press Esc, the Esc doesn't close the window anymore. And I am linking to correct binaries, using release files in release mode as I should.

I switched from using sf::Keyboard::isKeyPressed() to polling events from the SFML window and catching KeyPressed and KeyReleased events. This works as expected and my project now functions as it should.

Does anyone have some idea so far, with the information provided, what could be causing this behaviour? What could be causing my code to behave so differently in Release and Debug configurations, that's what I'm primarily worried about as I might have just hidden the problem instead of really solving it.

Pages: [1]