osu-ds/source/Graphics/pAnimation.cpp
KonPet 183228e28e Change stuff to make it build
Removed the arm7 section
Changed the makefile to only use the arm9 stuff
Epicpkmn: Fix source/Graphics/GraphicsManager.cpp

Co-Authored-By: Pk11 <epicpkmn11@outlook.com>
Co-Authored-By: Kaisaan <34224128+Kaisaan@users.noreply.github.com>
2021-10-21 00:03:39 +02:00

30 lines
689 B
C++

#include "pAnimation.h"
pAnimation::pAnimation(TextureType texture, u32 framecount, u32 fps, s32 x, s32 y, u32 width, u32 height, DrawOrigin origin, FieldType type, rgb color, u32 alpha)
: pSprite(texture, x, y, width, height, origin, type, color, alpha)
{
mFrameCount = framecount;
mFrameCurrent = 0;
mOrigTexture = texture;
mUpdatesPerFrame = 60.0 / fps;
mUpdatesWaited = 0;
}
void pAnimation::Update()
{
while (mUpdatesWaited >= mUpdatesPerFrame)
{
mUpdatesWaited -= mUpdatesPerFrame;
++mFrameCurrent;
if (mFrameCurrent >= mFrameCount)
mFrameCurrent = 0;
Texture = (TextureType)(mOrigTexture + mFrameCurrent);
}
++mUpdatesWaited;
pSprite::Update();
}