00001
00002
00003
00004
00005 #include "PerformanceOverlay.h"
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 PerformanceOverlay::PerformanceOverlay()
00017 {
00018 frameCount = 0;
00019 fps = 0;
00020 }
00021
00022
00023 PerformanceOverlay::~PerformanceOverlay()
00024 {
00025
00026 }
00027
00028
00029
00030 void PerformanceOverlay::Draw(QPainter *painter)
00031 {
00032 painter->save();
00033 painter->setRenderHint(QPainter::TextAntialiasing);
00034 painter->setBackgroundMode(Qt::TransparentMode);
00035 painter->setPen(Qt::white);
00036 painter->setFont(QFont("Arial",20));
00037 int width = painter->fontMetrics().width("fps: 24");
00038 int height = painter->fontMetrics().height();
00039 painter->drawText(100,100,QString("fps: ").append(QString().setNum(fps)));
00040 painter->drawRect(50,50,width+100,height+50);
00041 painter->restore();
00042 }
00043
00044 void PerformanceOverlay::Reset()
00045 {
00046 frameCount = 0;
00047 }
00048
00049
00050
00051
00052
00053