コード例 #1
0
int32 ResetSprite(void *systemData, void *userData)
{
    GameManager *mgr;

    if(systemData != NULL)
    {
        Sprite *spritePtr = (Sprite *)systemData;

        mgr = spritePtr->GetManager();
        mgr->RemoveGameObject(spritePtr);
        delete spritePtr;
    }
    else
    {
        mgr = (GameManager*)userData;
    }

    Sprite *tmp = new Sprite(mgr);
    tmp->SetImage(mgr->GetResourceManager()->GetImage(ARROW_HANDLE));
    tmp->SetBaseLocation(CIwVec2(mgr->GetSurfaceWidth() / 2, mgr->GetSurfaceHeight() / 2));
    tmp->AddTransformation(new AnchorTransformation());
    OrbitTransformation *orbiter = new OrbitTransformation(150, 5000, 0, Clockwise);
    tmp->AddTransformation(orbiter);
    mgr->RegisterGameObject(tmp);

    tmp->SetLifespan(++resetCount * 500);
    tmp->SetCompletionCallback(ResetSprite, NULL);

    return 0;
}
コード例 #2
0
void LabeledSprite(GameManager *mgr, uint32 marker_handle, uint32 width, uint32 height)
{
    Sprite *image = new Sprite(mgr);
    image->SetImage(mgr->GetResourceManager()->GetImage(ARROW_HANDLE));
    image->AddTransformation(new AnchorTransformation());
    image->SetBaseLocation(CIwVec2(mgr->GetSurfaceWidth() / 2, mgr->GetSurfaceHeight() / 2));
    OrbitTransformation *orbiter = new OrbitTransformation(150, 5000, 0, CounterClockwise);
    image->AddTransformation(orbiter);
    mgr->RegisterGameObject(image);

    TextSprite *text = new TextSprite(mgr, (char *)"Normal");
    text->AddTransformation(new AnchorTransformation());
    text->AddTransformation(new AnchorToTransformation(image, image, (float)(text->GetHeight() / 2 + image->GetHeight() / 2 + 10), 0, RelativeToNormal));
    text->AddTransformation(new OrientToTransformation((IDirectional*)image, OrientAlongOrientation));
    mgr->RegisterGameObject(text);
}