mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-02-07 13:41:27 +00:00
Finally introducing texture scaling.
This commit is contained in:
parent
01b5dd9651
commit
1ef94e083c
@ -28,7 +28,7 @@ Window {
|
|||||||
id: settings_window
|
id: settings_window
|
||||||
title: qsTr("Settings")
|
title: qsTr("Settings")
|
||||||
width: 640
|
width: 640
|
||||||
height: 460
|
height: 480
|
||||||
|
|
||||||
modality: Qt.ApplicationModal
|
modality: Qt.ApplicationModal
|
||||||
|
|
||||||
@ -147,17 +147,6 @@ Window {
|
|||||||
onValueChanged: shadersettings.brightness = value
|
onValueChanged: shadersettings.brightness = value
|
||||||
value: shadersettings.brightness
|
value: shadersettings.brightness
|
||||||
}
|
}
|
||||||
//TODO decide later what to do with scaling
|
|
||||||
// SimpleSlider{
|
|
||||||
// name: "Terminal Scaling"
|
|
||||||
// onValueChanged: shadersettings.terminal_scaling = value
|
|
||||||
// value: shadersettings.terminal_scaling
|
|
||||||
// }
|
|
||||||
// SimpleSlider{
|
|
||||||
// name: "Window Scaling"
|
|
||||||
// onValueChanged: shadersettings.window_scaling = value
|
|
||||||
// value: shadersettings.window_scaling
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GroupBox{
|
GroupBox{
|
||||||
@ -166,10 +155,10 @@ Window {
|
|||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
RowLayout{
|
GridLayout{
|
||||||
|
columns: 3
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
anchors.left: parent.left
|
anchors {left: parent.left; right: parent.right}
|
||||||
anchors.right: parent.right
|
|
||||||
Text{text: "Animation FPS"}
|
Text{text: "Animation FPS"}
|
||||||
Slider{
|
Slider{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -180,10 +169,19 @@ Window {
|
|||||||
onValueChanged: shadersettings.fps = value;
|
onValueChanged: shadersettings.fps = value;
|
||||||
value: shadersettings.fps
|
value: shadersettings.fps
|
||||||
}
|
}
|
||||||
Text{
|
Text{text: slider.value}
|
||||||
id: textfield
|
Text{text: "Texture quality"}
|
||||||
text: slider.value
|
Slider{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
id: txtslider
|
||||||
|
stepSize: 0.01
|
||||||
|
maximumValue: 1
|
||||||
|
minimumValue: 0
|
||||||
|
onValueChanged: shadersettings.window_scaling = value;
|
||||||
|
value: shadersettings.window_scaling
|
||||||
|
updateValueWhileDragging: false
|
||||||
}
|
}
|
||||||
|
Text{text: Math.round(txtslider.value * 100) + "%"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,10 +41,11 @@ ShaderEffect {
|
|||||||
property real horizontal_sincronization: shadersettings.horizontal_sincronization
|
property real horizontal_sincronization: shadersettings.horizontal_sincronization
|
||||||
|
|
||||||
property bool frame_reflection_strength: shadersettings.frame_reflection_strength
|
property bool frame_reflection_strength: shadersettings.frame_reflection_strength
|
||||||
property real disp_top: frame.item.displacementTop.toFixed(1)
|
|
||||||
property real disp_bottom: frame.item.displacementBottom
|
property real disp_top: frame.item.displacementTop * shadersettings.window_scaling
|
||||||
property real disp_left: frame.item.displacementLeft
|
property real disp_bottom: frame.item.displacementBottom * shadersettings.window_scaling
|
||||||
property real disp_right: frame.item.displacementRight
|
property real disp_left: frame.item.displacementLeft * shadersettings.window_scaling
|
||||||
|
property real disp_right: frame.item.displacementRight * shadersettings.window_scaling
|
||||||
|
|
||||||
property real brightness: shadersettings.brightness * 1.5 + 0.5
|
property real brightness: shadersettings.brightness * 1.5 + 0.5
|
||||||
|
|
||||||
|
@ -27,15 +27,11 @@ Item{
|
|||||||
property real contrast: 0.85
|
property real contrast: 0.85
|
||||||
property real brightness: 0.75
|
property real brightness: 0.75
|
||||||
|
|
||||||
|
//On resize shows an overlay with the current size
|
||||||
property bool show_terminal_size: true
|
property bool show_terminal_size: true
|
||||||
|
|
||||||
//Scaling of the preprocessed terminal with respect to the window.
|
|
||||||
property real terminal_scaling: 1.0
|
|
||||||
onTerminal_scalingChanged: handleFontChanged();
|
|
||||||
|
|
||||||
//Scaling of the whole window
|
|
||||||
property real window_scaling: 1.0
|
property real window_scaling: 1.0
|
||||||
property real total_scaling: terminal_scaling * window_scaling
|
onWindow_scalingChanged: handleFontChanged();
|
||||||
|
|
||||||
property real fps: 60
|
property real fps: 60
|
||||||
|
|
||||||
@ -172,6 +168,7 @@ Item{
|
|||||||
show_terminal_size = settings.show_terminal_size ? settings.show_terminal_size : show_terminal_size
|
show_terminal_size = settings.show_terminal_size ? settings.show_terminal_size : show_terminal_size
|
||||||
|
|
||||||
fps = settings.fps !== undefined ? settings.fps: fps
|
fps = settings.fps !== undefined ? settings.fps: fps
|
||||||
|
window_scaling = settings.window_scaling ? settings.window_scaling : window_scaling
|
||||||
|
|
||||||
contrast = settings.contrast !== undefined ? settings.contrast : contrast;
|
contrast = settings.contrast !== undefined ? settings.contrast : contrast;
|
||||||
brightness = settings.brightness !== undefined ? settings.brightness : brightness
|
brightness = settings.brightness !== undefined ? settings.brightness : brightness
|
||||||
@ -201,6 +198,7 @@ Item{
|
|||||||
function storeCurrentSettings(){
|
function storeCurrentSettings(){
|
||||||
var settings = {
|
var settings = {
|
||||||
fps: fps,
|
fps: fps,
|
||||||
|
window_scaling: window_scaling,
|
||||||
show_terminal_size: show_terminal_size,
|
show_terminal_size: show_terminal_size,
|
||||||
ambient_light: ambient_light,
|
ambient_light: ambient_light,
|
||||||
brightness: brightness,
|
brightness: brightness,
|
||||||
|
@ -85,7 +85,7 @@ Item{
|
|||||||
onUpdatedImage: {blurredSource.live = true;livetimer.restart();}
|
onUpdatedImage: {blurredSource.live = true;livetimer.restart();}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
var scaling_factor = shadersettings.font_scaling * shadersettings.terminal_scaling * shadersettings.window_scaling;
|
var scaling_factor = shadersettings.font_scaling * shadersettings.window_scaling;
|
||||||
font.pointSize = shadersettings.font.pixelSize * scaling_factor;
|
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);
|
||||||
@ -160,6 +160,9 @@ Item{
|
|||||||
recursive: true
|
recursive: true
|
||||||
live: true
|
live: true
|
||||||
|
|
||||||
|
smooth: false
|
||||||
|
antialiasing: false
|
||||||
|
|
||||||
Timer{
|
Timer{
|
||||||
id: livetimer
|
id: livetimer
|
||||||
running: true
|
running: true
|
||||||
|
@ -13,10 +13,9 @@ 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(-20 * shadersettings.total_scaling,
|
|
||||||
-20 * shadersettings.total_scaling,
|
rectX: 20
|
||||||
terminal.width + 40 * shadersettings.total_scaling,
|
rectY: 20
|
||||||
terminal.height + 40 * shadersettings.total_scaling)
|
|
||||||
|
|
||||||
distortionCoefficient: 1.9
|
distortionCoefficient: 1.9
|
||||||
|
|
||||||
|
@ -13,10 +13,9 @@ 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(-15 * shadersettings.total_scaling,
|
|
||||||
-15 * shadersettings.total_scaling,
|
rectX: 15
|
||||||
terminal.width + 30 * shadersettings.total_scaling,
|
rectY: 15
|
||||||
terminal.height+ 30 * shadersettings.total_scaling)
|
|
||||||
|
|
||||||
distortionCoefficient: 1.5
|
distortionCoefficient: 1.5
|
||||||
|
|
||||||
|
@ -13,6 +13,10 @@ Item{
|
|||||||
property rect sourceRect
|
property rect sourceRect
|
||||||
property string shaderString
|
property string shaderString
|
||||||
|
|
||||||
|
//Value used to create the rect used to add the border to the texture
|
||||||
|
property real rectX
|
||||||
|
property real rectY
|
||||||
|
|
||||||
//Values used to displace the texture in the screen. Used to make reflections correct.
|
//Values used to displace the texture in the screen. Used to make reflections correct.
|
||||||
property real displacementLeft
|
property real displacementLeft
|
||||||
property real displacementTop
|
property real displacementTop
|
||||||
|
27
app/main.qml
27
app/main.qml
@ -90,7 +90,10 @@ ApplicationWindow{
|
|||||||
|
|
||||||
Loader{
|
Loader{
|
||||||
id: frame
|
id: frame
|
||||||
property rect sourceRect: item.sourceRect
|
property rect sourceRect: Qt.rect(-item.rectX * shadersettings.window_scaling,
|
||||||
|
-item.rectY * shadersettings.window_scaling,
|
||||||
|
terminal.width + 2*item.rectX * shadersettings.window_scaling,
|
||||||
|
terminal.height + 2*item.rectY * shadersettings.window_scaling)
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
z: 2.1
|
z: 2.1
|
||||||
source: shadersettings.frame_source
|
source: shadersettings.frame_source
|
||||||
@ -133,8 +136,8 @@ ApplicationWindow{
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
property int frameOffsetX: frame.item.addedWidth - frame.item.borderLeft - frame.item.borderRight
|
property int frameOffsetX: frame.item.addedWidth - frame.item.borderLeft - frame.item.borderRight
|
||||||
property int frameOffsetY: frame.item.addedHeight - frame.item.borderTop - frame.item.borderBottom
|
property int frameOffsetY: frame.item.addedHeight - frame.item.borderTop - frame.item.borderBottom
|
||||||
width: (parent.width + frameOffsetX) * shadersettings.terminal_scaling
|
width: parent.width + frameOffsetX * shadersettings.window_scaling
|
||||||
height: (parent.height + frameOffsetY) * shadersettings.terminal_scaling
|
height: parent.height + frameOffsetY * shadersettings.window_scaling
|
||||||
}
|
}
|
||||||
ShaderEffectSource{
|
ShaderEffectSource{
|
||||||
id: theSource
|
id: theSource
|
||||||
@ -146,15 +149,6 @@ ApplicationWindow{
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
z: 1.9
|
z: 1.9
|
||||||
}
|
}
|
||||||
Loader{
|
|
||||||
id: sizeoverlayloader
|
|
||||||
z: 3
|
|
||||||
anchors.centerIn: parent
|
|
||||||
active: shadersettings.show_terminal_size
|
|
||||||
sourceComponent: SizeOverlay{
|
|
||||||
terminalSize: terminal.terminalSize
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ShaderSettings{
|
ShaderSettings{
|
||||||
id: shadersettings
|
id: shadersettings
|
||||||
@ -166,4 +160,13 @@ ApplicationWindow{
|
|||||||
id: settingswindow
|
id: settingswindow
|
||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
|
Loader{
|
||||||
|
id: sizeoverlayloader
|
||||||
|
z: 3
|
||||||
|
anchors.centerIn: parent
|
||||||
|
active: shadersettings.show_terminal_size
|
||||||
|
sourceComponent: SizeOverlay{
|
||||||
|
terminalSize: terminal.terminalSize
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user