diff options
author | Adam NAILI | 2017-12-28 22:52:28 +0100 |
---|---|---|
committer | Adam NAILI | 2017-12-28 22:52:28 +0100 |
commit | 9ed3c28a0335137d34e51d5fd49be6e523f65a89 (patch) | |
tree | 1abc903ff235f921eecadcbb68fe7a37449274e0 /test/gui | |
parent | 9e4eb30f33867bcb37d5accfb5588cfb3b450f90 (diff) | |
download | morpher-9ed3c28a0335137d34e51d5fd49be6e523f65a89.tar.gz |
Implementing the add constraint feature, need to be fixed
Diffstat (limited to 'test/gui')
-rw-r--r-- | test/gui/group.c | 2 | ||||
-rw-r--r-- | test/gui/pictureframe.c | 35 |
2 files changed, 26 insertions, 11 deletions
diff --git a/test/gui/group.c b/test/gui/group.c index 5ec9194..7dbf80c 100644 --- a/test/gui/group.c +++ b/test/gui/group.c | |||
@@ -29,7 +29,7 @@ static void test_group() { | |||
29 | group_click_handler(mouse_x,mouse_y,&(window.group_buttons->component)); | 29 | group_click_handler(mouse_x,mouse_y,&(window.group_buttons->component)); |
30 | } | 30 | } |
31 | } | 31 | } |
32 | /*MLV_wait_seconds(15); | 32 | MLV_wait_seconds(15); |
33 | window_free(&window);*/ | 33 | window_free(&window);*/ |
34 | } | 34 | } |
35 | 35 | ||
diff --git a/test/gui/pictureframe.c b/test/gui/pictureframe.c index a47eaa0..07e1236 100644 --- a/test/gui/pictureframe.c +++ b/test/gui/pictureframe.c | |||
@@ -1,33 +1,48 @@ | |||
1 | #include "gui/component.h" | ||
1 | #include <gui/group.h> | 2 | #include <gui/group.h> |
2 | #include <gui/window.h> | 3 | #include <gui/window.h> |
3 | #include "MLV/MLV_all.h" | 4 | #include "MLV/MLV_all.h" |
4 | 5 | ||
6 | extern Mode mode; | ||
5 | 7 | ||
6 | static void test_pictureframe() { | 8 | static void test_pictureframe() { |
7 | Window window; | 9 | Window window; |
8 | window_init(&window, 1000, 512, "Coucou"); | 10 | window_init(&window, 1005, 512, "Coucou"); |
9 | window_create(&window); | 11 | window_create(&window); |
10 | 12 | ||
13 | Button button1; | ||
14 | |||
11 | PictureFrame pictureFrame1; | 15 | PictureFrame pictureFrame1; |
12 | PictureFrame pictureFrame2; | 16 | PictureFrame pictureFrame2; |
13 | 17 | ||
14 | Morphing *morphing = morphing_create(500,250); | 18 | Morphing *morphing = morphing_create(500, 250); |
15 | Canvas canvas; | 19 | Canvas *canvas1 = canvas_create_from_image("/home/adam/Images/goku.png"); |
16 | canvas_init(&canvas,500,250); | 20 | Canvas *canvas2 = canvas_create_from_image("/home/adam/Images/marty.jpg"); |
21 | |||
22 | button_init(&button1, "Add constraint point", 10, 0, 0, button_click_add_constraint); | ||
17 | 23 | ||
18 | pictureframe_init(&pictureFrame1,500,250,0,0,pictureframe_origin_split,morphing,&canvas); | 24 | pictureframe_init(&pictureFrame1, 500, 250, 0, 0, pictureframe_origin_split, morphing, canvas1, |
19 | pictureframe_init(&pictureFrame2,500,250,0,0,pictureframe_target_split,morphing,&canvas); | 25 | pictureframe_click_handler_origin); |
26 | pictureframe_init(&pictureFrame2, 500, 250, 0, 0, pictureframe_target_split, morphing, canvas2, | ||
27 | pictureframe_click_handler_target); | ||
20 | 28 | ||
21 | window_add_pictureframe(&window,&pictureFrame1); | 29 | window_add_pictureframe(&window, &pictureFrame1); |
22 | window_add_pictureframe(&window,&pictureFrame2); | 30 | window_add_pictureframe(&window, &pictureFrame2); |
23 | 31 | ||
32 | window_add_button(&window, &button1); | ||
33 | window_print_buttons(&window); | ||
24 | window_print_pictureframes(&window); | 34 | window_print_pictureframes(&window); |
25 | int mouse_x; | 35 | int mouse_x; |
26 | int mouse_y; | 36 | int mouse_y; |
27 | while(1){ | 37 | while (1) { |
28 | if (MLV_get_mouse_button_state(MLV_BUTTON_LEFT) == MLV_PRESSED) { | 38 | if (MLV_get_mouse_button_state(MLV_BUTTON_LEFT) == MLV_PRESSED) { |
29 | MLV_get_mouse_position(&mouse_x, &mouse_y); | 39 | MLV_get_mouse_position(&mouse_x, &mouse_y); |
30 | group_click_handler(mouse_x,mouse_y,&(window.group_pictureframe->component)); | 40 | group_click_handler(mouse_x, mouse_y, &(window.group_buttons->component)); |
41 | group_click_handler(mouse_x, mouse_y, &(window.group_pictureframe->component)); | ||
42 | if(mode == PRINTING){ | ||
43 | window_print_pictureframes(&window); | ||
44 | mode = WAITING_BUTTON; | ||
45 | } | ||
31 | } | 46 | } |
32 | } | 47 | } |
33 | /*MLV_wait_seconds(15); | 48 | /*MLV_wait_seconds(15); |