feat: add support for centering the screen around best/midpoint

Pressing 'c' will center the screen around the average position of the
particles. Pressing 'f' will center the screen on each frame.

Pressing 'b' will center the screen around the best found point.
This commit is contained in:
2024-11-26 00:08:47 +01:00
parent 4dae604485
commit 585fdc3a7e
3 changed files with 39 additions and 8 deletions

View File

@@ -40,14 +40,15 @@ struct Screen {
Symbol &at(int x, int y);
Symbol &at(float x, float y);
void resize(std::size_t n);
void resize(std::size_t x, std::size_t y);
void move_to(float x, float y);
std::pair<float, float> screen_to_xy(int w, int h);
std::pair<int, int> xy_to_screen(float x, float y);
Screen(std::size_t n) : buf(nullptr) { resize(n); }
Screen(std::size_t x, std::size_t y) : buf(nullptr) { resize(x, y); }
Screen(std::size_t x, std::size_t y) : buf(nullptr)
{ resize(x, y); move_to(0, 0); }
~Screen() { delete[] buf; }
std::vector<const vec<2>*> points;