1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Removed getFrameDeltaMilliseconds from gui handler

This commit is contained in:
Ivan Savenko 2023-05-14 22:30:59 +03:00
parent 8a31aeb94b
commit f84c2c3bb5
4 changed files with 5 additions and 14 deletions

View File

@ -12,6 +12,7 @@
#include "CMT.h"
#include "gui/CGuiHandler.h"
#include "gui/FramerateManager.h"
#include "renderSDL/SDL_Extensions.h"
#include "CPlayerInterface.h"
#include "../lib/filesystem/Filesystem.h"
@ -370,7 +371,7 @@ void CVideoPlayer::update( int x, int y, SDL_Surface *dst, bool forceRedraw, boo
auto packet_duration = frame->duration;
#endif
double frameEndTime = (frame->pts + packet_duration) * av_q2d(format->streams[stream]->time_base);
frameTime += GH.getFrameDeltaMilliseconds() / 1000.0;
frameTime += GH.framerateManager().getElapsedMilliseconds() / 1000.0;
if (frameTime >= frameEndTime )
{

View File

@ -761,11 +761,6 @@ const Point & CGuiHandler::getCursorPosition() const
return cursorPosition;
}
uint32_t CGuiHandler::getFrameDeltaMilliseconds() const
{
return framerateManagerInstance->getElapsedMilliseconds();
}
Point CGuiHandler::screenDimensions() const
{
return Point(screen->w, screen->h);

View File

@ -87,8 +87,6 @@ private:
void fakeMoveCursor(float dx, float dy);
void fakeMouseButtonEventRelativeMode(bool down, bool right);
FramerateManager & framerateManager();
public:
void handleElementActivate(CIntObject * elem, ui16 activityFlag);
void handleElementDeActivate(CIntObject * elem, ui16 activityFlag);
@ -100,11 +98,7 @@ public:
const Point & getCursorPosition() const;
ShortcutHandler & shortcutsHandler();
/// returns duration of last frame in milliseconds
/// NOTE: avoid to use, preferred method is to overload CIntObject::tick(uint32_t)
uint32_t getFrameDeltaMilliseconds() const;
FramerateManager & framerateManager();
/// Returns current logical screen dimensions
/// May not match size of window if user has UI scaling different from 100%

View File

@ -12,6 +12,7 @@
#include "CursorHandler.h"
#include "CGuiHandler.h"
#include "FramerateManager.h"
#include "../renderSDL/CursorSoftware.h"
#include "../renderSDL/CursorHardware.h"
#include "../render/CAnimation.h"
@ -250,7 +251,7 @@ void CursorHandler::updateSpellcastCursor()
{
static const float frameDisplayDuration = 0.1f; // H3 uses 100 ms per frame
frameTime += GH.getFrameDeltaMilliseconds() / 1000.f;
frameTime += GH.framerateManager().getElapsedMilliseconds() / 1000.f;
size_t newFrame = frame;
while (frameTime >= frameDisplayDuration)