1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 10 /**************************************************************************/ 11 12 13 /**************************************************************************/ 14 /**************************************************************************/ 15 /** */ 16 /** GUIX Component */ 17 /** */ 18 /** Sprite Management (Sprite) */ 19 /** */ 20 /**************************************************************************/ 21 22 #define GX_SOURCE_CODE 23 24 25 /* Include necessary system files. */ 26 27 #include "gx_api.h" 28 #include "gx_system.h" 29 #include "gx_widget.h" 30 #include "gx_sprite.h" 31 32 /**************************************************************************/ 33 /* */ 34 /* FUNCTION RELEASE */ 35 /* */ 36 /* _gx_sprite_event_process PORTABLE C */ 37 /* 6.1 */ 38 /* AUTHOR */ 39 /* */ 40 /* Kenneth Maxwell, Microsoft Corporation */ 41 /* */ 42 /* DESCRIPTION */ 43 /* */ 44 /* This function processes events for the sprite widget. */ 45 /* */ 46 /* INPUT */ 47 /* */ 48 /* sprite Pointer to sprite control */ 49 /* block */ 50 /* event_ptr Pointer to event to process */ 51 /* */ 52 /* OUTPUT */ 53 /* */ 54 /* status Completion status */ 55 /* */ 56 /* CALLS */ 57 /* */ 58 /* _gx_widget_event_process Call widget event processing */ 59 /* _gx_sprite_start Start the sprite widget */ 60 /* _gx_sprite_update Update the sprite widget */ 61 /* */ 62 /* CALLED BY */ 63 /* */ 64 /* GUIX Internal Code */ 65 /* */ 66 /* RELEASE HISTORY */ 67 /* */ 68 /* DATE NAME DESCRIPTION */ 69 /* */ 70 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ 71 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ 72 /* resulting in version 6.1 */ 73 /* */ 74 /**************************************************************************/ _gx_sprite_event_process(GX_SPRITE * sprite,GX_EVENT * event_ptr)75UINT _gx_sprite_event_process(GX_SPRITE *sprite, GX_EVENT *event_ptr) 76 { 77 /* GX_EVENT newevent; */ 78 GX_WIDGET *widget = (GX_WIDGET *)sprite; 79 80 /* Default status to success. */ 81 UINT status = GX_SUCCESS; 82 83 /* Process relative to the type of event. */ 84 switch (event_ptr -> gx_event_type) 85 { 86 case GX_EVENT_SHOW: 87 status = _gx_widget_event_process(widget, event_ptr); 88 89 if (sprite -> gx_widget_style & GX_STYLE_SPRITE_AUTO) 90 { 91 _gx_sprite_start(sprite, sprite -> gx_sprite_current_frame); 92 } 93 break; 94 95 case GX_EVENT_TIMER: 96 if (event_ptr -> gx_event_payload.gx_event_timer_id == GX_SPRITE_TIMER) 97 { 98 _gx_sprite_update(sprite); 99 } 100 else 101 { 102 status = _gx_widget_event_process(widget, event_ptr); 103 } 104 break; 105 106 default: 107 /* Call the widget default processing. */ 108 status = _gx_widget_event_process(widget, event_ptr); 109 } 110 111 /* Return completion status. */ 112 return(status); 113 } 114 115