mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-02-07 13:41:27 +00:00
Added contrast setting. Settings window needs some work now.
This commit is contained in:
parent
8cb9520ea7
commit
103139e493
@ -86,8 +86,8 @@ ApplicationWindow {
|
|||||||
height: 50
|
height: 50
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
onButton_colorChanged: shadersettings.font_color = button_color;
|
onButton_colorChanged: shadersettings._font_color = button_color;
|
||||||
Component.onCompleted: button_color = shadersettings.font_color;
|
Component.onCompleted: button_color = shadersettings._font_color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,8 +112,20 @@ ApplicationWindow {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
|
|
||||||
onButton_colorChanged: shadersettings.background_color= button_color
|
onButton_colorChanged: shadersettings._background_color= button_color
|
||||||
Component.onCompleted: button_color = shadersettings.background_color;
|
Component.onCompleted: button_color = shadersettings._background_color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GroupBox{
|
||||||
|
title: qsTr("Background")
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight:true
|
||||||
|
ColumnLayout{
|
||||||
|
SettingComponent{
|
||||||
|
name: "Contrast"
|
||||||
|
onValueChanged: shadersettings.contrast = value
|
||||||
|
_value: shadersettings.contrast
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,9 +42,9 @@ ShaderEffect {
|
|||||||
property real _A: 0.4 + Math.random() * 0.4
|
property real _A: 0.4 + Math.random() * 0.4
|
||||||
property real _B: 0.2 + Math.random() * 0.4
|
property real _B: 0.2 + Math.random() * 0.4
|
||||||
property real _C: 1.2 - _A - _B
|
property real _C: 1.2 - _A - _B
|
||||||
property real a: (0.1 + Math.random() * 0.4) * 0.05
|
property real a: (0.0 + Math.random() * 0.4) * 0.05
|
||||||
property real b: (0.3 + Math.random() * 0.4) * 0.05
|
property real b: (0.1 + Math.random() * 0.4) * 0.05
|
||||||
property real c: (0.6 + Math.random() * 0.4) * 0.05
|
property real c: (0.4 + Math.random() * 0.4) * 0.05
|
||||||
|
|
||||||
property real randval: (_A * Math.cos(a * time + _B) +
|
property real randval: (_A * Math.cos(a * time + _B) +
|
||||||
_B * Math.sin(b * time + _C) +
|
_B * Math.sin(b * time + _C) +
|
||||||
@ -83,7 +83,6 @@ ShaderEffect {
|
|||||||
repeat: true
|
repeat: true
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO fix the glow line which is after the first time
|
|
||||||
fragmentShader: "
|
fragmentShader: "
|
||||||
uniform sampler2D source;
|
uniform sampler2D source;
|
||||||
uniform highp float qt_Opacity;
|
uniform highp float qt_Opacity;
|
||||||
@ -106,13 +105,20 @@ ShaderEffect {
|
|||||||
|
|
||||||
(shadersettings.screen_flickering !== 0 ? "uniform highp float horizontal_distortion;" : "") +
|
(shadersettings.screen_flickering !== 0 ? "uniform highp float horizontal_distortion;" : "") +
|
||||||
|
|
||||||
"float rand(vec2 co, float time){
|
|
||||||
return fract(sin(dot(co.xy ,vec2(0.37898 * time ,0.78233))) * 437.5875453);
|
"highp float rand(vec2 co)
|
||||||
|
{
|
||||||
|
highp float a = 12.9898;
|
||||||
|
highp float b = 78.233;
|
||||||
|
highp float c = 43758.5453;
|
||||||
|
highp float dt= dot(co.xy ,vec2(a,b));
|
||||||
|
highp float sn= mod(dt,3.14);
|
||||||
|
return fract(sin(sn) * c);
|
||||||
}
|
}
|
||||||
|
|
||||||
float stepNoise(vec2 p){
|
float stepNoise(vec2 p){
|
||||||
vec2 newP = p * txt_Size*0.25;
|
vec2 newP = p * txt_Size*0.5;
|
||||||
return rand(floor(newP), time);
|
return rand(floor(newP) + fract(time / 100.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
float getScanlineIntensity(vec2 pos){
|
float getScanlineIntensity(vec2 pos){
|
||||||
@ -122,7 +128,7 @@ ShaderEffect {
|
|||||||
|
|
||||||
(glowing_line_strength !== 0 ?
|
(glowing_line_strength !== 0 ?
|
||||||
"float randomPass(vec2 coords){
|
"float randomPass(vec2 coords){
|
||||||
return fract(smoothstep(-0.2, 0.0, coords.y - 3.0 * fract(time * 0.0002))) * glowing_line_strength;
|
return fract(smoothstep(-0.2, 0.0, coords.y - 3.0 * fract(time * 0.0001))) * glowing_line_strength;
|
||||||
}" : "") +
|
}" : "") +
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,9 +24,20 @@ Item{
|
|||||||
property bool fullscreen: false
|
property bool fullscreen: false
|
||||||
|
|
||||||
property real ambient_light: 0.2
|
property real ambient_light: 0.2
|
||||||
|
property real contrast: 0.9
|
||||||
|
|
||||||
property string background_color: "#002200"
|
function mix(c1, c2, alpha){
|
||||||
property string font_color: "#00ff00"
|
return Qt.rgba(c1.r * alpha + c2.r * (1-alpha),
|
||||||
|
c1.g * alpha + c2.g * (1-alpha),
|
||||||
|
c1.b * alpha + c2.b * (1-alpha),
|
||||||
|
c1.a * alpha + c2.a * (1-alpha))
|
||||||
|
}
|
||||||
|
|
||||||
|
//Private atttributes might need processing
|
||||||
|
property color _background_color: "#002200"
|
||||||
|
property color _font_color: "#00ff00"
|
||||||
|
property color font_color: mix(_font_color, _background_color, 0.5 + (contrast * 0.5))
|
||||||
|
property color background_color: mix(_background_color, _font_color, 0.5 + (contrast * 0.5))
|
||||||
|
|
||||||
property real noise_strength: 0.1
|
property real noise_strength: 0.1
|
||||||
property real screen_distortion: 0.15
|
property real screen_distortion: 0.15
|
||||||
@ -130,6 +141,8 @@ Item{
|
|||||||
|
|
||||||
settings = JSON.parse(settings);
|
settings = JSON.parse(settings);
|
||||||
|
|
||||||
|
contrast = settings.contrast ? settings.contrast : contrast;
|
||||||
|
|
||||||
ambient_light = settings.ambient_light ? settings.ambient_light : ambient_light;
|
ambient_light = settings.ambient_light ? settings.ambient_light : ambient_light;
|
||||||
background_color = settings.background_color ? settings.background_color : background_color;
|
background_color = settings.background_color ? settings.background_color : background_color;
|
||||||
font_color = settings.font_color ? settings.font_color : font_color;
|
font_color = settings.font_color ? settings.font_color : font_color;
|
||||||
@ -152,6 +165,7 @@ Item{
|
|||||||
function storeCurrentSettings(){
|
function storeCurrentSettings(){
|
||||||
var settings = {
|
var settings = {
|
||||||
ambient_light : ambient_light,
|
ambient_light : ambient_light,
|
||||||
|
contrast : contrast,
|
||||||
background_color: background_color,
|
background_color: background_color,
|
||||||
font_color: font_color,
|
font_color: font_color,
|
||||||
screen_flickering: screen_flickering,
|
screen_flickering: screen_flickering,
|
||||||
|
@ -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-03-26T18:33:08. -->
|
<!-- Written by QtCreator 3.0.1, 2014-03-27T13:16:23. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
@ -115,7 +115,7 @@ ApplicationWindow{
|
|||||||
z: 2.0
|
z: 2.0
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cached: true
|
cached: true
|
||||||
opacity: shadersettings.ambient_light * 0.66
|
opacity: shadersettings.ambient_light * 0.4
|
||||||
gradient: Gradient{
|
gradient: Gradient{
|
||||||
GradientStop{position: 0.0; color: "white"}
|
GradientStop{position: 0.0; color: "white"}
|
||||||
GradientStop{position: 0.7; color: "#00000000"}
|
GradientStop{position: 0.7; color: "#00000000"}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user