Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

SikCiv

Need help..Operators - adding bytes to dword

This topic is 6259 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to add alpha and RGB values to a DWORD. I have two variables (where the XX are modified only).. BYTE nAlpha; // 0xXX DWORD nRGB; // 0x00XXXXXX I need to add them together, for example, if the alpha was 0x55 and the RGB was 0x00667788, the outcome would be 0x55667788 At the moment I do it this way: nAlpha = 0x55; nRGB = 0x00667788; dwColor = ( ((nAlpha) << 24) | nRGB ) ; But the results are incorrect How is this done properly? Thanks in advance

  Downloads:  ZeroOne Realm

Share this post


Link to post
Share on other sites
Advertisement
Um, dont worry, I have it working now.
(Stupid mistake: The RGB was 0xFFFFFF)

I prefer not to use the D3D macros, thanks anyway.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!