Skip to content

Instantly share code, notes, and snippets.

Created March 26, 2012 12:58
Show Gist options
  • Save anonymous/2204882 to your computer and use it in GitHub Desktop.
Save anonymous/2204882 to your computer and use it in GitHub Desktop.
for(int y = 0; y < 13; ++y)
{
for(int x = 0; x < 13; ++x)
{
Uint8 pixelOffset = _ufoTopView->getPixel(x, y);
if(pixelOffset == 0)
{
continue;
}
else
{
Uint8 radarPixelColor = _window->getPixel(_ufoTopView->getX() + x + 4, _ufoTopView->getY() + y + 4);
//std::cout << (unsigned int)radarPixelColor << "\n";
SDL_Color rc = winpal[radarPixelColor];
int colorNo = 0;
for(colorNo = Palette::blockOffset(7); colorNo < Palette::blockOffset(7) + 16; ++colorNo)
{
SDL_Color bc = batpal[colorNo];
if(bc.r == rc.r)
{
break;
}
}
Uint8 color = colorNo - pixelOffset;
_battle->setPixel(_ufoTopView->getX() + x, _ufoTopView->getY() + y, color);
}
}
//std::cout << "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment