SFML community forums

Help => Window => Topic started by: Makuto on April 10, 2013, 05:36:51 pm

Title: Input Layer
Post by: Makuto on April 10, 2013, 05:36:51 pm
I have a library that provides a layer over SFML so I can swap it out for other versions/libraries (right now I have an SFML 1.6 version and an SFML 2.0 version). The only thing that I have to change when I swap from the SFML 1.6 layer to the SFML 2.0 layer (and vice versa) is sf::Key to sf::Keyboard (and vice versa).

What I want to do is make my own layer over those enumeration values so that I have a call like this:
myApp::isPressed(myApp::code::K)
rather than
myApp::isPressed(sf::Key::K)
that works on the SFML 1.6 and 2.0 layers without breaking them (so it becomes sf::Key::K or sf::Keyboard::K in SFML 1.6 or SFML 2.0 respectively).

Are there any functions that would make this easier? Or do I need to make my own key codes, then have a converter function that converts it from one to the other with a switch or something?
Title: Re: Input Layer
Post by: Laurent on April 10, 2013, 05:41:51 pm
Quote
Or do I need to make my own key codes, then have a converter function that converts it from one to the other with a switch or something?
Yep, you have to do that.
Title: Re: Input Layer
Post by: Makuto on April 10, 2013, 05:54:33 pm
Ok, just making sure.

Thanks for the awesomely fast post!