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

Author Topic: Input Layer  (Read 1980 times)

0 Members and 1 Guest are viewing this topic.

Makuto

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
    • Au 79 Games
    • Email
Input Layer
« 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?
Macoy Madson-Au 79 Games
Check out my work at http://augames.f11.us/
Most of my SFML-related code is here: https://github.com/makuto/personal/tree/master/gameDev/resources/base2.0
I try to KIS(S), do you?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Input Layer
« Reply #1 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.
Laurent Gomila - SFML developer

Makuto

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
    • Au 79 Games
    • Email
Re: Input Layer
« Reply #2 on: April 10, 2013, 05:54:33 pm »
Ok, just making sure.

Thanks for the awesomely fast post!
Macoy Madson-Au 79 Games
Check out my work at http://augames.f11.us/
Most of my SFML-related code is here: https://github.com/makuto/personal/tree/master/gameDev/resources/base2.0
I try to KIS(S), do you?

 

anything