1 /* This is a small demo of the high-performance GUIX graphics framework. */
2
3 #include <stdio.h>
4 #include "gx_api.h"
5 #include "all_widgets_32argb_rotated_cw_resources.h"
6 #include "all_widgets_32argb_rotated_cw_specifications.h"
7
8 static INT angle[6] = { -114, -90, 52, -27, 52, -114 };
9 static int angle_index = 0;
10
set_gauge_angle(GX_CIRCULAR_GAUGE * gauge)11 VOID set_gauge_angle(GX_CIRCULAR_GAUGE *gauge)
12 {
13 gx_circular_gauge_angle_set(gauge, angle[angle_index++]);
14 if (angle_index >= (int)(sizeof(angle) / sizeof(INT)))
15 {
16 angle_index = 0;
17 }
18 }
19
gauge_event_handle(GX_WINDOW * window,GX_EVENT * event_ptr)20 UINT gauge_event_handle(GX_WINDOW *window, GX_EVENT *event_ptr)
21 {
22 GX_CIRCULAR_GAUGE *gauge = &gauge_screen.gauge_screen_gauge_1;
23 INT tics;
24
25 switch (event_ptr->gx_event_type)
26 {
27 case GX_EVENT_SHOW:
28 gx_window_event_process(window, event_ptr);
29 set_gauge_angle(gauge);
30 break;
31
32 case GX_SIGNAL(ID_GAUGE, GX_EVENT_ANIMATION_COMPLETE):
33 set_gauge_angle(gauge);
34
35 tics = gauge->gx_circular_gauge_info.gx_circular_gauge_info_animation_delay;
36 gx_system_timer_start((GX_WIDGET *)gauge, GX_CIRCULAR_GAUGE_TIMER, tics, tics);
37 break;
38
39 default:
40 return next_button_handler(window, event_ptr);
41 }
42 return 0;
43 }