summaryrefslogtreecommitdiff
path: root/src/gui/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/window.c')
-rw-r--r--src/gui/window.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gui/window.c b/src/gui/window.c
index 6e287e5..32aeb26 100644
--- a/src/gui/window.c
+++ b/src/gui/window.c
@@ -3,6 +3,10 @@
3#include <gui/button.h> 3#include <gui/button.h>
4#include <gui/pictureframe.h> 4#include <gui/pictureframe.h>
5#include <gui/group.h> 5#include <gui/group.h>
6#include <MLV/MLV_keyboard.h>
7#include <MLV/MLV_all.h>
8#include <caca_conio.h>
9#include <painter/rasterizer.h>
6#include "common/mem.h" 10#include "common/mem.h"
7#include "string.h" 11#include "string.h"
8#include "assert.h" 12#include "assert.h"
@@ -57,4 +61,33 @@ void window_print_pictureframes(Window *window) {
57 assert(window != NULL); 61 assert(window != NULL);
58 window->group_pictureframe->component.print_method(&(window->group_pictureframe->component)); 62 window->group_pictureframe->component.print_method(&(window->group_pictureframe->component));
59 MLV_actualise_window(); 63 MLV_actualise_window();
64}
65
66void window_wait_keyboard_or_mouse(MLV_Keyboard_button *keyboardButton, MLV_Keyboard_modifier *keyboardModifier,
67 int *unicode, int *mouse_x, int *mouse_y) {
68 *mouse_x = -1;
69 *mouse_y = -1;
70 *keyboardButton = MLV_KEYBOARD_NONE;
71 MLV_wait_keyboard_or_mouse(keyboardButton, keyboardModifier, unicode, mouse_x, mouse_y);
72}
73
74void window_click_keyboard_handler(Window *window, MLV_Keyboard_button *keyboardButton,
75 MLV_Keyboard_modifier *keyboardModifier,
76 int *unicode, int *mouse_x, int *mouse_y) {
77 window_wait_keyboard_or_mouse(keyboardButton,keyboardModifier,unicode,mouse_x,mouse_y);
78 group_click_handler(*mouse_x, *mouse_y, &(window->group_buttons->component));
79 group_click_handler(*mouse_x, *mouse_y, &(window->group_pictureframe->component));
80}
81
82void window_rendering(Window *window,PictureFrame *pictureFrame1,Canvas *canvasSrc, Canvas *canvasTarget, Morphing *morphing){
83 int i;
84 window_print_pictureframes(window);
85 for (i = 1; i <= frame; ++i) {
86 pictureFrame1->canvas = rasterize(canvasSrc, canvasTarget, morphing, (TimeVector) (i / (float) frame));
87 pictureframe_draw_canvas(pictureFrame1);
88 MLV_actualise_window();
89 canvas_destroy(pictureFrame1->canvas);
90 }
91 mode = EXITING;
92 MLV_wait_seconds(15);
60} \ No newline at end of file 93} \ No newline at end of file