diff engine/core/view/renderers/genericrenderer.cpp @ 181:56ac89189bc4

fixed time handling in fife: - the time scaling method was unreliable when changing the time factors (jumping in the moment of the change) - replaced much calls to SDL_GetTicks with TimerManager::instance()->getTime() - some other time related cleanup
author spq@33b003aa-7bff-0310-803a-e67f0ece8222
date Sat, 31 Jan 2009 04:15:43 +0000
parents 2241b0d5379e
children ad1f09d954f9
line wrap: on
line diff
--- a/engine/core/view/renderers/genericrenderer.cpp	Fri Jan 30 00:58:43 2009 +0000
+++ b/engine/core/view/renderers/genericrenderer.cpp	Sat Jan 31 04:15:43 2009 +0000
@@ -35,6 +35,7 @@
 #include "video/image.h"
 #include "util/math/fife_math.h"
 #include "util/log/logger.h"
+#include "util/time/timemanager.h"
 #include "model/metamodel/grids/cellgrid.h"
 #include "model/metamodel/timeprovider.h"
 #include "model/structures/instance.h"
@@ -246,13 +247,13 @@
 		GenericRendererElementInfo(),
 		m_anchor(anchor),
 		m_animation(animation),
-		m_start_time(SDL_GetTicks()),
+		m_start_time(TimeManager::instance()->getTime()),
 		m_time_scale(1.0) {
 	}
 	void GenericRendererAnimationInfo::render(Camera* cam, Layer* layer, std::vector<Instance*>& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool) {
 		Point p = m_anchor.getCalculatedPoint(cam, layer, instances);
 		Animation& animation = animpool->getAnimation(m_animation);
-		int animtime = scaleTime(m_time_scale, SDL_GetTicks() - m_start_time) % animation.getDuration();
+		int animtime = scaleTime(m_time_scale, TimeManager::instance()->getTime() - m_start_time) % animation.getDuration();
 		Image* img = animation.getFrameByTimestamp(animtime);
 		Rect r;
 		r.x = p.x-img->getWidth()/2;