Commit c056c789 authored by Tomi Korpipää's avatar Tomi Korpipää

Moved FPS displays to containing rectangle

parent fc3cf82e
......@@ -490,6 +490,52 @@ Window {
font.pixelSize: 130
}
}
//
// FpsDisplay
//
FpsDisplay {
id: fpsDisplay
anchors.left: parent.left
anchors.top: parent.top
anchors.margins: 10
width: 40
height: 40
textcolor: "red"
fpslabel: "FPS"
}
FpsDisplay {
id: avgFpsDisplay
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: 10
width: 40
height: 40
textcolor: "green"
fpslabel: "1 min AVG"
}
Timer {
interval: 1000
repeat: true
running: !fpsDisplay.hidden
onTriggered: {
if (++framesUpdated == framesBetweenUpdates) {
fpsDisplay.fps = frames / framesBetweenUpdates;
frames = 0;
framesUpdated = 0;
}
if (++avgCount == secondsBetweenUpdates) {
avgFpsDisplay.fps = avgFrames / secondsBetweenUpdates;
avgFrames = 0.0;
avgCount = 0;
}
}
onRunningChanged: {
avgFrames = 0;
frames = 0;
framesUpdated = 0;
}
}
}
// Animations
......@@ -756,51 +802,6 @@ Window {
}
}
//
// FpsDisplay
//
FpsDisplay {
id: fpsDisplay
anchors.left: parent.left
anchors.top: parent.top
anchors.margins: 10
width: 40
height: 40
textcolor: "red"
fpslabel: "FPS"
}
FpsDisplay {
id: avgFpsDisplay
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: 10
width: 40
height: 40
textcolor: "green"
fpslabel: "1 min AVG"
}
Timer {
interval: 1000
repeat: true
running: !fpsDisplay.hidden
onTriggered: {
if (++framesUpdated == framesBetweenUpdates) {
fpsDisplay.fps = frames / framesBetweenUpdates;
frames = 0;
framesUpdated = 0;
}
if (++avgCount == secondsBetweenUpdates) {
avgFpsDisplay.fps = avgFrames / secondsBetweenUpdates;
avgFrames = 0.0;
avgCount = 0;
}
}
onRunningChanged: {
avgFrames = 0;
frames = 0;
framesUpdated = 0;
}
}
//
// Simulation data
//
SimulationData{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment