1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-02-21 20:39:00 +00:00

Some cleanups.

This commit is contained in:
Filippo Scognamiglio 2014-07-12 01:51:53 +02:00
parent 009f2dd998
commit a96f8ec220
6 changed files with 41 additions and 147 deletions

View File

@ -346,6 +346,7 @@ Item{
} }
// RASTERIZATION ////////////////////////////////////////////////////////// // RASTERIZATION //////////////////////////////////////////////////////////
ShaderEffect{ ShaderEffect{
id: rasterizationContainer id: rasterizationContainer
width: frame.sourceRect.width width: frame.sourceRect.width

View File

@ -56,6 +56,25 @@ ShaderEffect {
blending: false blending: false
//Smooth random texture used for flickering effect.
Image{
id: randtexture
source: "frames/images/randfunction.png"
width: 512
height: 512
sourceSize.width: 512
sourceSize.height: 256
fillMode: Image.TileVertically
}
ShaderEffectSource{
id: randfuncsource
sourceItem: randtexture
live: false
hideSource: true
wrapMode: ShaderEffectSource.Repeat
}
//Print the number with a reasonable precision for the shader.
function str(num){ function str(num){
return num.toFixed(8); return num.toFixed(8);
} }

View File

@ -21,18 +21,19 @@
import QtQuick 2.2 import QtQuick 2.2
Timer{ Timer{
default property bool enableTimer: false
property real time property real time
NumberAnimation on time { NumberAnimation on time {
from: 0 from: 0
to: 100000 to: 100000
running: shadersettings.fps === 0 running: shadersettings.fps === 0 && enableTimer
duration: 100000 duration: 100000
loops: Animation.Infinite loops: Animation.Infinite
} }
onTriggered: time += interval onTriggered: time += interval
running: shadersettings.fps !== 0 running: shadersettings.fps !== 0 && enableTimer
interval: Math.round(1000 / shadersettings.fps) interval: Math.round(1000 / shadersettings.fps)
repeat: true repeat: true
} }

View File

@ -1,108 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.0.1, 2014-07-11T01:25:32. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{821020a0-a534-46a2-aed8-40a3bc73356b}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">-1</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="int" key="PE.EnvironmentAspect.Base">0</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes">
<value type="QString">QML_DISABLE_OPTIMIZER=1</value>
<value type="QString">&lt;VARIABLE&gt;=&lt;VALUE&gt;</value>
</valuelist>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">QML Scene</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmlProjectManager.QmlRunConfiguration.QmlScene</value>
<value type="QString" key="QmlProjectManager.QmlRunConfiguration.MainScript">CurrentFile</value>
<value type="QString" key="QmlProjectManager.QmlRunConfiguration.QDeclarativeViewerArguments"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
<value type="QByteArray">{ce9500eb-fe4b-414b-b912-5f93dee048a3}</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">15</value>
</data>
</qtcreator>

View File

@ -2,8 +2,8 @@ import QtQuick 2.2
Item{ Item{
id: framecontainer id: framecontainer
property int textureWidth property int textureWidth: terminalWindow.width
property int textureHeight property int textureHeight: terminalWindow.height
property int addedWidth property int addedWidth
property int addedHeight property int addedHeight
@ -13,7 +13,6 @@ Item{
property int borderBottom property int borderBottom
property string imageSource property string imageSource
property string normalsSource property string normalsSource
property rect sourceRect
property string shaderString property string shaderString
//Value used to create the rect used to add the border to the texture //Value used to create the rect used to add the border to the texture
@ -28,6 +27,11 @@ Item{
property real distortionCoefficient property real distortionCoefficient
property rect sourceRect: Qt.rect(-rectX * shadersettings.window_scaling,
-rectY * shadersettings.window_scaling,
terminal.width + 2*rectX * shadersettings.window_scaling,
terminal.height + 2*rectY * shadersettings.window_scaling)
BorderImage{ BorderImage{
id: frameimage id: frameimage
anchors.centerIn: parent anchors.centerIn: parent

View File

@ -27,15 +27,16 @@ import org.kde.konsole 0.1
ApplicationWindow{ ApplicationWindow{
id: terminalWindow id: terminalWindow
width: 1024 width: 1024
height: 768 height: 768
minimumWidth: 320 minimumWidth: 320
minimumHeight: 240 minimumHeight: 240
property bool fullscreen: shadersettings.fullscreen
onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed)
title: qsTr("cool-old-term") title: qsTr("cool-old-term")
visible: true
visibility: shadersettings.fullscreen ? Window.FullScreen : Window.Windowed
Action { Action {
id: fullscreenAction id: fullscreenAction
@ -90,11 +91,13 @@ ApplicationWindow{
MenuItem {action: fullscreenAction} MenuItem {action: fullscreenAction}
} }
} }
ApplicationSettings{ ApplicationSettings{
id: shadersettings id: shadersettings
} }
TimeManager{
id: timeManager
enableTimer: terminalWindow.visible
}
Item{ Item{
id: maincontainer id: maincontainer
anchors.centerIn: parent anchors.centerIn: parent
@ -106,38 +109,12 @@ ApplicationWindow{
Loader{ Loader{
id: frame id: frame
property rect sourceRect: Qt.rect(-item.rectX * shadersettings.window_scaling,
-item.rectY * shadersettings.window_scaling,
terminal.width + 2*item.rectX * shadersettings.window_scaling,
terminal.height + 2*item.rectY * shadersettings.window_scaling)
anchors.fill: parent anchors.fill: parent
property rect sourceRect: item.sourceRect
z: 2.1 z: 2.1
source: shadersettings.frame_source source: shadersettings.frame_source
opacity: 1.0
onLoaded: {
item.textureWidth = Qt.binding(function() { return terminalWindow.width;})
item.textureHeight = Qt.binding(function () {return terminalWindow.height;})
console.log(terminalWindow.width);
}
}
Image{
id: randtexture
source: "frames/images/randfunction.png"
width: 512
height: 512
sourceSize.width: 512
sourceSize.height: 256
fillMode: Image.TileVertically
}
ShaderEffectSource{
id: randfuncsource
sourceItem: randtexture
live: false
hideSource: true
wrapMode: ShaderEffectSource.Repeat
}
TimeManager{
id: timeManager
} }
PreprocessedTerminal{ PreprocessedTerminal{
id: terminal id: terminal