1. 修复了以Debug编译时显示实时FPS信息显示,在嵌入式Linux上不显示的问题:直接以img的方式显示,防止因为Qt交叉编译等原因产生的找不到系统字体之类的问题

This commit is contained in:
Misaki
2026-07-06 19:43:59 +08:00
parent 6b8983bc6d
commit 8fef837de3
4 changed files with 127 additions and 52 deletions
+10 -10
View File
@@ -1,33 +1,33 @@
#pragma once
#ifdef YOSUGA_DEBUG
#include <QElapsedTimer>
#include <QString>
#include <QLabel>
class QTimer;
class QElapsedTimer;
class FpsOverlay
class FpsOverlay : public QLabel
{
Q_OBJECT
public:
FpsOverlay();
explicit FpsOverlay(QWidget* parent = nullptr);
~FpsOverlay();
void tick();
void draw(int parentWidth, int parentHeight);
void renderToPixmap(); // 离线渲染文字到 pixmap
float rightMargin = 0.03f;
float topMargin = 0.03f;
int fontSize = 20;
int fontSize = 18;
private:
QElapsedTimer _elapsed;
QTimer* _timer = nullptr;
QElapsedTimer* _elapsed = nullptr;
int _frameCount = 0;
int _displayedFps = 0;
QString _text = "FPS: --";
void recalcFps();
};
#endif
#endif