Skip to content

Commit 8647bdd

Browse files
committed
Add custom FPS option
1 parent 6bc8120 commit 8647bdd

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

src/app/qml/dialogs/ProjectSettingsDialog.qml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import QtQuick
44
import QtQuick.Controls
55
import QtQuick.Layouts
6+
import ScratchCPP
67
import ScratchCPP.UiComponents
78
import ScratchCPP.Render
89

@@ -12,6 +13,32 @@ CustomDialog {
1213
standardButtons: Dialog.Close
1314

1415
contentItem: ColumnLayout {
16+
// General
17+
Label {
18+
text: qsTr("General")
19+
font.pointSize: 14
20+
font.bold: true
21+
}
22+
23+
RowLayout {
24+
Label {
25+
text: qsTr("FPS (frames per second)")
26+
}
27+
28+
SpinBox {
29+
editable: true
30+
from: 1
31+
to: 250
32+
stepSize: 10
33+
value: projectPlayer.fps
34+
onValueChanged: {
35+
projectPlayer.fps = value;
36+
AppMenuBar.fps60Mode = (value === 60);
37+
}
38+
}
39+
}
40+
41+
// Remove limits
1542
Label {
1643
text: qsTr("Remove limits")
1744
font.pointSize: 14

src/app/qml/main.qml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ApplicationWindow {
1414
id: root
1515
minimumWidth: layout.implicitWidth + layout.anchors.margins * 2
1616
minimumHeight: menuBar.height + layout.implicitHeight + layout.anchors.margins * 2
17-
visible: true
17+
visible: true
1818
title: Qt.application.displayName
1919
color: Material.background
2020
Material.accent: "orange"
@@ -33,6 +33,13 @@ ApplicationWindow {
3333
player.fileName = fileName;
3434
}
3535

36+
function onFps60ModeChanged() {
37+
if(AppMenuBar.fps60Mode)
38+
player.fps = 60;
39+
else if(player.fps === 60)
40+
player.fps = 30;
41+
}
42+
3643
function onProjectSettingsTriggered() {
3744
projectSettingsDialog.open();
3845
}
@@ -134,7 +141,6 @@ ApplicationWindow {
134141
activeFocusOnTab: true
135142
focus: true
136143
turboMode: AppMenuBar.turboMode
137-
fps: AppMenuBar.fps60Mode ? 60 : 30
138144
}
139145
}
140146
}

0 commit comments

Comments
 (0)