Skip to content

Commit

Permalink
handle evtBeforeDeposing event
Browse files Browse the repository at this point in the history
  • Loading branch information
GorgonMeducer committed Nov 12, 2024
1 parent c6bb586 commit a8bd03a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
17 changes: 17 additions & 0 deletions Helper/Include/arm_2d_helper_scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,23 @@ extern "C" {
(NULL,##__VA_ARGS__))


/*!
* \brief register / update the evtBeforeDeposing event handler.
*
* \param[in] ptThis the target scene player
* \param[in] fnHandler the event handler
* \param[in] ... optional, the address of an user specified object.
* \return arm_2d_err_t the operation result
*/
#define arm_2d_scene_player_register_before_deposing_event_handler( \
__SCENE_PLAYER_PTR, \
__HANDLER, \
...) \
__arm_2d_scene_player_register_before_deposing_event_handler( \
(__SCENE_PLAYER_PTR), \
(__HANDLER), \
(NULL,##__VA_ARGS__))

/*============================ TYPES =========================================*/

/*!
Expand Down
13 changes: 10 additions & 3 deletions Helper/Source/arm_2d_helper_scene.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,16 @@ static void __arm_2d_scene_player_next_scene(arm_2d_scene_player_t *ptThis)
}

arm_2d_helper_dirty_region_depose(&ptScene->tDirtyRegionHelper);
if (NULL != ptScene->fnDepose) {
ptScene->fnDepose(ptScene);
}

ARM_2D_INVOKE_RT_VOID(this.Events.evtBeforeDeposing.fnHandler,
ARM_2D_PARAM(
this.Events.evtBeforeDeposing.pTarget,
ptThis,
ptScene
));

ARM_2D_INVOKE_RT_VOID(ptScene->fnDepose, ARM_2D_PARAM(ptScene));

} while(false);
}

Expand Down

0 comments on commit a8bd03a

Please sign in to comment.