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

Author Topic: Getting key binds to/from an xml file.  (Read 1437 times)

0 Members and 1 Guest are viewing this topic.

Sumzary

  • Guest
Getting key binds to/from an xml file.
« on: July 25, 2013, 07:55:59 pm »
Hi!

I have a program made with Qt that looks like this:



Then the binds should be exported to an xml file and imported by the game on startup.

How would I go about doing that?

Aster

  • Full Member
  • ***
  • Posts: 130
    • View Profile
Re: Getting key binds to/from an xml file.
« Reply #1 on: July 25, 2013, 09:19:36 pm »
Should? This smells of homework. Have you checked the logo on the top right of the forum? This has nothing to do with SFML. Just get an XML parser, learn XML, and do it yourself.

Sumzary

  • Guest
Re: Getting key binds to/from an xml file.
« Reply #2 on: July 25, 2013, 09:47:40 pm »
What I am asking is how would I convert the strings in the xml to the enums in SFML and the other way around.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Getting key binds to/from an xml file.
« Reply #3 on: July 25, 2013, 10:03:51 pm »
SFML doesn't provide such conversion functions, but Thor does.

The problem is, to convert between enums and strings in C++, you have to list every single case explicitly -- that's why I included this boilerplate code to Thor, hoping that not everybody has to reinvent the wheel ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Sumzary

  • Guest
Re: Getting key binds to/from an xml file.
« Reply #4 on: July 25, 2013, 10:11:47 pm »
Ooh, thanks a whole bunch Nexus, it would have taken AGES otherwise.

Thanks again :D