Jsfml method, poolEvents ()

I recently started a project in java using a library JSFML. My code snippet is as follows:

Iterable<Event> events;
events = mRenderWindow.pollEvents();
mKeyboardListener.handleEvents(events);
mMouseListener.handleEvents(events);

My problem is that when I use it first KeyboardListener, then it MouseListenerdoesn’t work and vice versa. Can anyone explain this behavior? I was looking for some information, and explanations are not enough.

+4
source share
1 answer

You have to make a copy of events if you want to repeat them several times, because jsfml indicates a custom iterator.

+2
source

Source: https://habr.com/ru/post/1624076/


All Articles