31
Window / Re: [SFML 2.0]Problem with repeating buttons and events.
« on: August 30, 2014, 01:58:46 am »
I've spent more than 20 mins writing the last reply, have you read it yet? Why do you keep using bool = signed integer?
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.
So, okno.pollEvent(event) is checking all event events in okno, right?As you can see here SFML builds a LIFO ( I think) queue with every event happened in the last frame, pollEvent gives you the last even that has been registered. A loop is the only way to handle the events. What you do in the loop depends on what you need, but i recommend using the Thor library as soon as you've understood the flaws in your code (cleaner and sexier code ).
How am I able to manage multiple events in one window? Or should I use this one for everything?
As there's while in main loop, won't it cause lags/something like that?
It's working (even for letters), but I've got a question - why wasn't it working earlier? (or working partially?)You were polling for the last event of the queue. The order is decided either by the OS or by how SFML was implemented (no time to check the source ). The last IF statement was working on the same first event so it could only work if by chance the last event in the queue was keypressed.
And now, what with okno.setKeyRepeatEnabled(false); ? This code starts and stops my game in loop as long, as I'm holding P. How to disable this? (without any variables - I think that making "lock" variable for every key is a bad idea)This is happening because you create a sf::event out of the scope and you don't poll the queue correctly.
I want to write "skills"- functions, which would be called with keys (like Q, W, E, R). And when (wasd) moving it's simple (checking key state), in this case it's a little more complicated, as I need to check if a key was pressed-released (once)I you can either do something like
If I have:The fact that the bool CLASS may be able to implicitly convert an integer number to bool shouldn't concern you. You MUST use either true or false because those are the keywords that were meant to work with bools.
bool abc;, does abc = 0; is equal to abc = false;?
his sf::Texture is obviously getting destroyed in the constructor, so this is probably the white square problem again.He's declaring another pTexture and a different playerImage in the constructor while Player::pTexture and Player::playerImage are left untouched.
Was fixed recently:This one? https://github.com/SFML/SFML/commit/b96d330b9f2f5b6c9d61fa4868af89bf854ada20
https://github.com/SFML/SFML/commit/eaab2c1c6816f290c403db372a489d06f41eee19
Build the latest master... or wait for someone to provide a pre-built one for you.
That's strange. I have the window, system, and graphics .dll's packaged with it. I downloaded the release just to double check. I wonder if it has anything to do with GCC compiled dll's (judging by the error msg)?MOst likely the answer