ManaPlus
|
#include "utils/timer.h"
#include "const/utils/timer.h"
#include <SDL_timer.h>
#include <climits>
#include "debug.h"
Go to the source code of this file.
Namespaces | |
anonymous_namespace{timer.cpp} | |
Functions | |
SDL_TimerID | anonymous_namespace{timer.cpp}::mLogicCounterId (0) |
SDL_TimerID | anonymous_namespace{timer.cpp}::mSecondsCounterId (0) |
static uint32_t | nextTick (uint32_t interval, void *param) |
static uint32_t | nextSecond (uint32_t interval, void *param) |
int | get_elapsed_time (const int startTime) |
int | get_elapsed_time1 (const int startTime) |
void | startTimers () |
void | stopTimers () |
Variables | |
static const int | MAX_TICK_VALUE = INT_MAX / 2 |
volatile int | tick_time |
volatile int | fps = 0 |
volatile int | lps = 0 |
volatile int | frame_count = 0 |
volatile int | logic_count = 0 |
volatile time_t | cur_time = 0 |
int get_elapsed_time | ( | const int | startTime | ) |
Definition at line 94 of file timer.cpp.
References MAX_TICK_VALUE, MILLISECONDS_IN_A_TICK, and tick_time.
Referenced by Palette::advanceGradient(), Being::getOffset(), Being::logic(), LocalPlayer::logic(), SkillDialog::slowLogic(), and Map::updateAmbientLayers().
int get_elapsed_time1 | ( | const int | startTime | ) |
Definition at line 105 of file timer.cpp.
References MAX_TICK_VALUE, and tick_time.
Referenced by Being::logic(), Game::slowLogic(), and CompoundSprite::updateImages().
|
static |
Updates fps. Called every seconds by SDL_AddTimer()
Definition at line 80 of file timer.cpp.
References fps, frame_count, logic_count, and lps.
Referenced by startTimers().
|
static |
Advances game logic counter. Called every 10 milliseconds by SDL_AddTimer()
Definition at line 68 of file timer.cpp.
References MAX_TICK_VALUE, and tick_time.
Referenced by startTimers().
void startTimers | ( | ) |
Definition at line 113 of file timer.cpp.
References MILLISECONDS_IN_A_TICK, anonymous_namespace{timer.cpp}::mLogicCounterId(), anonymous_namespace{timer.cpp}::mSecondsCounterId(), nextSecond(), nextTick(), and tick_time.
Referenced by Client::gameInit().
void stopTimers | ( | ) |
Definition at line 121 of file timer.cpp.
References anonymous_namespace{timer.cpp}::mLogicCounterId(), and anonymous_namespace{timer.cpp}::mSecondsCounterId().
Referenced by Client::gameClear().
volatile time_t cur_time = 0 |
Definition at line 58 of file timer.cpp.
Referenced by WhoIsOnline::action(), Being::addToCache(), Game::adjustPerfomance(), LocalPlayer::afkRespond(), ShopWindow::announce(), DialogsManager::attributeChanged(), ShopWindow::checkFloodCounter(), Game::checkKeys(), DelayedManager::delayedLoad(), BrowserBox::draw(), FloorItem::draw(), LocalPlayer::fixPos(), KillStats::gainXp(), Client::gameExec(), Being::getCacheEntry(), TextField::handleCtrlKeys(), LocalPlayer::logic(), EffectManager::logic(), MapDebugTab::logic(), SkillDialog::playCastingDstTileEffect(), TmwAthena::ChatRecv::processChatContinue(), EAthena::Mail2Recv::processMailListPage(), SDLInput::pushInput(), KillStats::recalcStats(), GuildManager::requestGuildInfo(), Being::reReadConfig(), Game::resetAdjustLevel(), Being::resetCounters(), Being::setAttackTime(), LocalPlayer::setDestination(), Being::setMoveTime(), Being::setOtherTime(), Being::setTalkTime(), LocalPlayer::setTestParticle(), Being::setTestTime(), SDLInput::simulateMouseMove(), LocalPlayer::slowLogic(), Game::slowLogic(), Gui::slowLogic(), SocialWindow::slowLogic(), WhoIsOnline::slowLogic(), GuildManager::slowLogic(), Font::slowLogic(), PacketCounters::updateCounter(), Game::updateFrameRate(), Being::updateFromCache(), BrowserBox::updateHeight(), Game::updateHistory(), and ShopWindow::updateTimes().
volatile int fps = 0 |
Frames counted in the last second
Definition at line 54 of file timer.cpp.
Referenced by Game::adjustPerfomance(), MapDebugTab::logic(), and nextSecond().
volatile int frame_count = 0 |
Counts the frames during one second
Definition at line 56 of file timer.cpp.
Referenced by Client::gameExec(), and nextSecond().
volatile int logic_count = 0 |
Counts the logic during one second
Definition at line 57 of file timer.cpp.
Referenced by Client::gameExec(), and nextSecond().
volatile int lps = 0 |
Logic processed per second
Definition at line 55 of file timer.cpp.
Referenced by StatDebugTab::logic(), and nextSecond().
|
static |
Tells the max tick value, setting it back to zero (and start again).
Definition at line 51 of file timer.cpp.
Referenced by get_elapsed_time(), get_elapsed_time1(), and nextTick().
volatile int tick_time |
Tick counter
Definition at line 53 of file timer.cpp.
Referenced by Being::addCast(), Palette::advanceGradient(), LocalPlayer::allowAction(), LocalPlayer::attack(), Being::botLogic(), PacketLimiter::checkPackets(), CrazyMoves::crazyMoveAd(), CrazyMoves::crazyMoveAe(), CrazyMoves::crazyMoveAm(), DelayedManager::delayedLoad(), Viewport::draw(), Being::drawBeingCursor(), LocalPlayer::freezeMoving(), Game::Game(), Client::gameExec(), get_elapsed_time(), get_elapsed_time1(), LocalPlayer::getPingTime(), Being::handleAttack(), InputManager::handleRepeat(), Being::handleSkill(), PacketLimiter::limitPackets(), ActorSprite::logic(), Being::logic(), LocalPlayer::logic(), CutInWindow::logic(), MiniStatusWindow::logic(), nextTick(), Being::nextTile(), LocalPlayer::pingRequest(), LocalPlayer::pingResponse(), Being::playSfx(), EAthena::BeingRecv::processBeingVisible(), TmwAthena::BeingRecv::processBeingVisible(), TmwAthena::BeingRecv::processPlayerMove(), TmwAthena::BeingRecv::processPlayerUpdate1(), TmwAthena::BeingRecv::processPlayerUpdate2(), TmwAthena::BuySellHandler::requestBuyList(), GuildManager::requestGuildInfo(), TmwAthena::BuySellHandler::requestSellList(), Joystick::resetRepeat(), KeyboardConfig::resetRepeat(), Being::setAction(), Being::setPath(), SkillDialog::setSkillDuration(), Game::slowLogic(), GuildManager::slowLogic(), startTimers(), LocalPlayer::tryPingRequest(), Map::updateAmbientLayers(), and CompoundSprite::updateImages().