mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-10-30 22:54:21 +00:00 
			
		
		
		
	It is now possible to set fps to save some cpu and battery.
This commit is contained in:
		| @@ -150,6 +150,32 @@ ApplicationWindow { | ||||
|                         //                        } | ||||
|                     } | ||||
|                 } | ||||
|                 GroupBox{ | ||||
|                     title: qsTr("Performace") | ||||
|                     Layout.fillWidth: true | ||||
|                     Layout.columnSpan: 2 | ||||
|                     anchors.left: parent.left | ||||
|                     anchors.right: parent.right | ||||
|                     RowLayout{ | ||||
|                         Layout.columnSpan: 2 | ||||
|                         anchors.left: parent.left | ||||
|                         anchors.right: parent.right | ||||
|                         Text{text: "Animation FPS"} | ||||
|                         Slider{ | ||||
|                             Layout.fillWidth: true | ||||
|                             id: slider | ||||
|                             stepSize: 1 | ||||
|                             maximumValue: 60 | ||||
|                             minimumValue: 0 | ||||
|                             onValueChanged: shadersettings.fps = value; | ||||
|                             value: shadersettings.fps | ||||
|                         } | ||||
|                         Text{ | ||||
|                             id: textfield | ||||
|                             text: slider.value | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -35,6 +35,8 @@ Item{ | ||||
|     property real window_scaling: 1.0 | ||||
|     property real total_scaling: terminal_scaling * window_scaling | ||||
|  | ||||
|     property real fps: 60 | ||||
|  | ||||
|     function mix(c1, c2, alpha){ | ||||
|         return Qt.rgba(c1.r * alpha + c2.r * (1-alpha), | ||||
|                        c1.g * alpha + c2.g * (1-alpha), | ||||
| @@ -162,6 +164,8 @@ Item{ | ||||
|         console.log(profilename + settings); | ||||
|         settings = JSON.parse(settings); | ||||
|  | ||||
|         fps = settings.fps !== undefined ? settings.fps: fps | ||||
|  | ||||
|         contrast = settings.contrast !== undefined ? settings.contrast : contrast; | ||||
|         brightness = settings.brightness !== undefined ? settings.brightness : brightness | ||||
|  | ||||
| @@ -189,6 +193,7 @@ Item{ | ||||
|  | ||||
|     function storeCurrentSettings(){ | ||||
|         var settings = { | ||||
|             fps: fps, | ||||
|             ambient_light : ambient_light, | ||||
|             brightness : brightness, | ||||
|             contrast : contrast, | ||||
|   | ||||
| @@ -25,12 +25,15 @@ import org.kde.konsole 0.1 | ||||
|  | ||||
| Item{ | ||||
|     id: terminalContainer | ||||
|     property real mBloom: shadersettings.bloom_strength | ||||
|     //The blur effect has to take into account the framerate | ||||
|     property real fpsAttenuation: shadersettings.fps / 60 | ||||
|     property real mBlur: shadersettings.motion_blur | ||||
|     property real motionBlurCoefficient: (_minBlurCoefficient)*mBlur + (_maxBlurCoefficient)*(1.0-mBlur) | ||||
|     property real motionBlurCoefficient: ((_minBlurCoefficient)*mBlur + (_maxBlurCoefficient)*(1.0-mBlur)) / fpsAttenuation | ||||
|     property real _minBlurCoefficient: 0.015 | ||||
|     property real _maxBlurCoefficient: 0.10 | ||||
|  | ||||
|     property real mBloom: shadersettings.bloom_strength | ||||
|  | ||||
|     //Force reload of the blursource when settings change | ||||
|     onMBloomChanged: restartBlurredSource() | ||||
|  | ||||
|   | ||||
| @@ -81,7 +81,7 @@ ApplicationWindow{ | ||||
|         width: parent.width * shadersettings.window_scaling | ||||
|         height: parent.height * shadersettings.window_scaling | ||||
|         scale: 1.0 / shadersettings.window_scaling | ||||
|         clip: false | ||||
|  | ||||
|         Image{ | ||||
|             id: randtexture | ||||
|             source: "frames/images/randfunction.png" | ||||
| @@ -99,7 +99,7 @@ ApplicationWindow{ | ||||
|             id: timetimer | ||||
|             property real time: 0 | ||||
|             onTriggered: time += interval | ||||
|             interval: 16 | ||||
|             interval: Math.round(1000 / shadersettings.fps) | ||||
|             running: true | ||||
|             repeat: true | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user