void d(Puzzle p) { for(int i = 0; i < p.size(); i++) { for(int j = 0; j < p[i].size(); j++) { printf("%5d", p[i][j]); } cout << endl; } }
void PuzzlesDraw(const Puzzle & pzl, const Surface & sf, s16 dstx, s16 dsty) { Display & display = Display::Get(); Cursor & cursor = Cursor::Get(); // show all for debug if(IS_DEVEL()) return; u8 alpha = 250; u32 ticket = 0; LocalEvent & le = LocalEvent::Get(); while(le.HandleEvents() && 0 < alpha) { if(Game::ShouldAnimateInfrequent(ticket, 1)) { cursor.Hide(); display.Blit(sf, dstx, dsty); for(size_t ii = 0; ii < pzl.size(); ++ii) { const Sprite & piece = AGG::GetICN(ICN::PUZZLE, ii); if(pzl.test(ii)) { Surface fade(piece.w(), piece.h()); fade.SetColorKey(); fade.Blit(piece); fade.SetAlpha(alpha); if(Settings::Get().QVGA()) display.Blit(fade, dstx + 8 + piece.x() - BORDERWIDTH, dsty + 8 + piece.y() - BORDERWIDTH); else display.Blit(fade, dstx + piece.x() - BORDERWIDTH, dsty + piece.y() - BORDERWIDTH); } else { if(Settings::Get().QVGA()) display.Blit(piece, dstx + 8 + piece.x() - BORDERWIDTH, dsty + 8 + piece.y() - BORDERWIDTH); else display.Blit(piece, dstx + piece.x() - BORDERWIDTH, dsty + piece.y() - BORDERWIDTH); } } cursor.Show(); display.Flip(); alpha -= 10; } ++ticket; } cursor.Hide(); }