// Create "hard light" lookup table (multiply and screen combined) unsigned char * palette_table_hardlight(unsigned char *pal){ int fg, bg; int red, green, blue; unsigned char * lut; if(pal==NULL) return NULL; lut = (unsigned char*)malloc(256*256); if(lut==NULL) return NULL; for(fg=0; fg<256; fg++){ for(bg=fg; bg<256; bg++){ red = hardlight(pal[bg*3], pal[fg*3]); green = hardlight(pal[bg*3+1], pal[fg*3+1]); blue = hardlight(pal[bg*3+2], pal[fg*3+2]); lut[(fg<<8)+bg] = palette_find(pal, red, green, blue); lut[(bg<<8)+fg] = lut[(fg<<8)+bg]; } } return lut; }
void FloatingText::reset(float x, float y, const std::string& text, int color) { revive(); if (cameraZoom != Camera::mainCamera->zoomf) { cameraZoom = Camera::mainCamera->zoomf; PixelScene::chooseFont(9, cameraZoom); //font = PixelScene.font; GameMath::PointFSet(&scale, PixelScene::scale); //scale.set(PixelScene.scale); } this->text(text); hardlight(color); measure(); this->x = PixelScene::align(x - Width() / 2); this->y = y - Height(); timeLeft = LIFESPAN; }