mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-10-31 23:22:17 +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:
		| @@ -26,6 +26,18 @@ import org.crt.konsole 0.1 | |||||||
|  |  | ||||||
| Item{ | Item{ | ||||||
|     id: terminalContainer |     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 theSource: mBlur !== 0 ? blurredSourceLoader.item : kterminalSource | ||||||
|     property variant bloomSource: bloomSourceLoader.item |     property variant bloomSource: bloomSourceLoader.item | ||||||
|     property variant rasterizationSource: rasterizationEffectSource |     property variant rasterizationSource: rasterizationEffectSource | ||||||
| @@ -142,19 +154,10 @@ Item{ | |||||||
|             kterminal.mouseMoveEvent(coord, mouse.button, mouse.buttons, mouse.modifiers); |             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){ |         function correctDistortion(x, y){ | ||||||
|             x = x / width; |             x = x / width; | ||||||
|             y = y / height; |             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 cc = Qt.size(0.5 - x, 0.5 - y); | ||||||
|             var distortion = (cc.height * cc.height + cc.width * cc.width) * shadersettings.screen_distortion; |             var distortion = (cc.height * cc.height + cc.width * cc.width) * shadersettings.screen_distortion; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -104,8 +104,8 @@ ShaderEffect { | |||||||
|             uniform lowp float horizontal_sincronization;" : "") + |             uniform lowp float horizontal_sincronization;" : "") + | ||||||
|         " |         " | ||||||
|         void main() { |         void main() { | ||||||
|             qt_TexCoord0.x = -disp_left + qt_MultiTexCoord0.x * (1.0 + disp_left + disp_right); |             qt_TexCoord0.x = (qt_MultiTexCoord0.x - disp_left) / (1.0 - disp_left - disp_right); | ||||||
|             qt_TexCoord0.y = -disp_top + qt_MultiTexCoord0.y * (1.0 + disp_top + disp_bottom); |             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)));" + |             vec2 coords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0)));" + | ||||||
|             (brightness_flickering !== 0.0 ? " |             (brightness_flickering !== 0.0 ? " | ||||||
|                 brightness = 1.0 + (texture2D(randomFunctionSource, coords).g - 0.5) * brightness_flickering;" |                 brightness = 1.0 + (texture2D(randomFunctionSource, coords).g - 0.5) * brightness_flickering;" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user