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_8bpp_rotated_ccw_binary_resources.h"
6 #include "all_widgets_8bpp_rotated_ccw_binary_specifications.h"
7
8 extern GX_WINDOW *pGaugeScreen;
9 static INT angle[6] = { -114, -90, 52, -27, 52, -114 };
10 static int angle_index = 0;
11
set_gauge_angle(GX_CIRCULAR_GAUGE * gauge)12 VOID set_gauge_angle(GX_CIRCULAR_GAUGE *gauge)
13 {
14 gx_circular_gauge_angle_set(gauge, angle[angle_index++]);
15 if (angle_index >= (int)(sizeof(angle) / sizeof(INT)))
16 {
17 angle_index = 0;
18 }
19 }
20
gauge_event_handle(GX_WINDOW * window,GX_EVENT * event_ptr)21 UINT gauge_event_handle(GX_WINDOW *window, GX_EVENT *event_ptr)
22 {
23 GX_CIRCULAR_GAUGE *gauge = &gauge_screen.gauge_screen_gauge_1;
24 INT tics;
25
26 switch (event_ptr->gx_event_type)
27 {
28 case GX_EVENT_SHOW:
29 gx_window_event_process(window, event_ptr);
30 set_gauge_angle(gauge);
31 break;
32
33 case GX_SIGNAL(ID_GAUGE, GX_EVENT_ANIMATION_COMPLETE):
34 set_gauge_angle(gauge);
35
36 tics = gauge->gx_circular_gauge_info.gx_circular_gauge_info_animation_delay;
37 gx_system_timer_start((GX_WIDGET *)gauge, GX_CIRCULAR_GAUGE_TIMER, tics, tics);
38 break;
39
40 default:
41 return next_button_handler(window, event_ptr);
42 }
43 return 0;
44 }