Skip to content

Commit

Permalink
allow config the step of the transform
Browse files Browse the repository at this point in the history
  • Loading branch information
GorgonMeducer committed Sep 5, 2024
1 parent 007eea8 commit 8b763d0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
15 changes: 13 additions & 2 deletions examples/common/controls/spin_zoom_widget.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,26 @@ ARM_NONNULL(1)
void spin_zoom_widget_on_load( spin_zoom_widget_t *ptThis)
{
assert(NULL != ptThis);

float fAngleStep = 0.05f;
float fScaleStep = 0.01f;

if (this.tCFG.Indicator.Step.fAngle > 0.0f) {
fAngleStep = this.tCFG.Indicator.Step.fAngle;
}

if (this.tCFG.Indicator.Step.fScale > 0.0f) {
fScaleStep = this.tCFG.Indicator.Step.fScale;
}

if (NULL != this.tCFG.ptScene) {
/* initialize transform helper */
arm_2d_helper_dirty_region_transform_init(
&this.tHelper,
&this.tCFG.ptScene->tDirtyRegionHelper,
(arm_2d_op_t *)&this.OPCODE,
0.05f,
0.01f);
fAngleStep,
fScaleStep);
}
}

Expand Down
5 changes: 5 additions & 0 deletions examples/common/controls/spin_zoom_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ typedef struct spin_zoom_widget_cfg_t {
float fAngleInDegree;
int32_t nValue;
} UpperLimit;

struct {
float fAngle;
float fScale;
} Step;
} Indicator;

//arm_2d_helper_pi_slider_cfg_t tPISliderCFG;
Expand Down
10 changes: 7 additions & 3 deletions examples/common/scenes/watch/arm_2d_scene_watch.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,6 @@ static void __on_scene_watch_frame_start(arm_2d_scene_t *ptScene)
/* calculate the Ten-Miliseconds */
do {
this.chMs = lTimeStampInMs;


} while(0);

}
Expand All @@ -230,7 +228,7 @@ static void __on_scene_watch_frame_complete(arm_2d_scene_t *ptScene)

/* switch to next scene after 3s */
if (arm_2d_helper_is_time_out(10000, &this.lTimestamp[0])) {
arm_2d_scene_player_switch_to_next_scene(ptScene->ptPlayer);
//arm_2d_scene_player_switch_to_next_scene(ptScene->ptPlayer);
}
}

Expand Down Expand Up @@ -388,6 +386,9 @@ user_scene_watch_t *__arm_2d_scene_watch_init( arm_2d_scene_player_t *ptDispAd
.fAngleInDegree = 360.0f,
.nValue = 60*1000ul,
},
.Step = {
.fAngle = 0.0f, //! 0.0f means very smooth, 1.0f looks like mech watch, 6.0f looks like wall clock
},
},
.ptTransformMode = &SPIN_ZOOM_MODE_FILL_COLOUR,
.Source = {
Expand Down Expand Up @@ -415,6 +416,9 @@ user_scene_watch_t *__arm_2d_scene_watch_init( arm_2d_scene_player_t *ptDispAd
.fAngleInDegree = 360.0f,
.nValue = 3600,
},
.Step = {
.fAngle = 1.0f,
},
},
.ptTransformMode = &SPIN_ZOOM_MODE_FILL_COLOUR,
.Source = {
Expand Down

0 comments on commit 8b763d0

Please sign in to comment.