This is kind of important because a lot of my code is based on this.
Is there a better way than what I'm doing:
sf::Uint8* Get_Pixel(sf::Uint8* img_ptr,int w,int h,int x,int y)
{
int index=(((y*h)-y)+(x))*4;
sf::Uint8 *ptr=new sf::Uint8[3];
ptr[0]=img_ptr[index];
ptr[1]=img_ptr[index+1];
ptr[2]=img_ptr[index+2];
ptr[3]=img_ptr[index+3];
return ptr;
}
sf::Uint8 *img_ptr=const_cast<sf::Uint8*>(img.GetPixelsPtr());
sf::Uint8 *ptr3=Get_Pixel(img_ptr,w,h,80,0);