Re: C++ fixed width and strange 0 truncation

2020-03-22 Thread AudioGames . net Forum — Developers room : Kyleman123 via Audiogames-reflector
Re: C++ fixed width and strange 0 truncation SDL_Color is provided by SDL2. As I'm already using SDL2 I thought I should go ahead and use what is provided. I'm just story my colors in SDL_Color structs and getting the r, g, b, and a values when needed.I'm not as familiar with the bitwise

Re: C++ fixed width and strange 0 truncation

2020-03-21 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: C++ fixed width and strange 0 truncation I'm not offhand familiar with that struct, but you can pack them as well yourself, assuming each is an int from 0 to 255:int color = (x.r<<24)+(x.g<<16)+(x.b<<8)+x.a;You may already know this one though. URL: https://forum.a

Re: C++ fixed width and strange 0 truncation

2020-03-21 Thread AudioGames . net Forum — Developers room : Kyleman123 via Audiogames-reflector
Re: C++ fixed width and strange 0 truncation I'm just going to use struct SDL_Color {r, g, b, a}. I didn't necessarily want to have to use that and have to unpack the components every time, but its way more clear, compatible with many more systems, and easier to manipulate the individual

Re: C++ fixed width and strange 0 truncation

2020-03-21 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: C++ fixed width and strange 0 truncation Your issue is that the formatting ignores leading zero bits because it's for human-friendly output.  You will need to ask it to print fixed width hex.The C++ streams are complicated and massively overdesigned. I always use printf for these cases

C++ fixed width and strange 0 truncation

2020-03-21 Thread AudioGames . net Forum — Developers room : Kyleman123 via Audiogames-reflector
C++ fixed width and strange 0 truncation Long story short, I am trying to save a 32 bit or 4 byte unsigned int. This is being used as hex values for colors that take the following form:0xRRGGBBAAwhere RR is the amount of red from 0 - 255where GG is the amount of green from 0 - 255where BB