Sign in to follow this  
vs322

Loading Hex Values with tinyXML

Recommended Posts

Hello all. Any one know of a way to load hex values written in a 0xff332255 or ff332255 style and load them with tinyxml. Or will I be better off loading a string and then writing a conversion function? I'm using this for loading color values for Gui elements and it makes a lot more sense to me to write ff332255 over 4281541205.

Share this post


Link to post
Share on other sites
Quote:
Original post by NisseBosseLasse
Couldn't you save the values in RGB-format, and parse that instead?

EDIT: I mean as 0-255, in tags of <R>255</R> or so...


I very easyly could, but the way I am using the values as DWORDs in my program so I'd have to convert them once I've loaded the values, and I am getting my color values from a color picker that gives me the Hex value. I also have become very accoustumed to reading hex as colors and it will keep everything nice and condensed in my xml file.

I think I am just going to load them as strings and use a std::istringstream and std::hex. Works well enough.

EDIT: humm seemed to have missed strtoi/_strtoi64 will try this as well;

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this