Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: New global inputs in SFML 2  (Read 25021 times)

0 Members and 1 Guest are viewing this topic.

henrikno

  • Newbie
  • *
  • Posts: 8
    • View Profile
New global inputs in SFML 2
« Reply #60 on: July 28, 2011, 05:45:21 pm »
Quote
It is just this issue which is more complicated to achieve, in general the new input system is much cleaner.

The most common case got a lot more complicated to make it "cleaner"?
I can't see any common use case where I would want to get the keyboard state while the window is unfocused. (except for a keylogger).

Keeping track of the window focus seems like the easiest way of doing the common case. Perhaps providing a window.HasFocus() method would make it simple again.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
New global inputs in SFML 2
« Reply #61 on: July 28, 2011, 06:11:19 pm »
Quote
Keeping track of the window focus seems like the easiest way of doing the common case. Perhaps providing a window.HasFocus() method would make it simple again.

Indeed.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
New global inputs in SFML 2
« Reply #62 on: October 26, 2011, 07:38:48 pm »
You could also handle it similiarly to sf::Mouse, while reflecting about non-malicious use cases of the first overload :D
Code: [Select]
class Keyboard
{
    public:
        static bool IsKeyPressed(Key key);
        static bool IsKeyPressed(Key key, const sf::Window& window);
    ...
};
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
New global inputs in SFML 2
« Reply #63 on: October 26, 2011, 07:41:36 pm »
Sometimes you may be maybe switching between two or more windows so using the second version would be a pain in the neck if you want to share the keyboard state among the different windows. This is uncommon but still.
SFML / OS X developer

 

anything