aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/conversion.h16
-rw-r--r--src/defs.h28
-rw-r--r--src/mandelbrot-zoom.c107
-rw-r--r--src/mandelbrot-zoom.h56
-rw-r--r--src/settings.h13
5 files changed, 220 insertions, 0 deletions
diff --git a/src/conversion.h b/src/conversion.h
new file mode 100644
index 0000000..b5b0fb5
--- /dev/null
+++ b/src/conversion.h
@@ -0,0 +1,16 @@
+/*
+ * conversion.h
+ *
+ * Created on: 13.01.2018
+ * Author: Superleo1810
+ *
+ * This file contains conversion macros from gtk to corresponding std-c datatypes
+ */
+
+#ifndef CONVERSION_H_
+#define CONVERSION_H_
+
+// (gchar *) to (char *)
+#define CHAR_PTR(x) (x)
+
+#endif /* CONVERSION_H_ */
diff --git a/src/defs.h b/src/defs.h
new file mode 100644
index 0000000..66bffb4
--- /dev/null
+++ b/src/defs.h
@@ -0,0 +1,28 @@
+/*
+ * defs.h
+ *
+ * Created on: 13.01.2018
+ * Author: Superleo1810
+ */
+
+#ifndef DEFS_H_
+#define DEFS_H_
+
+#define TRUE 1
+#define FALSE 0
+
+typedef unsigned char u8;
+typedef signed char s8;
+
+typedef unsigned short int u16;
+typedef signed short int s16;
+
+typedef unsigned long int u32;
+typedef signed long int s32;
+
+typedef unsigned long long u64;
+typedef signed long long s64;
+
+typedef u8 bool;
+
+#endif /* DEFS_H_ */
diff --git a/src/mandelbrot-zoom.c b/src/mandelbrot-zoom.c
new file mode 100644
index 0000000..4f23696
--- /dev/null
+++ b/src/mandelbrot-zoom.c
@@ -0,0 +1,107 @@
+/*
+ * mandelbrot-zoom.c
+ *
+ * Created on: 13.01.2018
+ * Author: Superleo1810
+ */
+
+#include "mandelbrot-zoom.h"
+
+int main(int argc, char **argv)
+{
+ GtkBuilder *builder;
+ gtk_init(&argc, &argv);
+ builder = gtk_builder_new();
+ gtk_builder_add_from_file (builder, "C:/Users/Superleo1810/eclipse-workspace/mandelbrot-zoom/glade/settings.glade", NULL); // gtk = zu behindert für relative pfade
+
+ ui.settings = GTK_WIDGET(gtk_builder_get_object(builder, "settings"));
+ //gtk_builder_connect_signals(builder, NULL);
+ ui.exportCb = GTK_WIDGET(gtk_builder_get_object(builder, "exportCb"));
+ ui.gifRd = GTK_WIDGET(gtk_builder_get_object(builder, "gifRd"));
+ ui.widthSp = GTK_WIDGET(gtk_builder_get_object(builder, "widthSp"));
+ ui.heightSp = GTK_WIDGET(gtk_builder_get_object(builder, "heightSp"));
+ ui.fpsRenderSp = GTK_WIDGET(gtk_builder_get_object(builder, "fpsRenderSp"));
+ ui.fpsVideoSp = GTK_WIDGET(gtk_builder_get_object(builder, "fpsVideoSp"));
+ ui.bitrateSp = GTK_WIDGET(gtk_builder_get_object(builder, "bitrateSp"));
+ ui.exportTf = GTK_WIDGET(gtk_builder_get_object(builder, "exportTf"));
+ ui.startBtn = GTK_WIDGET(gtk_builder_get_object(builder, "startBtn"));
+ ui.exitBtn = GTK_WIDGET(gtk_builder_get_object(builder, "exitBtn"));
+
+ gtk_spin_button_set_increments((GtkSpinButton *)ui.widthSp, 1, 2);
+ gtk_spin_button_set_increments((GtkSpinButton *)ui.heightSp, 1, 2);
+ gtk_spin_button_set_increments((GtkSpinButton *)ui.fpsRenderSp, 1, 2);
+ gtk_spin_button_set_increments((GtkSpinButton *)ui.fpsVideoSp, 1, 2);
+ gtk_spin_button_set_increments((GtkSpinButton *)ui.bitrateSp, 1, 2);
+
+ gtk_spin_button_set_value((GtkSpinButton *)ui.widthSp, 1920);
+ gtk_spin_button_set_value((GtkSpinButton *)ui.heightSp, 1080);
+ gtk_spin_button_set_value((GtkSpinButton *)ui.fpsRenderSp, 30);
+ gtk_spin_button_set_value((GtkSpinButton *)ui.fpsVideoSp, 30);
+ gtk_spin_button_set_value((GtkSpinButton *)ui.bitrateSp, 1000);
+
+ gtk_spin_button_set_range((GtkSpinButton *)ui.widthSp, 1, 1920);
+ gtk_spin_button_set_range((GtkSpinButton *)ui.heightSp, 1, 1080);
+ gtk_spin_button_set_range((GtkSpinButton *)ui.fpsRenderSp, 1, 60);
+ gtk_spin_button_set_range((GtkSpinButton *)ui.fpsVideoSp, 1, 60);
+ gtk_spin_button_set_range((GtkSpinButton *)ui.bitrateSp, 1, 65535);
+
+ g_signal_connect(ui.exportCb, "toggled", G_CALLBACK(on_exportCb_toggled), NULL);
+ g_signal_connect(ui.widthSp, "value-changed", G_CALLBACK(on_widthSp_valueChanged), NULL);
+ g_signal_connect(ui.heightSp, "value-changed", G_CALLBACK(on_heightSp_valueChanged), NULL);
+ g_signal_connect(ui.fpsRenderSp, "value-changed", G_CALLBACK(on_fpsRenderSp_valueChanged), NULL);
+ g_signal_connect(ui.fpsVideoSp, "value-changed", G_CALLBACK(on_fpsVideoSp_valueChanged), NULL);
+ g_signal_connect(ui.bitrateSp, "value-changed", G_CALLBACK(on_bitrateSp_valueChanged), NULL);
+ g_signal_connect(ui.exportTf, "changed", G_CALLBACK(on_exportTf_changed), NULL);
+ g_signal_connect(ui.startBtn, "clicked", G_CALLBACK(on_startBtn_clicked), NULL);
+ g_signal_connect(ui.exitBtn, "clicked", G_CALLBACK(on_exitBtn_clicked), NULL);
+
+ g_object_unref(builder);
+ gtk_widget_show(ui.settings);
+ gtk_main();
+ return 0;
+}
+
+void on_exportCb_toggled()
+{
+ config.video = gtk_toggle_button_get_active((GtkToggleButton *)ui.exportCb);
+}
+
+void on_exportTf_changed()
+{
+ config.path = CHAR_PTR(gtk_entry_get_text((GtkEntry *)ui.exportTf));
+}
+
+void on_widthSp_valueChanged()
+{
+ config.width = gtk_spin_button_get_value((GtkSpinButton *)ui.widthSp);
+}
+
+void on_heightSp_valueChanged()
+{
+ config.height = gtk_spin_button_get_value((GtkSpinButton *)ui.heightSp);
+}
+
+void on_fpsRenderSp_valueChanged()
+{
+ config.renderFPS = gtk_spin_button_get_value((GtkSpinButton *)ui.fpsRenderSp);
+}
+
+void on_fpsVideoSp_valueChanged()
+{
+ config.videoFPS = gtk_spin_button_get_value((GtkSpinButton *)ui.fpsVideoSp);
+}
+
+void on_bitrateSp_valueChanged()
+{
+ config.bitrate = gtk_spin_button_get_value((GtkSpinButton *)ui.bitrateSp);
+}
+
+void on_startBtn_clicked()
+{
+ printf("config {\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.video, 0, config.width, config.height, config.renderFPS, config.videoFPS, config.bitrate, config.path);
+}
+
+void on_exitBtn_clicked()
+{
+ gtk_main_quit();
+}
diff --git a/src/mandelbrot-zoom.h b/src/mandelbrot-zoom.h
new file mode 100644
index 0000000..9f1b454
--- /dev/null
+++ b/src/mandelbrot-zoom.h
@@ -0,0 +1,56 @@
+/*
+ * mandelbrot-zoom.h
+ *
+ * Created on: 13.01.2018
+ * Author: Superleo1810
+ */
+
+#ifndef MANDELBROT_ZOOM_H_
+#define MANDELBROT_ZOOM_H_
+
+#include <gtk/gtk.h>
+#include "defs.h"
+#include "settings.h"
+#include "conversion.h"
+
+typedef struct config {
+ bool video;
+ u8 filetype;
+ u16 width;
+ u16 height;
+ u8 renderFPS;
+ u8 videoFPS;
+ u32 bitrate;
+ const char *path;
+ // TODO: key mapping als option in die struct
+} Config;
+
+typedef struct ui_settings {
+ GtkWidget *settings;
+ GtkWidget *exportCb;
+ GtkWidget *gifRd;
+ GtkWidget *widthSp;
+ GtkWidget *heightSp;
+ GtkWidget *fpsRenderSp;
+ GtkWidget *fpsVideoSp;
+ GtkWidget *bitrateSp;
+ GtkWidget *exportTf;
+ GtkWidget *startBtn;
+ GtkWidget *exitBtn;
+} ui_settings;
+
+ui_settings ui;
+Config config;
+
+int main(int argc, char **argv);
+void on_exportCb_toggled();
+void on_exportTf_changed();
+void on_widthSp_valueChanged();
+void on_heightSp_valueChanged();
+void on_fpsRenderSp_valueChanged();
+void on_fpsVideoSp_valueChanged();
+void on_bitrateSp_valueChanged();
+void on_startBtn_clicked();
+void on_exitBtn_clicked();
+
+#endif /* MANDELBROT_ZOOM_H_ */
diff --git a/src/settings.h b/src/settings.h
new file mode 100644
index 0000000..e8c99f4
--- /dev/null
+++ b/src/settings.h
@@ -0,0 +1,13 @@
+/*
+ * settings.h
+ *
+ * Created on: 13.01.2018
+ * Author: Superleo1810
+ */
+
+#ifndef SETTINGS_H_
+#define SETTINGS_H_
+
+#define FILETYPE_GIF 1;
+
+#endif /* SETTINGS_H_ */