Skip to content

Instantly share code, notes, and snippets.

@i8degrees
Created January 7, 2015 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save i8degrees/7f2b52fef9496933d01a to your computer and use it in GitHub Desktop.
Save i8degrees/7f2b52fef9496933d01a to your computer and use it in GitHub Desktop.
callback hell
this->player.run_action(scroll_right, [=]() {
this->expected_queue_size(0);
EXPECT_EQ( Point2i(200,195), anim_text->position() );
this->expected_alpha_in_params( anim_fade_in.get(),
Color4i::ALPHA_OPAQUE, anim_fade_tex );
this->expected_action_params( scroll_right.get(),
IAnimationAction::AnimationType::GROUP, 2);
this->player.run_action(scroll_left, [=]() {
this->expected_queue_size(0);
EXPECT_EQ( Point2i(0,195), anim_text->position() );
EXPECT_EQ( Color4i::ALPHA_OPAQUE, anim_fade_tex->alpha() );
this->expected_reversed_params( scroll_left_inversed.get(),
2.5f, SPEED_MOD );
this->expected_action_params( scroll_left.get(),
IAnimationAction::AnimationType::SEQUENCE,
1 );
this->player.run_action(scroll_right_again, [=]() {
this->expected_queue_size(0);
EXPECT_EQ( Point2i(200,195), anim_text->position() );
EXPECT_EQ( Color4i::ALPHA_OPAQUE, anim_fade_tex->alpha() );
this->expected_action_params( scroll_right_again.get(),
IAnimationAction::AnimationType::GROUP, 1);
this->player.run_action(scroll_up, [=]() {
this->expected_queue_size(0);
EXPECT_EQ( Point2i(200,-105), anim_text->position() );
this->expected_alpha_out_params( anim_fade_out0.get(),
Color4i::ALPHA_TRANSPARENT,
anim_fade_tex );
this->expected_action_params( scroll_up.get(),
IAnimationAction::AnimationType::GROUP,
2 );
// Reset the initial alpha value for the next action to re-use
anim_fade_tex->set_alpha(Color4i::ALPHA_OPAQUE);
this->player.run_action(scroll_down_repeat2, [=]() {
this->expected_queue_size(0);
EXPECT_EQ( Point2i(200,300), anim_text->position() );
this->expected_alpha_out_params( anim_fade_out0.get(),
Color4i::ALPHA_TRANSPARENT,
anim_fade_tex );
this->expected_repeat_params(scroll_down_repeat2_translate.get(), 2);
this->expected_repeat_params(scroll_down_repeat2_fade_out.get(), 2);
this->expected_action_params( scroll_down_repeat2.get(),
IAnimationAction::AnimationType::GROUP,
2 );
this->player.run_action(fade_screen_out_action, [=]() {
this->expected_queue_size(0);
this->expected_alpha_out_params( fade_screen_out.get(),
Color4i::ALPHA_TRANSPARENT,
bg_tex );
this->expected_action_params( fade_screen_out_action.get(),
IAnimationAction::AnimationType::SEQUENCE,
1 );
this->quit();
});
});
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment