コード例 #1
0
ファイル: roll-layout.cpp プロジェクト: Tarnyko/dal-toolkit
void RollLayout::GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const
{
  if(animation)
  {
    animation.Resize(actor, size);
  }
}
コード例 #2
0
int UtcDaliControlImplSizeAnimation(void)
{
  ToolkitTestApplication application;

  {
    DummyControl dummy = DummyControl::New( true );
    DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());

    Stage::GetCurrent().Add(dummy);

    DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, false, TEST_LOCATION );
    Animation animation = Animation::New(1.0f);
    animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f));
    animation.Play();

    application.Render();
    application.SendNotification();
    application.Render();
    application.SendNotification();

    DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, true, TEST_LOCATION );

    Stage::GetCurrent().Remove(dummy);
  }

  // Ensure full code coverage
  {
    DummyControl dummy = DummyControl::New();

    Stage::GetCurrent().Add(dummy);

    Animation animation = Animation::New(1.0f);
    animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f));
    animation.Play();

    application.Render();
    application.SendNotification();
    application.Render();
    application.SendNotification();

    Stage::GetCurrent().Remove(dummy);
  }
  END_TEST;
}
コード例 #3
0
ファイル: puyo.cpp プロジェクト: jonghyunho/puyo
  // The Init signal is received once (only) during the Application lifetime
  void Create( Application& application )
  {
    //std::cout << "HelloWorldController::Create" << std::endl;

    // Get a handle to the stage
    Stage stage = Stage::GetCurrent();

    //ImageActor bgActor = ImageActor::New(CreateBitmapImage(480, 800));
    Control  bgActor = Control::New();
    bgActor.SetSize(64 * STAGE_COL, 64 * STAGE_ROW);
    //bgActor.SetBackgroundColor(Vector4(.125f, .125f, .125f, 1.f));
    bgActor.SetBackgroundColor(Vector4(1.f, 1.f, 1.f, 1.f));
    bgActor.SetParentOrigin(ParentOrigin::CENTER);
    bgActor.SetAnchorPoint(AnchorPoint::CENTER);
    bgActor.SetZ(0.1f);
    //stage.Add(bgActor);

    ResourceImage spriteImage = ResourceImage::New(PUYO_IMAGE);

    // background
    {
      ResourceImage image = ResourceImage::New(BACKGROUND_IMAGE);
      ImageActor actor = ImageActor::New(image);
      actor.SetParentOrigin(ParentOrigin::BOTTOM_LEFT);
      actor.SetAnchorPoint(AnchorPoint::BOTTOM_LEFT);
      stage.Add(actor);
    }

    // sprites
    {
      ImageActor actor[STAGE_COL * STAGE_ROW];

      for (int i = 0; i < STAGE_ROW; i++)
      {
        for (int j = 0; j < STAGE_COL; j++)
        {
          actor[i * STAGE_COL + j] = ImageActor::New(spriteImage, PUYO_OFFSET[int(Random::Range(0.f, NUM_PUYO))]);
          actor[i * STAGE_COL + j].SetParentOrigin(ParentOrigin::BOTTOM_LEFT);
          actor[i * STAGE_COL + j].SetAnchorPoint(AnchorPoint::BOTTOM_LEFT);
          actor[i * STAGE_COL + j].SetX(i * 60.f);
          actor[i * STAGE_COL + j].SetY(j * -1.f * 60.f);
          actor[i * STAGE_COL + j].SetZ(0.1f);
          stage.Add(actor[i * STAGE_COL + j]);
        }
      }

#if 0
      Animation anim = Animation::New(1.f);

      for (int i = 0; i < STAGE_ROW; i++)
      {
        for (int j = 0; j < STAGE_COL; j++)
        {
          anim.MoveBy(actor[i * STAGE_COL + j], Vector3(0.f, j * _(7), 0.1f), AlphaFunctions::Bounce);
          anim.Resize(actor[i * STAGE_COL + j], _(32), _(25), AlphaFunctions::Bounce);
          anim.SetLooping(true);
        }
      }
      anim.Play();
#endif
    }

    {
      ImageActor actor = ImageActor::New(spriteImage, ImageActor::PixelArea(0, 224, 64, 64));
      actor.SetParentOrigin(ParentOrigin::CENTER);
      actor.SetAnchorPoint(AnchorPoint::CENTER);
      actor.SetSize(_(32), _(32));
      actor.SetZ(0.1f);
      //stage.Add(actor);
    }

    // Respond to a click anywhere on the stage
    stage.GetRootLayer().TouchedSignal().Connect( this, &HelloWorldController::OnTouch );
  }