mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-04-18 16:50:47 +01:00
Introducing terminal scaling for performance reasons on old PCs.
This commit is contained in:
parent
3abdb9424c
commit
1b94fb6b22
@ -25,9 +25,16 @@ Item{
|
|||||||
|
|
||||||
property real ambient_light: 0.2
|
property real ambient_light: 0.2
|
||||||
property real contrast: 0.8
|
property real contrast: 0.8
|
||||||
|
|
||||||
property real brightness: 0.5
|
property real brightness: 0.5
|
||||||
|
|
||||||
|
//Scaling of the preprocessed terminal with respect to the window.
|
||||||
|
property real terminal_scaling: 1.0
|
||||||
|
|
||||||
|
//Scaling of the whole window
|
||||||
|
property real window_scaling: 1.0
|
||||||
|
|
||||||
|
property real total_scaling: terminal_scaling * window_scaling
|
||||||
|
|
||||||
function mix(c1, c2, alpha){
|
function mix(c1, c2, alpha){
|
||||||
return Qt.rgba(c1.r * alpha + c2.r * (1-alpha),
|
return Qt.rgba(c1.r * alpha + c2.r * (1-alpha),
|
||||||
c1.g * alpha + c2.g * (1-alpha),
|
c1.g * alpha + c2.g * (1-alpha),
|
||||||
|
@ -31,7 +31,6 @@ Item{
|
|||||||
property real motionBlurCoefficient: (_minBlurCoefficient)*mBlur + (_maxBlurCoefficient)*(1.0-mBlur)
|
property real motionBlurCoefficient: (_minBlurCoefficient)*mBlur + (_maxBlurCoefficient)*(1.0-mBlur)
|
||||||
property real _minBlurCoefficient: 0.015
|
property real _minBlurCoefficient: 0.015
|
||||||
property real _maxBlurCoefficient: 0.10
|
property real _maxBlurCoefficient: 0.10
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
//Force reload of the blursource when settings change
|
//Force reload of the blursource when settings change
|
||||||
onScanlinesChanged: restartBlurredSource()
|
onScanlinesChanged: restartBlurredSource()
|
||||||
@ -74,7 +73,8 @@ Item{
|
|||||||
onUpdatedImage: {blurredSource.live = true;livetimer.restart();}
|
onUpdatedImage: {blurredSource.live = true;livetimer.restart();}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
font.pointSize = shadersettings.font.pixelSize * shadersettings.font_scaling;
|
var scaling_factor = shadersettings.font_scaling * shadersettings.terminal_scaling * shadersettings.window_scaling;
|
||||||
|
font.pointSize = shadersettings.font.pixelSize * scaling_factor;
|
||||||
font.family = shadersettings.font.name;
|
font.family = shadersettings.font.name;
|
||||||
setLineSpacing(shadersettings.font.lineSpacing);
|
setLineSpacing(shadersettings.font.lineSpacing);
|
||||||
forceActiveFocus();
|
forceActiveFocus();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 3.0.1, 2014-04-02T19:08:53. -->
|
<!-- Written by QtCreator 3.0.1, 2014-04-02T21:14:48. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
@ -14,7 +14,10 @@ TerminalFrame{
|
|||||||
borderBottom: 232
|
borderBottom: 232
|
||||||
imageSource: "../images/black-frame.png"
|
imageSource: "../images/black-frame.png"
|
||||||
normalsSource: "../images/black-frame-normals.png"
|
normalsSource: "../images/black-frame-normals.png"
|
||||||
sourceRect: Qt.rect(-80, -90, terminal.width + 160, terminal.height + 180)
|
sourceRect: Qt.rect(-80 * shadersettings.total_scaling,
|
||||||
|
-90 * shadersettings.total_scaling,
|
||||||
|
terminal.width + 160 * shadersettings.total_scaling,
|
||||||
|
terminal.height + 180 * shadersettings.total_scaling)
|
||||||
|
|
||||||
shaderString: "FrameShader.qml"
|
shaderString: "FrameShader.qml"
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,10 @@ TerminalFrame{
|
|||||||
borderTop: 116
|
borderTop: 116
|
||||||
borderBottom: 116
|
borderBottom: 116
|
||||||
imageSource: "../images/screen-frame.png"
|
imageSource: "../images/screen-frame.png"
|
||||||
sourceRect: Qt.rect(-65, -75, terminal.width + 130, terminal.height + 150)
|
sourceRect: Qt.rect(-65 * shadersettings.total_scaling,
|
||||||
|
-75 * shadersettings.total_scaling,
|
||||||
|
terminal.width + 130 * shadersettings.total_scaling,
|
||||||
|
terminal.height + 150 * shadersettings.total_scaling)
|
||||||
|
|
||||||
shaderString: "NoFrameShader.qml"
|
shaderString: "NoFrameShader.qml"
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,10 @@ TerminalFrame{
|
|||||||
borderBottom: 116
|
borderBottom: 116
|
||||||
imageSource: "../images/screen-frame.png"
|
imageSource: "../images/screen-frame.png"
|
||||||
normalsSource: "../images/screen-frame-normals.png"
|
normalsSource: "../images/screen-frame-normals.png"
|
||||||
sourceRect: Qt.rect(-65, -75, terminal.width + 130, terminal.height + 150)
|
sourceRect: Qt.rect(-65 * shadersettings.total_scaling,
|
||||||
|
-75 * shadersettings.total_scaling,
|
||||||
|
terminal.width + 130 * shadersettings.total_scaling,
|
||||||
|
terminal.height + 150 * shadersettings.total_scaling)
|
||||||
|
|
||||||
shaderString: "FrameShader.qml"
|
shaderString: "FrameShader.qml"
|
||||||
}
|
}
|
||||||
|
27
app/main.qml
27
app/main.qml
@ -67,10 +67,21 @@ ApplicationWindow{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loader{
|
||||||
|
id: frame
|
||||||
|
property rect sourceRect: item.sourceRect
|
||||||
|
anchors.fill: parent
|
||||||
|
z: 2.1
|
||||||
|
source: shadersettings.frame_source
|
||||||
|
}
|
||||||
|
|
||||||
Item{
|
Item{
|
||||||
id: maincontainer
|
id: maincontainer
|
||||||
anchors.fill: parent
|
anchors.centerIn: parent
|
||||||
clip: true
|
width: parent.width * shadersettings.window_scaling
|
||||||
|
height: parent.height * shadersettings.window_scaling
|
||||||
|
scale: 1.0 / shadersettings.window_scaling
|
||||||
|
clip: false
|
||||||
Image{
|
Image{
|
||||||
id: randtexture
|
id: randtexture
|
||||||
source: "frames/images/randfunction.png"
|
source: "frames/images/randfunction.png"
|
||||||
@ -94,22 +105,14 @@ ApplicationWindow{
|
|||||||
}
|
}
|
||||||
Terminal{
|
Terminal{
|
||||||
id: terminal
|
id: terminal
|
||||||
width: parent.width
|
width: parent.width * shadersettings.terminal_scaling
|
||||||
height: parent.height
|
height: parent.height * shadersettings.terminal_scaling
|
||||||
}
|
}
|
||||||
ShaderEffectSource{
|
ShaderEffectSource{
|
||||||
id: theSource
|
id: theSource
|
||||||
sourceItem: terminal
|
sourceItem: terminal
|
||||||
sourceRect: frame.sourceRect
|
sourceRect: frame.sourceRect
|
||||||
}
|
}
|
||||||
Loader{
|
|
||||||
id: frame
|
|
||||||
property rect sourceRect: item.sourceRect
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
z: 2.1
|
|
||||||
source: shadersettings.frame_source
|
|
||||||
}
|
|
||||||
ShaderManager{
|
ShaderManager{
|
||||||
id: shadercontainer
|
id: shadercontainer
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user