diff options
-rw-r--r-- | test/gui/button.c | 32 | ||||
-rw-r--r-- | test/gui/group.c | 27 | ||||
-rw-r--r-- | test/gui/window.c | 4 |
3 files changed, 55 insertions, 8 deletions
diff --git a/test/gui/button.c b/test/gui/button.c index 58270ef..df3e04d 100644 --- a/test/gui/button.c +++ b/test/gui/button.c | |||
@@ -1,4 +1,30 @@ | |||
1 | // | 1 | #include <gui/group.h> |
2 | // Created by adam on 16/12/17. | 2 | #include <gui/window.h> |
3 | // | 3 | #include <gui/button.h> |
4 | #include <gui/component.h> | ||
5 | #include "MLV/MLV_all.h" | ||
4 | 6 | ||
7 | |||
8 | static void test_button() { | ||
9 | /* Window window; | ||
10 | window_init(&window, 1000, 512, "Coucou"); | ||
11 | window_create(&window); | ||
12 | Button button1; | ||
13 | button_init(&button1, "OK", 10, 500, 256, button_click_test); | ||
14 | button1.component.print_method(&button1); | ||
15 | int mouse_x; | ||
16 | int mouse_y; | ||
17 | while (1) { | ||
18 | if (MLV_get_mouse_button_state(MLV_BUTTON_LEFT) == MLV_PRESSED) { | ||
19 | MLV_get_mouse_position(&mouse_x, &mouse_y); | ||
20 | button1.component.click_handler(mouse_x, mouse_y, &(button1.component)); | ||
21 | } | ||
22 | }*/ | ||
23 | /*MLV_wait_seconds(10); | ||
24 | window_free(&window);*/ | ||
25 | } | ||
26 | |||
27 | int main() { | ||
28 | test_button(); | ||
29 | return 0; | ||
30 | } \ No newline at end of file | ||
diff --git a/test/gui/group.c b/test/gui/group.c index e3d25f3..555c246 100644 --- a/test/gui/group.c +++ b/test/gui/group.c | |||
@@ -7,9 +7,30 @@ static void test_group() { | |||
7 | Window window; | 7 | Window window; |
8 | window_init(&window, 1000, 512, "Coucou"); | 8 | window_init(&window, 1000, 512, "Coucou"); |
9 | window_create(&window); | 9 | window_create(&window); |
10 | window.group_buttons->component.print_method(window.group_pictureframe); | 10 | |
11 | MLV_wait_seconds(5); | 11 | Button button1; |
12 | window_free(&window); | 12 | Button button2; |
13 | Button button3; | ||
14 | |||
15 | button_init(&button1, "OK", 10, 500, 256, button_click_test); | ||
16 | button_init(&button2,"Bouton magique",10, 500,290, NULL); | ||
17 | button_init(&button3,"Très lonnggggg boooouttttooooon",10,0,0,button_click_test); | ||
18 | |||
19 | window_add_button(&window,&button1); | ||
20 | window_add_button(&window,&button2); | ||
21 | window_add_button(&window,&button3); | ||
22 | |||
23 | window_print_buttons(&window); | ||
24 | int mouse_x; | ||
25 | int mouse_y; | ||
26 | while(1){ | ||
27 | if (MLV_get_mouse_button_state(MLV_BUTTON_LEFT) == MLV_PRESSED) { | ||
28 | MLV_get_mouse_position(&mouse_x, &mouse_y); | ||
29 | group_click_handler(mouse_x,mouse_y,&(window.group_buttons->component)); | ||
30 | } | ||
31 | } | ||
32 | /*MLV_wait_seconds(15); | ||
33 | window_free(&window);*/ | ||
13 | } | 34 | } |
14 | 35 | ||
15 | int main() { | 36 | int main() { |
diff --git a/test/gui/window.c b/test/gui/window.c index e3b062a..b19300e 100644 --- a/test/gui/window.c +++ b/test/gui/window.c | |||
@@ -2,11 +2,11 @@ | |||
2 | #include "MLV/MLV_all.h" | 2 | #include "MLV/MLV_all.h" |
3 | 3 | ||
4 | static void test_window() { | 4 | static void test_window() { |
5 | Window window; | 5 | /*Window window; |
6 | window_init(&window, 1000, 512, "Coucou"); | 6 | window_init(&window, 1000, 512, "Coucou"); |
7 | window_create(&window); | 7 | window_create(&window); |
8 | MLV_wait_seconds(150); | 8 | MLV_wait_seconds(150); |
9 | window_free(&window); | 9 | window_free(&window);*/ |
10 | } | 10 | } |
11 | 11 | ||
12 | int main() { | 12 | int main() { |