From a561882a53151c1af139a69ca343ea559b79125f Mon Sep 17 00:00:00 2001 From: koma Date: Tue, 19 Jul 2022 21:20:05 +0200 Subject: [PATCH] add reset function on releasing the R key --- graphics.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/graphics.cpp b/graphics.cpp index f0b73a8..7eb52e7 100644 --- a/graphics.cpp +++ b/graphics.cpp @@ -18,6 +18,7 @@ along with this program. If not, see . */ #include "graphics.h" +#include "mpreal.h" #include #include #include @@ -428,6 +429,16 @@ void Graphics::mainLoop() this->m_end.x = event.motion.x; this->m_end.y = event.motion.y; break; + case SDL_KEYUP: + if (event.key.keysym.scancode == SDL_SCANCODE_R) { + mpreal::set_default_prec(mpfr::digits2bits(20)); + m.f.x = mpreal(-2.0); + m.f.y = mpreal(-1.0); + m.t.x = mpreal(1.0); + m.t.y = mpreal(1.0); + m.diff = mpreal(0.0001); + } + break; } }