diff options
author | Leonard Kugis <leonardkugis@gmail.com> | 2018-01-23 01:23:23 +0100 |
---|---|---|
committer | Leonard Kugis <leonardkugis@gmail.com> | 2018-01-23 01:23:23 +0100 |
commit | e6c241add375353c1c80b0e3915a6505dbd5db9a (patch) | |
tree | d4d840b0aadc075c007fbbeefcb5b18edb52541d | |
parent | f88292eafad9c6443f970ae0b28fa9cd2ae8fb7d (diff) |
Added zoom speed option
-rw-r--r-- | Release/glade/settings.glade | 30 | ||||
-rw-r--r-- | src/mandelbrot-zoom.c | 5 | ||||
-rw-r--r-- | src/mandelbrot-zoom.h | 1 | ||||
-rw-r--r-- | src/render.c | 2 | ||||
-rw-r--r-- | src/render.h | 1 |
5 files changed, 36 insertions, 3 deletions
diff --git a/Release/glade/settings.glade b/Release/glade/settings.glade index a75aef5..b91c11c 100644 --- a/Release/glade/settings.glade +++ b/Release/glade/settings.glade @@ -93,7 +93,7 @@ <object class="GtkTable" id="table3"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="n_rows">4</property> + <property name="n_rows">5</property> <property name="n_columns">2</property> <property name="homogeneous">True</property> <child> @@ -342,6 +342,34 @@ <property name="bottom_attach">4</property> </packing> </child> + <child> + <object class="GtkLabel" id="speedLbl"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Zoom speed</property> + </object> + <packing> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="speedEntry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + <property name="primary_icon_activatable">False</property> + <property name="secondary_icon_activatable">False</property> + <property name="primary_icon_sensitive">True</property> + <property name="secondary_icon_sensitive">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + </packing> + </child> </object> </child> </object> 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; |