SFML community forums

Help => General => Topic started by: BaneTrapper on August 01, 2013, 09:12:33 pm

Title: Changable keys ingame?
Post by: BaneTrapper on August 01, 2013, 09:12:33 pm
Hello.
I believe this question has bean asked many times, but using search provides me with error asking me to contact admin...
Could someone point me to some post about changable keys ingame?
EX:
i will mose "W = north" "S = south" "A = West" "D = East"
how can i allow player to switch witch button calls witch effecet?
Title: Re: Changable keys ingame?
Post by: Laurent on August 01, 2013, 09:34:42 pm
Quote
using search provides me with error asking me to contact admin...
Don't select all forums.
Title: Re: Changable keys ingame?
Post by: ahnonay on August 01, 2013, 09:50:23 pm
Maybe you are looking for something like this:
https://github.com/SFML/SFML/wiki/Tutorial%3A-Manage-dynamic-key-binding
Title: Re: Changable keys ingame?
Post by: Yemeni Cpluspluser on August 01, 2013, 11:19:54 pm
save the key as a variable then tell the user to press the key for example for attack
as you can see each key has a specific value, store that value in your variable


    std::cout << sf::Keyboard::Key::Up;
    int userKeyUp = sf::Keyboard::Key::Up;

   

 
[/s]


its just I am not sure how to know which key pressed to take it to the variable



EDIT : check ahnonay post