BMFont Binary Loading Help
Hi, I'm having an issue with loading in the BMFont binary data. I have set up the structs as described in the documentation. The first 4 bytes read in fine with the expected results. However, when reading in the first info block of data I have problems. - The first block size appears to be wrong (i.e, I get a really high number) - The first half of the data appears to be wrong, but once it reaches the 'stretchH' section the data is absolutely perfect. - If I skip an extra byte before reading in the data, the first half will be correct (apart from the blocksize data) and the second half wrong. Maybe I have missed something out here? #pragma pack( push, 1 ) struct cFontInfoBlock { 4 Bytes miBlockSize; 2 Bytes muiFontSize; Byte muiReserved :4; Byte muiBold :1; Byte muiItalic :1; Byte muiUnicode :1; Byte muiSmooth :1; Byte muiCharSet; 2 Bytes muiStretchH; Byte muiAA; Byte muiPaddingUp; Byte muiPaddingRight; Byte muiPaddingDown; Byte muiPaddingLeft; Byte muiSpacingHoriz; Byte muiSpacingVert; Byte muiOutline; Byte macFontName[1]; }; If I place an extra byte in the middle of struct it appears to work properly (exluding the blocksize still) but this just doesn't feel right. Thanks for your help.
Ah nevermind, I was being stupid.
It was a big endian - little endian thing :P
It was a big endian - little endian thing :P
Where are you loading the files from, to get a little/big endian problem like this?
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement