chore: more abstraction and other refactors

This commit is contained in:
Virt 2024-06-28 14:08:13 +02:00
commit fa7cab8717
9 changed files with 263 additions and 175 deletions

20
src/other/Shake.hpp Normal file
View file

@ -0,0 +1,20 @@
#include <hyprutils/math/Vector2D.hpp>
#include <vector>
using namespace Hyprutils::Math;
class CShake {
public:
/* calculates the new zoom factor for the current pos */
double update(Vector2D pos);
private:
/* tracks the global software lock issued by cursor shaking */
bool software = false;
/* ringbuffer for last samples */
std::vector<Vector2D> samples;
/* we also store the distance for each sample to the last, so we do only compute this once */
std::vector<double> samples_distance;
int samples_index = 0;
};