Something went wrong. Try again.
[Mirror] Libreopolis is a cross-platform city simulation game fully compatible with SimCity 2000. gitlab.com/conasg/libreopolis
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930#include "sc2k/render/pixel_change_tracker.hpp"
#include <cstdio>#include <vector>
#include "test_harness.hpp"
int main() { using namespace sc2k::render; std::vector<Rgba> pixels(8 * 6, Rgba{0, 0, 0, 0}); PixelChangeTracker tracker;
CHECK((tracker.update(pixels, 8, 6) == PixelChangeRect{0, 0, 8, 6})); CHECK(!tracker.update(pixels, 8, 6));
pixels[1 * 8 + 2] = {1, 2, 3, 4}; pixels[4 * 8 + 6] = {5, 6, 7, 8}; CHECK((tracker.update(pixels, 8, 6) == PixelChangeRect{2, 1, 5, 4})); CHECK(!tracker.update(pixels, 8, 6));
pixels.assign(3 * 2, Rgba{9, 8, 7, 6}); CHECK((tracker.update(pixels, 3, 2) == PixelChangeRect{0, 0, 3, 2}));
if (failures == 0) { std::puts("pixel change tracker: unchanged frames skipped and edits bounded"); return 0; } return 1;}