Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1180 | andrew_pro | 1 | /* |
2 | test libGUI library |
||
3 | */ |
||
4 | #include "stdarg.h" |
||
5 | #include "libGUI.h" |
||
6 | #include "stdlib.h" |
||
7 | #include "stdio.h" |
||
8 | |||
9 | void callback_func_delete_window(header_t *control,void *data) |
||
10 | { |
||
11 | QuitLibGUI((parent_t*)control); |
||
12 | } |
||
13 | |||
14 | int main(int argc, char *argv[]) |
||
15 | { |
||
16 | parent_t *window; |
||
17 | gui_image_data_t imdata; |
||
18 | gui_image_t *image; |
||
19 | int i,j; |
||
20 | unsigned int *img; |
||
21 | |||
22 | //load libGUI library |
||
23 | LoadLibGUI(NULL);//use default system path to library |
||
24 | //create main window |
||
25 | window=CreateWindow(); |
||
26 | //change window size |
||
27 | SetWindowSizeRequest(window,220,142); |
||
28 | //set callback function for close window button |
||
29 | SetCallbackFunction(window,DELETE_EVENT,&callback_func_delete_window,NULL); |
||
30 | //create image |
||
31 | imdata.x=5; |
||
32 | imdata.y=5; |
||
33 | imdata.width=200; |
||
34 | imdata.height=100; |
||
35 | imdata.bits_per_pixel=32;//bits per pixel |
||
36 | |||
37 | image=CreateImage(&imdata); |
||
38 | img=(unsigned int*)image->img; |
||
39 | //generate 32 bits image |
||
40 | for(i=0;i |
||
41 | { |
||
42 | for(j=0;j |
||
43 | { |
||
44 | *img=100*(i*i+j*j-i*3+2*j); |
||
45 | img++; |
||
46 | } |
||
47 | } |
||
48 | //pack image in window |
||
49 | PackControls(window,image); |
||
50 | //start main libGUI loop |
||
51 | LibGUImain(window); |
||
52 | } |