mercredi 18 août 2021

How can i parse values from one to another function

Soo I want to parse values from one to another function but I don't know how can I parse this values because I want to get maxFrames always calculated with this Texture2D& Sprite.

animator.cpp

void Animator::GetSprite(Texture2D& Sprite)
{
    float frameHeight = (float) (Sprite.height / 6);
    int maxFrames = (int)(Sprite.height / (int) frameHeight);
    float timer = 0.0f;
    int frame = 0;
}

void Animator::RenderSprite(Texture2D& Sprite)
{
    timer += GetFrameTime();

    if(timer >= 0.2f)
    {
        timer = 0.0f;
        frame += 1;
    }

    frame = frame % maxFrames;
}

animator.h

void GetSprite(Texture2D& Sprite);


void RenderSprite(Texture2D& Sprite);

Aucun commentaire:

Enregistrer un commentaire