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

Author Topic: move window.setKeyRepeatEnabled to sf::Keyboard  (Read 4053 times)

0 Members and 1 Guest are viewing this topic.

mateandmetal

  • Full Member
  • ***
  • Posts: 171
  • The bird is the word
    • View Profile
    • my blog
move window.setKeyRepeatEnabled to sf::Keyboard
« on: April 30, 2012, 12:35:19 am »
Hi

I would like to propose something. Moving the setKeyRepeatEnabled from sf::Window to sf::Keyboard, and sf::Window::setJoystickThreshold to sf::Joystick.... Since all belongs to the same module (Window), it may not be so difficult.

I´m writing my input manager class, and i need a renderwindow just to set this two options. Does this two functions really need a renderwindow?  ???
- Mate (beverage) addict
- Heavy metal addict _lml
- SFML 2 addict
- My first (and free) game: BichingISH!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: move window.setKeyRepeatEnabled to sf::Keyboard
« Reply #1 on: April 30, 2012, 07:59:06 am »
setKeyRepeatEnabled will only impact KeyPressed and KeyReleased events, and it's the same for setJoystickThreshold and JoystickMoved events. So yes, they truly are attributes of the window itself.

If you're creating a window just to call them then you might be doing something really wrong, because they will have effect only on this window.
Laurent Gomila - SFML developer

mateandmetal

  • Full Member
  • ***
  • Posts: 171
  • The bird is the word
    • View Profile
    • my blog
Re: move window.setKeyRepeatEnabled to sf::Keyboard
« Reply #2 on: April 30, 2012, 11:08:47 pm »
Ah, ok
I´m only using the realtime sf::Keyboard, sf::Mouse and sf::Joystick, so.. I dont need that event functions.

Thanks Laurent

Btw... The mouse wheel.. why can´t be read at realtime using sf::Mouse?
- Mate (beverage) addict
- Heavy metal addict _lml
- SFML 2 addict
- My first (and free) game: BichingISH!

minirop

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
    • http://dev.peyj.com
Re: move window.setKeyRepeatEnabled to sf::Keyboard
« Reply #3 on: May 01, 2012, 12:25:43 am »
Btw... The mouse wheel.. why can´t be read at realtime using sf::Mouse?
because it's not like a joystick, a mouse wheel doesn't have a "middle/neutral/whatever" position. it's button-like.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: move window.setKeyRepeatEnabled to sf::Keyboard
« Reply #4 on: May 01, 2012, 02:57:34 am »
because it's not like a joystick, a mouse wheel doesn't have a "middle/neutral/whatever" position. it's button-like.

Huh? This now doesn't really make sense, does it?

If it's button like why shouldn't it be accessable at realtime? I mean you can check for key strokes and mouse button clicks.
But I don't see how you'd implement a non event process nicely. If you would provide it with sf::Mouse you somehow would need to return a direction vector and the current spinning speed or something like this, otherwise it would be kind of hard to determin the state.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Klaim

  • Full Member
  • ***
  • Posts: 137
    • View Profile
Re: move window.setKeyRepeatEnabled to sf::Keyboard
« Reply #5 on: May 01, 2012, 11:19:30 am »
The mouse wheel, in all platform-specific implementations, have no state. It only gives you modifications of the state, exactly like when you move mouse in a relative space. Interpretation is always application-dependent.

mateandmetal

  • Full Member
  • ***
  • Posts: 171
  • The bird is the word
    • View Profile
    • my blog
Re: move window.setKeyRepeatEnabled to sf::Keyboard
« Reply #6 on: May 01, 2012, 11:40:43 pm »
Ok. Thanks!
- Mate (beverage) addict
- Heavy metal addict _lml
- SFML 2 addict
- My first (and free) game: BichingISH!