From 50ca41331024deabc28920a5d8c6895a0bc09bbc Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sat, 5 Jun 2010 14:37:20 +0000 Subject: [PATCH] added more debug info related to time of day increment --- source/glest_game/game/game.cpp | 1 + source/glest_game/world/time_flow.h | 59 +++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 source/glest_game/world/time_flow.h diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index 04da39910..7f2447c31 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -1086,6 +1086,7 @@ void Game::render2d(){ str+= "Update FPS: "+intToStr(lastUpdateFps)+"\n"; str+= "GameCamera pos: "+floatToStr(gameCamera.getPos().x)+","+floatToStr(gameCamera.getPos().y)+","+floatToStr(gameCamera.getPos().z)+"\n"; str+= "Time: "+floatToStr(world.getTimeFlow()->getTime())+"\n"; + str+= "Time Increment: "+floatToStr(world.getTimeFlow()->getTimeInc())+"\n"; str+= "Triangle count: "+intToStr(renderer.getTriangleCount())+"\n"; str+= "Vertex count: "+intToStr(renderer.getPointCount())+"\n"; str+= "Frame count:"+intToStr(world.getFrameCount())+"\n"; diff --git a/source/glest_game/world/time_flow.h b/source/glest_game/world/time_flow.h new file mode 100644 index 000000000..2e49a5f7d --- /dev/null +++ b/source/glest_game/world/time_flow.h @@ -0,0 +1,59 @@ +// ============================================================== +// This file is part of Glest (www.glest.org) +// +// Copyright (C) 2001-2008 Martio Figueroa +// +// You can redistribute this code and/or modify it under +// the terms of the GNU General Public License as published +// by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version +// ============================================================== + +#ifndef _GLEST_GAME_TIMEFLOW_H_ +#define _GLEST_GAME_TIMEFLOW_H_ + +#include "tileset.h" +#include "sound.h" + +namespace Glest{ namespace Game{ + +using Shared::Sound::StrSound; +using Shared::Sound::StrSound; +using Shared::Sound::StaticSound; + + +// ===================================================== +// class TimeFlow +// +/// Raises time related events (day/night cycle) +// ===================================================== + +class TimeFlow{ +public: + static const float dusk; + static const float dawn; + +private: + bool firstTime; + Tileset *tileset; + float time; + float lastTime; + float timeInc; + +public: + void init(Tileset *tileset); + + float getTime() const {return time;} + bool isDay() const {return time>dawn && timedusk-1.f;} + float getTimeInc() const {return timeInc;} + + void update(); +private: + bool isAproxTime(float time); +}; + +}} //end namespace + +#endif