mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-02-20 20:09:14 +00:00
Terminal size and texture sizes are now comparable. Fixed formula for coordinates conversion: mouse input is now pixel perfect.
This commit is contained in:
parent
2dbe129857
commit
1be7987abe
@ -26,6 +26,18 @@ import org.crt.konsole 0.1
|
||||
|
||||
Item{
|
||||
id: terminalContainer
|
||||
|
||||
//Frame displacement properties. This makes the terminal the same size of the texture.
|
||||
property real dtop: frame.item.displacementTop
|
||||
property real dleft:frame.item.displacementLeft
|
||||
property real dright: frame.item.displacementRight
|
||||
property real dbottom: frame.item.displacementBottom
|
||||
|
||||
anchors.leftMargin: dleft
|
||||
anchors.rightMargin: dright
|
||||
anchors.topMargin: dtop
|
||||
anchors.bottomMargin: dbottom
|
||||
|
||||
property variant theSource: mBlur !== 0 ? blurredSourceLoader.item : kterminalSource
|
||||
property variant bloomSource: bloomSourceLoader.item
|
||||
property variant rasterizationSource: rasterizationEffectSource
|
||||
@ -142,19 +154,10 @@ Item{
|
||||
kterminal.mouseMoveEvent(coord, mouse.button, mouse.buttons, mouse.modifiers);
|
||||
}
|
||||
|
||||
//Frame displacement properties
|
||||
property real dtop: frame.item.displacementTop
|
||||
property real dleft:frame.item.displacementLeft
|
||||
property real dright: frame.item.displacementRight
|
||||
property real dbottom: frame.item.displacementBottom
|
||||
|
||||
function correctDistortion(x, y){
|
||||
x = x / width;
|
||||
y = y / height;
|
||||
|
||||
x = (-dleft + x * (width + dleft + dright)) / width
|
||||
y = (-dtop + y * (height + dtop + dbottom)) / height
|
||||
|
||||
var cc = Qt.size(0.5 - x, 0.5 - y);
|
||||
var distortion = (cc.height * cc.height + cc.width * cc.width) * shadersettings.screen_distortion;
|
||||
|
||||
|
@ -104,8 +104,8 @@ ShaderEffect {
|
||||
uniform lowp float horizontal_sincronization;" : "") +
|
||||
"
|
||||
void main() {
|
||||
qt_TexCoord0.x = -disp_left + qt_MultiTexCoord0.x * (1.0 + disp_left + disp_right);
|
||||
qt_TexCoord0.y = -disp_top + qt_MultiTexCoord0.y * (1.0 + disp_top + disp_bottom);
|
||||
qt_TexCoord0.x = (qt_MultiTexCoord0.x - disp_left) / (1.0 - disp_left - disp_right);
|
||||
qt_TexCoord0.y = (qt_MultiTexCoord0.y - disp_top) / (1.0 - disp_top - disp_bottom);
|
||||
vec2 coords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0)));" +
|
||||
(brightness_flickering !== 0.0 ? "
|
||||
brightness = 1.0 + (texture2D(randomFunctionSource, coords).g - 0.5) * brightness_flickering;"
|
||||
|
Loading…
x
Reference in New Issue
Block a user