add reset function on releasing the R key

This commit is contained in:
Akos Horvath 2022-07-19 21:20:05 +02:00
parent f1da5df0bc
commit a561882a53

View File

@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "graphics.h"
#include "mpreal.h"
#include <SDL2/SDL.h>
#include <SDL2/SDL_pixels.h>
#include <SDL2/SDL_render.h>
@ -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;
}
}