本文整理汇总了C++中Animation::Update方法的典型用法代码示例。如果您正苦于以下问题:C++ Animation::Update方法的具体用法?C++ Animation::Update怎么用?C++ Animation::Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Animation
的用法示例。
在下文中一共展示了Animation::Update方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void AnimationController::Update()
{
PROFILE_SCOPED();
const Uint32 now = SDL_GetTicks();
for (auto i = m_animations.begin(); i != m_animations.end();) {
Animation *animation = (*i).first.Get();
Uint32 start = (*i).second;
float remaining = 0.0f;
if (!animation->IsCompleted())
remaining = animation->Update(float(now - start) / 1000.f);
if (animation->IsCompleted()) {
Animation *nextAnimation = animation->GetNext();
if (nextAnimation) {
assert(!animation->IsRunning());
m_animations.push_back(std::make_pair(RefCountedPtr<Animation>(nextAnimation), now - Uint32(-remaining * 1000.0f)));
nextAnimation->Running();
}
m_animations.erase(i++);
} else
++i;
}
}
示例2: Update
void Entity::Update(float dt)
{
Animation *animation = mAnimations[mCurrAnimation];
animation->Update(dt);
}
示例3: VUpdate
void GameObject::VUpdate(float dt)
{
if(HasAnimations()) {
Animation* animation = m_animations[m_currentAnimation];
animation->Update(dt);
}
}
示例4: Update
void TileMap::Update()
{
if( tileAnimations.size() > 0 )
{
for( std::vector<Animation*>::const_iterator i = tileAnimations.begin(); i != tileAnimations.end(); i++ )
{
Animation* a = (Animation*)(*i);
a->Update();
}
}
}
示例5: Update
void Application::Update(float deltaTime) {
try {
//Check for lost device
HRESULT coop = g_pDevice->TestCooperativeLevel();
if (coop != D3D_OK) {
if (coop == D3DERR_DEVICELOST) {
if (m_deviceLost == false)
DeviceLost();
}
else if (coop == D3DERR_DEVICENOTRESET) {
if (m_deviceLost == true)
DeviceGained();
}
Sleep(100);
return;
}
m_animation.Update(deltaTime);
//Keyboard input
if (KeyDown(VK_ESCAPE)) {
Quit();
}
if (KeyDown(VK_RETURN) && KeyDown(18)) { //ALT + RETURN
//Switch between windowed mode and fullscreen mode
m_present.Windowed = !m_present.Windowed;
DeviceLost();
DeviceGained();
if (m_present.Windowed) {
RECT rc = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, false);
SetWindowPos(m_mainWindow, HWND_NOTOPMOST, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_SHOWWINDOW);
UpdateWindow(m_mainWindow);
}
}
}
catch(...) {
g_debug << "Error in Application::Update() \n";
}
}
示例6: Update
void DialogCharacter::Update(int delta, string &emotionId, bool finishOneTimeEmotions, bool isInBackground)
{
if (emotionId.length() == 0)
{
emotionId = defaultEmotionId;
}
if (characterOneTimeEmotions.count(emotionId) > 0)
{
OneTimeEmotion *pOneTimeEmotion = characterOneTimeEmotions[emotionId];
Video *pVideo = pOneTimeEmotion->GetVideo();
if (finishOneTimeEmotions)
{
pVideo->Finish();
}
else
{
pVideo->Update(delta);
}
if (pVideo->IsFinished() && pOneTimeEmotion->GetTransitionToEmotion().length() > 0)
{
pVideo->Reset();
emotionId = pOneTimeEmotion->GetTransitionToEmotion();
}
else
{
return;
}
}
vector<Animation *> *pForegroundLayers = GetForegroundLayersForEmotion(emotionId);
if (pForegroundLayers != NULL)
{
for (unsigned int i = 0; i < pForegroundLayers->size(); i++)
{
Animation *pAnimation = (*pForegroundLayers)[i];
pAnimation->Update(delta);
}
}
// If this emotion is currently in the background (e.g., if the character is currently zoomed),
// then we won't bother updating the eye frame duration list.
if (isInBackground || characterEmotionEyeSpriteIds.count(emotionId) == 0)
{
return;
}
if (eyeFrameDurationList.size() == 0 || eyeFrameDurationList.size() != characterEmotionEyeSpriteIds[emotionId].size())
{
PopulateEyeFrameDurationList(emotionId);
}
msElapsedCurrentEyeFrame += delta;
while (msElapsedCurrentEyeFrame > eyeFrameDurationList[currentEyeFrame])
{
msElapsedCurrentEyeFrame -= eyeFrameDurationList[currentEyeFrame];
currentEyeFrame++;
// If we've reached the end, then we'll wrap back around and get a
// new random number representing the time until the next eye blink.
if (currentEyeFrame >= eyeFrameDurationList.size())
{
currentEyeFrame = 0;
eyeFrameDurationList[0] = (int)(rand() % 2001) + 2000;
}
}
}