Advertisement Jump to content
Sign in to follow this  

SDL coversion problem

This topic is 5189 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

Hi, I'm trying to find a per pixel value from an SDL_surface. everytime i run the program, it craps out converting a Uint8 to Uint32. Or does it? This is the code: SDL_LockSurface(Test01); Uint8 *p_8; p_8 = (Uint8*) Test01->pixels + ly * Test01->pitch + lx * 2 ; Uint32 col; col= *(Uint32*)p_8 ; // never gets to the print stage; printf("color: %d ",col); Uint8 lr, lg, lb, la; SDL_GetRGBA(col, Test01->format, &lr, &lg, &lb, &la); printf("la: %d ",la); SDL_UnlockSurface(Test01); Any ideas/suggestions would be incredibly helpful! thanx in advance

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!