1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2024-10-16 15:43:36 +01:00
cool-retro-term/app/frames/utils/TerminalFrame.qml

78 lines
2.1 KiB
QML
Raw Normal View History

import QtQuick 2.2
Item{
id: framecontainer
2014-07-09 18:03:02 +01:00
property int textureWidth
property int textureHeight
property int addedWidth
property int addedHeight
property int borderLeft
property int borderRight
property int borderTop
property int borderBottom
property string imageSource
property string normalsSource
2013-12-25 17:02:02 +00:00
property rect sourceRect
property string shaderString
2014-04-20 21:59:46 +01:00
//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.
property real displacementLeft
property real displacementTop
property real displacementRight
property real displacementBottom
property real distortionCoefficient
BorderImage{
id: frameimage
anchors.centerIn: parent
2014-07-09 18:03:02 +01:00
width: textureWidth + addedWidth
height: textureHeight + addedHeight
border.bottom: borderBottom
border.top: borderTop
border.left: borderLeft
border.right: borderRight
source: imageSource
horizontalTileMode: BorderImage.Stretch
verticalTileMode: BorderImage.Stretch
}
BorderImage{
id: framenormals
anchors.fill: frameimage
border.bottom: borderBottom
border.top: borderTop
border.left: borderLeft
border.right: borderRight
source: normalsSource
horizontalTileMode: BorderImage.Stretch
verticalTileMode: BorderImage.Stretch
}
ShaderEffectSource{
id: framesource
sourceItem: frameimage
hideSource: true
2014-07-09 18:03:02 +01:00
textureSize: Qt.size(parent.width, parent.height)
}
ShaderEffectSource{
id: framesourcenormals
sourceItem: framenormals
hideSource: true
2014-07-09 18:03:02 +01:00
textureSize: Qt.size(parent.width, parent.height)
}
Loader{
2014-07-09 18:03:02 +01:00
anchors.centerIn: parent
width: parent.width + (addedWidth / textureWidth) * parent.width
height: parent.height + (addedHeight / textureHeight) * parent.height
source: shaderString
}
}