From e6c241add375353c1c80b0e3915a6505dbd5db9a Mon Sep 17 00:00:00 2001 From: Leonard Kugis Date: Tue, 23 Jan 2018 01:23:23 +0100 Subject: Added zoom speed option --- src/mandelbrot-zoom.c | 5 ++++- src/mandelbrot-zoom.h | 1 + src/render.c | 2 +- src/render.h | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mandelbrot-zoom.c b/src/mandelbrot-zoom.c index e208940..9410734 100644 --- a/src/mandelbrot-zoom.c +++ b/src/mandelbrot-zoom.c @@ -23,6 +23,7 @@ int main(int argc, char **argv) ui_settings.colorToBtn = GTK_BUTTON(gtk_builder_get_object(builder, "colorToBtn")); ui_settings.zoomToXEntry = GTK_ENTRY(gtk_builder_get_object(builder, "zoomToXEntry")); ui_settings.zoomToYEntry = GTK_ENTRY(gtk_builder_get_object(builder, "zoomToYEntry")); + ui_settings.speedEntry = GTK_ENTRY(gtk_builder_get_object(builder, "speedEntry")); ui_settings.exportCb = GTK_CHECK_BUTTON(gtk_builder_get_object(builder, "exportCb")); ui_settings.gifRd = GTK_RADIO_BUTTON(gtk_builder_get_object(builder, "gifRd")); ui_settings.widthSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "widthSp")); @@ -138,11 +139,13 @@ void on_bitrateSp_valueChanged() void on_startBtn_clicked() { - double x, y; + double x, y, speed; sscanf(gtk_entry_get_text(ui_settings.zoomToXEntry), "%lf", &x); sscanf(gtk_entry_get_text(ui_settings.zoomToYEntry), "%lf", &y); + sscanf(gtk_entry_get_text(ui_settings.speedEntry), "%lf", &speed); config.to_x = x; config.to_y = y; + config.speed = speed; printf("config {\n\t.iterations = %u\n\t.tox = %f\n\t.toy = %f\n\t.video = %u\n\t.filetype = %u\n\t.width = %u\n\t.height = %u\n\t.renderFPS = %u\n\t.videoFPS = %u\n\t.bitrate = %u\n\t.path = %s\n}\n", config.iterations, x, y, config.video, 0, config.width, config.height, config.renderFPS, config.videoFPS, config.bitrate, config.path); render_init(&config, mandelbrot_r); render_show(); diff --git a/src/mandelbrot-zoom.h b/src/mandelbrot-zoom.h index 3953b2d..a57deba 100644 --- a/src/mandelbrot-zoom.h +++ b/src/mandelbrot-zoom.h @@ -22,6 +22,7 @@ typedef struct Ui_settings { GtkButton *colorToBtn; GtkEntry *zoomToXEntry; GtkEntry *zoomToYEntry; + GtkEntry *speedEntry; GtkCheckButton *exportCb; GtkRadioButton *gifRd; GtkSpinButton *widthSp; diff --git a/src/render.c b/src/render.c index 27573cf..55d514b 100644 --- a/src/render.c +++ b/src/render.c @@ -120,7 +120,7 @@ void gl_idle(void) int t = glutGet(GLUT_ELAPSED_TIME); dt = (t - delta) / 1000.0; delta = t; - ft+=(0.1*dt); + ft+=(_config->speed*dt); x_min = x_min_s + zoom_func(ft, (long double)2.0 + _config->to_x); y_min = y_min_s + zoom_func(ft, (long double)1.0 + _config->to_y); x_max = x_max_s - zoom_func(ft, (long double)1.0 - _config->to_x); diff --git a/src/render.h b/src/render.h index 83a5c1a..dde79be 100644 --- a/src/render.h +++ b/src/render.h @@ -23,6 +23,7 @@ typedef struct config { u32 colorTo; long double to_x; long double to_y; + long double speed; u8 video; u8 filetype; u16 width; -- cgit v1.2.1