summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam NAILI2018-01-09 15:45:25 +0100
committerAdam NAILI2018-01-09 15:45:25 +0100
commit461164dd4adefc0036d1e244fbd0e5e805bbef9d (patch)
tree8777a7bb5738a85374e1696126ecf2654a94da99
parent803524799631bcc96ee1fa7e194516fb23d8d9b3 (diff)
downloadmorpher-461164dd4adefc0036d1e244fbd0e5e805bbef9d.tar.gz
Changing the end of the program to let the user retry his morphing
-rw-r--r--include/gui/window.h2
-rw-r--r--src/gui/gui.c2
-rw-r--r--src/gui/window.c15
3 files changed, 11 insertions, 8 deletions
diff --git a/include/gui/window.h b/include/gui/window.h
index c3da3e4..5ada8cd 100644
--- a/include/gui/window.h
+++ b/include/gui/window.h
@@ -119,7 +119,7 @@ void window_click_keyboard_handler(Window *window, MLV_Keyboard_button *keyboard
119 * *canvasTarget - pointer to the target Canvas 119 * *canvasTarget - pointer to the target Canvas
120 * *morphing - pointer to the Morphing that will makes the transformation 120 * *morphing - pointer to the Morphing that will makes the transformation
121 */ 121 */
122void window_rendering(Window *window, PictureFrame *pictureFrame1, Canvas *canvasSrc, Canvas *canvasTarget, 122void window_rendering(Window *window, PictureFrame pictureFrame1, Canvas *canvasSrc, Canvas *canvasTarget,
123 Morphing *morphing); 123 Morphing *morphing);
124 124
125#endif 125#endif
diff --git a/src/gui/gui.c b/src/gui/gui.c
index bf73bdb..16e9a19 100644
--- a/src/gui/gui.c
+++ b/src/gui/gui.c
@@ -104,7 +104,7 @@ void gui_handle_event(GUI *gui) {
104 mode = WAITING_BUTTON_SHOW; 104 mode = WAITING_BUTTON_SHOW;
105 break; 105 break;
106 case RENDERING: 106 case RENDERING:
107 window_rendering(gui->window, gui->pictureFrame1, gui->canvasSrc, gui->canvasTrg, gui->morphing); 107 window_rendering(gui->window, *(gui->pictureFrame1), gui->canvasSrc, gui->canvasTrg, gui->morphing);
108 break; 108 break;
109 case INSERT_TARGET: 109 case INSERT_TARGET:
110 if (keyboardButton == MLV_KEYBOARD_ESCAPE) { 110 if (keyboardButton == MLV_KEYBOARD_ESCAPE) {
diff --git a/src/gui/window.c b/src/gui/window.c
index e4eacea..a0c97a8 100644
--- a/src/gui/window.c
+++ b/src/gui/window.c
@@ -1,6 +1,7 @@
1#include "gui/window.h" 1#include "gui/window.h"
2#include <assert.h> 2#include <assert.h>
3#include <MLV/MLV_all.h> 3#include <MLV/MLV_all.h>
4#include <gui/pictureframe.h>
4#include "painter/rasterizer.h" 5#include "painter/rasterizer.h"
5#include "common/mem.h" 6#include "common/mem.h"
6 7
@@ -69,16 +70,18 @@ void window_click_keyboard_handler(Window *window, MLV_Keyboard_button *keyboard
69 group_click_handler(*mouse_x, *mouse_y, &(window->group_pictureframe->component)); 70 group_click_handler(*mouse_x, *mouse_y, &(window->group_pictureframe->component));
70} 71}
71 72
72void window_rendering(Window *window, PictureFrame *pictureFrame1, Canvas *canvasSrc, Canvas *canvasTarget, 73void window_rendering(Window *window, PictureFrame pictureFrame1, Canvas *canvasSrc, Canvas *canvasTarget,
73 Morphing *morphing) { 74 Morphing *morphing) {
74 int i; 75 int i;
75 window_print_pictureframes(window); 76 window_print_pictureframes(window);
76 for (i = 1; i <= frame; ++i) { 77 for (i = 1; i <= frame; ++i) {
77 pictureFrame1->canvas = rasterize(canvasSrc, canvasTarget, morphing, (TimeVector) (i / (float) frame)); 78 pictureFrame1.canvas = rasterize(canvasSrc, canvasTarget, morphing, (TimeVector) (i / (float) frame));
78 pictureframe_draw_canvas(pictureFrame1); 79 pictureframe_draw_canvas(&pictureFrame1);
79 MLV_actualise_window(); 80 MLV_actualise_window();
80 canvas_destroy(pictureFrame1->canvas); 81 canvas_destroy(pictureFrame1.canvas);
82 MLV_wait_milliseconds(16);
81 } 83 }
82 mode = EXITING; 84 mode = WAITING_BUTTON_SHOW;
83 MLV_wait_seconds(15); 85 window_print_pictureframes(window);
86 MLV_actualise_window();
84} 87}