mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-11-04 09:02:14 +00:00 
			
		
		
		
	Added lightly smoothed black frame around the screen.
This commit is contained in:
		
							
								
								
									
										13
									
								
								app/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								app/main.cpp
									
									
									
									
									
								
							@@ -10,9 +10,15 @@
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
QString getNamedArgument(QStringList args, QString name) {
 | 
			
		||||
QString getNamedArgument(QStringList args, QString name, QString defaultName)
 | 
			
		||||
{
 | 
			
		||||
    int index = args.indexOf(name);
 | 
			
		||||
    return (index != -1) ? args[index + 1] : QString("");
 | 
			
		||||
    return (index != -1) ? args[index + 1] : QString(defaultName);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString getNamedArgument(QStringList args, QString name)
 | 
			
		||||
{
 | 
			
		||||
    return getNamedArgument(args, name, "");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int main(int argc, char *argv[])
 | 
			
		||||
@@ -34,13 +40,12 @@ int main(int argc, char *argv[])
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    engine.rootContext()->setContextProperty("workdir", getNamedArgument(args, "--workdir"));
 | 
			
		||||
    engine.rootContext()->setContextProperty("workdir", getNamedArgument(args, "--workdir", "$HOME"));
 | 
			
		||||
    engine.rootContext()->setContextProperty("shellProgram", getNamedArgument(args, "--program"));
 | 
			
		||||
 | 
			
		||||
    // Manage import paths for Linux and OSX.
 | 
			
		||||
    QStringList importPathList = engine.importPathList();
 | 
			
		||||
    importPathList.prepend(QCoreApplication::applicationDirPath() + "/qmltermwidget");
 | 
			
		||||
    //importPathList.prepend(QCoreApplication::applicationDirPath() + "/imports/");
 | 
			
		||||
    importPathList.prepend(QCoreApplication::applicationDirPath() + "/../PlugIns");
 | 
			
		||||
    engine.setImportPathList(importPathList);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -380,6 +380,9 @@ Item{
 | 
			
		||||
        id: rasterizationEffect
 | 
			
		||||
        width: parent.width
 | 
			
		||||
        height: parent.height
 | 
			
		||||
        property real outColor: 0.0
 | 
			
		||||
        property real dispX: 5 / width
 | 
			
		||||
        property real dispY: 5 / height
 | 
			
		||||
        property size virtual_resolution: Qt.size(kterminal.width, kterminal.height)
 | 
			
		||||
 | 
			
		||||
        blending: false
 | 
			
		||||
@@ -389,6 +392,9 @@ Item{
 | 
			
		||||
 | 
			
		||||
            "varying highp vec2 qt_TexCoord0;
 | 
			
		||||
             uniform highp vec2 virtual_resolution;
 | 
			
		||||
             uniform highp float dispX;
 | 
			
		||||
             uniform highp float dispY;
 | 
			
		||||
             uniform mediump float outColor;
 | 
			
		||||
 | 
			
		||||
             highp float getScanlineIntensity(vec2 coords) {
 | 
			
		||||
                 highp float result = 1.0;" +
 | 
			
		||||
@@ -407,6 +413,11 @@ Item{
 | 
			
		||||
                "float distance = length(vec2(0.5) - qt_TexCoord0);" +
 | 
			
		||||
                "color = mix(color, 0.0, 1.2 * distance * distance);" +
 | 
			
		||||
 | 
			
		||||
                "color *= outColor + smoothstep(0.00, dispX, qt_TexCoord0.x) * (1.0 - outColor);" +
 | 
			
		||||
                "color *= outColor + smoothstep(0.00, dispY, qt_TexCoord0.y) * (1.0 - outColor);" +
 | 
			
		||||
                "color *= outColor + (1.0 - smoothstep(1.00 - dispX, 1.00, qt_TexCoord0.x)) * (1.0 - outColor);" +
 | 
			
		||||
                "color *= outColor + (1.0 - smoothstep(1.00 - dispY, 1.00, qt_TexCoord0.y)) * (1.0 - outColor);" +
 | 
			
		||||
 | 
			
		||||
                "gl_FragColor.a = color;" +
 | 
			
		||||
            "}"
 | 
			
		||||
 | 
			
		||||
@@ -417,6 +428,6 @@ Item{
 | 
			
		||||
        sourceItem: rasterizationEffect
 | 
			
		||||
        hideSource: true
 | 
			
		||||
        smooth: true
 | 
			
		||||
        wrapMode: ShaderEffectSource.Repeat
 | 
			
		||||
        wrapMode: ShaderEffectSource.ClampToEdge
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -223,7 +223,7 @@ ShaderEffect {
 | 
			
		||||
            "float color = 0.0;" +
 | 
			
		||||
 | 
			
		||||
            (noise_strength !== 0 ? "
 | 
			
		||||
                float noiseVal = texture2D(noiseSource, qt_TexCoord0 + vec2(fract(time / 51.0), fract(time / 237.0))).a;
 | 
			
		||||
                float noiseVal = texture2D(noiseSource, coords + vec2(fract(time / 51.0), fract(time / 237.0))).a;
 | 
			
		||||
                color += noiseVal * noise * (1.0 - distance * 1.3);" : "") +
 | 
			
		||||
 | 
			
		||||
            (glowing_line_strength !== 0 ? "
 | 
			
		||||
 
 | 
			
		||||
@@ -1,23 +0,0 @@
 | 
			
		||||
import QtQuick 2.2
 | 
			
		||||
 | 
			
		||||
ShaderEffect{
 | 
			
		||||
    property variant source: framesource
 | 
			
		||||
    property real screen_distorsion: shadersettings.screen_distortion
 | 
			
		||||
 | 
			
		||||
    fragmentShader: "
 | 
			
		||||
        uniform sampler2D source;
 | 
			
		||||
        uniform highp float screen_distorsion;
 | 
			
		||||
        varying highp vec2 qt_TexCoord0;
 | 
			
		||||
 | 
			
		||||
        vec2 distortCoordinates(vec2 coords){
 | 
			
		||||
            vec2 cc = coords - vec2(0.5);
 | 
			
		||||
            float dist = dot(cc, cc) * screen_distorsion;
 | 
			
		||||
            return (coords + cc * (1.0 + dist) * dist);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        void main(){
 | 
			
		||||
            vec2 coords = distortCoordinates(qt_TexCoord0);
 | 
			
		||||
            float inside = texture2D(source, coords).a;
 | 
			
		||||
            gl_FragColor = vec4(vec3(0.0), inside);
 | 
			
		||||
        }"
 | 
			
		||||
}
 | 
			
		||||
@@ -11,7 +11,6 @@
 | 
			
		||||
        <file>frames/images/screen-frame-original.png</file>
 | 
			
		||||
        <file>frames/WhiteSimpleFrame.qml</file>
 | 
			
		||||
        <file>frames/utils/FrameShader.qml</file>
 | 
			
		||||
        <file>frames/utils/NoFrameShader.qml</file>
 | 
			
		||||
        <file>frames/utils/TerminalFrame.qml</file>
 | 
			
		||||
        <file>SizeOverlay.qml</file>
 | 
			
		||||
        <file>ShaderTerminal.qml</file>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user