Commit e968fb03 authored by Georgiy Yankovskiy's avatar Georgiy Yankovskiy

Gamepad double click A/B fixes

parent 7456e9a5
...@@ -83,7 +83,7 @@ class App(QtCore.QObject): ...@@ -83,7 +83,7 @@ class App(QtCore.QObject):
# TODO parse product name # TODO parse product name
_icon = (os.path.isfile(_icon) and _icon _icon = (os.path.isfile(_icon) and _icon
or os.path.realpath(f"{Path(__file__).resolve().parent}../../../qml/images/PUBG.png")) or os.path.realpath(f"{Path(__file__).resolve().parent}../../../qml/images/PUBG.png"))
# Автозапуск игры: # Автозапуск игры:
# PW_GUI_DISABLED_CS=1 # PW_GUI_DISABLED_CS=1
...@@ -118,6 +118,7 @@ class App(QtCore.QObject): ...@@ -118,6 +118,7 @@ class App(QtCore.QObject):
@Slot(str) @Slot(str)
def start_game(self, exec): def start_game(self, exec):
self.game_started.emit(True) self.game_started.emit(True)
def run_in_thread(t, _exec): def run_in_thread(t, _exec):
t.running_game_process = subprocess.Popen( t.running_game_process = subprocess.Popen(
_exec, _exec,
......
...@@ -21,13 +21,13 @@ Rectangle { ...@@ -21,13 +21,13 @@ Rectangle {
onVisibleChanged: { onVisibleChanged: {
tabButtons.changeButtonActiveTab(tabs.activeButtonTab); tabButtons.changeButtonActiveTab(tabs.activeButtonTab);
tabButtons.x = tabButtons.tempX; tabButtons.x = tabButtons.tempX;
console.log("tabButtons.x = " + tabButtons.x); // console.log("tabButtons.x = " + tabButtons.x);
} }
Component.onCompleted: { Component.onCompleted: {
tabButtons.changeButtonActiveTab(tabs.activeButtonTab); tabButtons.changeButtonActiveTab(tabs.activeButtonTab);
tabButtons.x = tabButtons.tempX; tabButtons.x = tabButtons.tempX;
console.log("Tabs completed!"); // console.log("Tabs completed!");
} }
onWidthChanged: function(){ onWidthChanged: function(){
tabButtons.changeButtonActiveTab(tabs.activeButtonTab); tabButtons.changeButtonActiveTab(tabs.activeButtonTab);
...@@ -39,13 +39,14 @@ Rectangle { ...@@ -39,13 +39,14 @@ Rectangle {
} }
// Кнопки навигации // Кнопки навигации
ColumnLayout{ ColumnLayout {
id:topNavigation id: topNavigation
width: parent.width width: parent.width
Rectangle{
Rectangle {
width: parent.width width: parent.width
height: buttonSystemManagement.height height: buttonSystemManagement.height
color:"#00000000" color: "#00000000"
Layout.bottomMargin: buttonSystemManagement.height / 2 Layout.bottomMargin: buttonSystemManagement.height / 2
Layout.topMargin: buttonSystemManagement.height / 3 Layout.topMargin: buttonSystemManagement.height / 3
...@@ -70,11 +71,11 @@ Rectangle { ...@@ -70,11 +71,11 @@ Rectangle {
Component.onCompleted: { Component.onCompleted: {
tabButtons.changeButtonActiveTab(tabs.activeButtonTab); tabButtons.changeButtonActiveTab(tabs.activeButtonTab);
tabButtons.x = tabButtons.tempX; tabButtons.x = tabButtons.tempX;
console.log("tabButtons completed!"); // console.log("tabButtons completed!");
} }
x: 0
x:0
// Состояния // Состояния
states: [ states: [
State { State {
...@@ -82,7 +83,7 @@ Rectangle { ...@@ -82,7 +83,7 @@ Rectangle {
when: tabButtons.toggle; when: tabButtons.toggle;
PropertyChanges { PropertyChanges {
target: tabButtons; target: tabButtons;
x:tempX x: tempX
} }
}, },
State { State {
...@@ -104,6 +105,7 @@ Rectangle { ...@@ -104,6 +105,7 @@ Rectangle {
easing.type: Easing.InOutCirc easing.type: Easing.InOutCirc
} }
} }
// Функция перемещения кнопок // Функция перемещения кнопок
// TODO: OPTIMIZE (REDUCE EXTRA FOR LOOP) // TODO: OPTIMIZE (REDUCE EXTRA FOR LOOP)
function changeButtonActiveTab(ButtonId){ function changeButtonActiveTab(ButtonId){
...@@ -213,11 +215,31 @@ Rectangle { ...@@ -213,11 +215,31 @@ Rectangle {
anchors.leftMargin: 0 anchors.leftMargin: 0
anchors.bottomMargin: 90 anchors.bottomMargin: 90
Rectangle { color: "red"; width: 50; height: 50 } Rectangle {
Rectangle { color: "green"; width: 20; height: 50 } color: "red";
Rectangle { color: "blue"; width: 50; height: 20 } width: 50;
Rectangle { color: "cyan"; width: 50; height: 50 } height: 50;
Rectangle { color: "magenta"; width: 10; height: 10 } }
Rectangle {
color: "green";
width: 20;
height: 50;
}
Rectangle {
color: "blue";
width: 50;
height: 20;
}
Rectangle {
color: "cyan";
width: 50;
height: 50;
}
Rectangle {
color: "magenta";
width: 10;
height: 10;
}
} }
// Сетка игр // Сетка игр
...@@ -229,8 +251,8 @@ Rectangle { ...@@ -229,8 +251,8 @@ Rectangle {
ScrollBar.vertical: ScrollBar { ScrollBar.vertical: ScrollBar {
id: scrolV; id: scrolV;
height: parent.height height: parent.height
opacity:0 opacity: 0
position:0 position: 0
property double fromAnim: 0.0 property double fromAnim: 0.0
property double toAnim: 0.0 property double toAnim: 0.0
...@@ -238,8 +260,8 @@ Rectangle { ...@@ -238,8 +260,8 @@ Rectangle {
function scrollToY(y,HItem) { function scrollToY(y,HItem) {
scrolV.fromAnim = scrolV.position scrolV.fromAnim = scrolV.position
scrolV.position = (1.0 - scrolV.size) * y/gamesScroller.height scrolV.position = (1.0 - scrolV.size) * y / gamesScroller.height
scrolV.toAnim = (1.0 - scrolV.size) * y/gamesScroller.height scrolV.toAnim = (1.0 - scrolV.size) * y / gamesScroller.height
if(scrolV.toAnim != scrolV.fromAnim) if(scrolV.toAnim != scrolV.fromAnim)
scrollAnimation.start() scrollAnimation.start()
} }
...@@ -290,13 +312,8 @@ Rectangle { ...@@ -290,13 +312,8 @@ Rectangle {
/ gamesGrid.columns / gamesGrid.columns
Layout.preferredHeight: Layout.preferredWidth / 2 * 3 Layout.preferredHeight: Layout.preferredWidth / 2 * 3
// Component.onCompleted: {a3.start()} // Component.onCompleted: {a3.start()}
// SequentialAnimation { // SequentialAnimation {
// id:a3 // id:a3
...@@ -317,11 +334,7 @@ Rectangle { ...@@ -317,11 +334,7 @@ Rectangle {
// loops: Animation.Infinite // loops: Animation.Infinite
// } // }
// Layout.topMargin: Layout.preferredHeight
//Layout.topMargin: Layout.preferredHeight
} }
} }
...@@ -340,7 +353,7 @@ Rectangle { ...@@ -340,7 +353,7 @@ Rectangle {
return [ return [
buttonSystemManagement, buttonSystemManagement,
buttonGames, buttonGames,
testbut1, // testbut1,
testbut2 testbut2
]; ];
} }
...@@ -380,29 +393,27 @@ Rectangle { ...@@ -380,29 +393,27 @@ Rectangle {
// c[tabs.focusedItems].clicked(); // c[tabs.focusedItems].clicked();
} }
Connections { function onGamepadClickedLB(done){
target: core_app if(window.scene !== S.homeScene) return;
function onGamepadClickedLB(done){ tabs.applyTabsFocus(-1)
if(window.scene !== S.homeScene) return; }
tabs.applyTabsFocus(-1) function onGamepadClickedRB(done){
} if(window.scene !== S.homeScene) return;
function onGamepadClickedRB(done){ tabs.applyTabsFocus(1)
if(window.scene !== S.homeScene) return; }
tabs.applyTabsFocus(1) function onGamepadAxisLeft(done){
} if(window.scene !== S.homeScene) return;
function onGamepadAxisLeft(done){ tabs.applyItemsFocus(-1)
if(window.scene !== S.homeScene) return; }
tabs.applyItemsFocus(-1) function onGamepadAxisRight(done){
} if(window.scene !== S.homeScene) return;
function onGamepadAxisRight(done){ tabs.applyItemsFocus(1)
if(window.scene !== S.homeScene) return; }
tabs.applyItemsFocus(1) function onGamepadClickedApply(done){
} if(window.scene !== S.homeScene) return;
function onGamepadClickedApply(done){ // console.log("onGamepadClickedApply");
if(window.scene !== S.homeScene) return; let c = gamesGrid.children;
let c = gamesGrid.children; c[tabs.focusedItems].press();
c[tabs.focusedItems].press();
}
} }
} }
......
import QtQuick import QtQuick
import QtQuick.Controls as C import QtQuick.Controls as C
C.Button { C.Button {
id: root id: root
property bool isActive: false property bool isActive: false
...@@ -28,9 +26,11 @@ C.Button { ...@@ -28,9 +26,11 @@ C.Button {
color: 'white' color: 'white'
opacity: 0.8 opacity: 0.8
} }
background.opacity: 0.0 background.opacity: 0.0
background.anchors.margins: 0 background.anchors.margins: 0
Rectangle{
Rectangle {
id: line id: line
color: 'white' color: 'white'
height: 2 height: 2
...@@ -38,14 +38,14 @@ C.Button { ...@@ -38,14 +38,14 @@ C.Button {
anchors.horizontalCenter: root.horizontalCenter anchors.horizontalCenter: root.horizontalCenter
anchors.top: root.top anchors.top: root.top
// anchors.bottom:root.bottom // anchors.bottom:root.bottom
} }
// Состояния // Состояния
states: [ states: [
// Карточка в фокуске // Карточка в фокуске
State { State {
name: "active"; when: isActive name: "active";
when: isActive
PropertyChanges { PropertyChanges {
target: line; target: line;
width: parent.width; width: parent.width;
...@@ -61,7 +61,8 @@ C.Button { ...@@ -61,7 +61,8 @@ C.Button {
}, },
// На карточку навели курсор мыши // На карточку навели курсор мыши
State { State {
name: "hover"; when: hovered && !isActive name: "hover";
when: hovered && !isActive
//PropertyChanges { target: line; width: parent.width;} //PropertyChanges { target: line; width: parent.width;}
PropertyChanges { PropertyChanges {
target: text; target: text;
...@@ -78,7 +79,8 @@ C.Button { ...@@ -78,7 +79,8 @@ C.Button {
id:activeAnim id:activeAnim
ParallelAnimation { ParallelAnimation {
NumberAnimation { NumberAnimation {
target: line; property: "width" target: line;
property: "width"
duration: 200 duration: 200
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
...@@ -91,11 +93,13 @@ C.Button { ...@@ -91,11 +93,13 @@ C.Button {
}, },
Transition { Transition {
from: ""; to: "hover" from: "";
to: "hover"
reversible: true reversible: true
ParallelAnimation { ParallelAnimation {
NumberAnimation{ NumberAnimation {
target: line; property: "width" target: line;
property: "width"
duration: 200 duration: 200
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
......
...@@ -19,23 +19,28 @@ C.Button { ...@@ -19,23 +19,28 @@ C.Button {
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
acceptedButtons: "AllButtons" acceptedButtons: "AllButtons"
onClicked: function(){ onClicked: function() {
if(!game.visible) return;
game.press(); game.press();
} }
} }
function press(){ function press(){
if(!visible) return; if(!game.visible) return;
if(window.scene !== SceneConstants.homeScene) return;
// console.log("GAME CLICKED " + game.gameTitle);
gameInfoScene.title = game.gameTitle; gameInfoScene.title = game.gameTitle;
gameInfoScene.icon = game.gameIcon; gameInfoScene.icon = game.gameIcon;
gameInfoScene.exec = game.gameExec; gameInfoScene.exec = game.gameExec;
var globalCoordinates = mapToItem(null,0,0)
console.log("game coord - X: " + globalCoordinates.x + " y: " + globalCoordinates.y) let globalCoordinates = mapToItem(null, 0, 0)
// console.log("game coord - X: " + globalCoordinates.x + " y: " + globalCoordinates.y)
gameInfoScene.startX = globalCoordinates.x gameInfoScene.startX = globalCoordinates.x
gameInfoScene.startY = globalCoordinates.y gameInfoScene.startY = globalCoordinates.y
gameInfoScene.imgWight = game.width*1.05 gameInfoScene.imgWight = game.width * 1.05
gameInfoScene.imgHight = game.height*1.05 gameInfoScene.imgHight = game.height * 1.05
window.scene = SceneConstants.gameInfoScene; window.scene = SceneConstants.gameInfoScene;
gameInfoScene.startAnimation() gameInfoScene.startAnimation()
...@@ -46,8 +51,8 @@ C.Button { ...@@ -46,8 +51,8 @@ C.Button {
// //
background: Rectangle { background: Rectangle {
id: rect id: rect
width:game.width + border.width *2 width: game.width + border.width * 2
height:game.height + border.width*2 height: game.height + border.width * 2
opacity: 1.0 opacity: 1.0
color: "#000000" color: "#000000"
...@@ -61,16 +66,33 @@ C.Button { ...@@ -61,16 +66,33 @@ C.Button {
states: [ states: [
// Карточка в фокуске // Карточка в фокуске
State { State {
name: "focus"; when: game.activeFocus name: "focus";
PropertyChanges { target: rect; border.width: Math.max(game.width / 100 * 2 ,2);} when: game.activeFocus
PropertyChanges { target: game; scale:1.05 } PropertyChanges {
PropertyChanges { target: bgNameGrad; opacity:1 } target: rect;
border.width: Math.max(game.width / 100 * 2, 2);
}
PropertyChanges {
target: game;
scale: 1.05;
}
PropertyChanges {
target: bgNameGrad;
opacity: 1;
}
}, },
// На карточку навели курсор мыши // На карточку навели курсор мыши
State { State {
name: "hover"; when: hoverArea.containsMouse name: "hover";
PropertyChanges { target: game; scale:1.05 } when: hoverArea.containsMouse
PropertyChanges { target: bgNameGrad; opacity:1 } PropertyChanges {
target: game;
scale: 1.05;
}
PropertyChanges {
target: bgNameGrad;
opacity: 1;
}
} }
] ]
...@@ -81,12 +103,12 @@ C.Button { ...@@ -81,12 +103,12 @@ C.Button {
from: ""; from: "";
to: "focus"; to: "focus";
reversible: false; reversible: false;
SequentialAnimation { SequentialAnimation {
NumberAnimation{ NumberAnimation {
target: rect; target: rect;
property: "border.width" property: "border.width"
duration: 100 duration: 100
to: Math.max(game.width / 100 * 4,4) // пока x не будет равно 250 to: Math.max(game.width / 100 * 4, 4) // пока x не будет равно 250
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
NumberAnimation { NumberAnimation {
...@@ -183,7 +205,7 @@ C.Button { ...@@ -183,7 +205,7 @@ C.Button {
Rectangle { Rectangle {
id: rectangleMask id: rectangleMask
anchors.fill: parent anchors.fill: parent
radius: 1.5*height radius: 1.5 * height
visible: false visible: false
} }
} }
...@@ -8,42 +8,60 @@ import "constants/scene.js" as SceneConstants ...@@ -8,42 +8,60 @@ import "constants/scene.js" as SceneConstants
Window { Window {
property string scene: SceneConstants.homeScene property string scene: SceneConstants.homeScene
Loader{ Loader {
id : ld id: ld
anchors.fill: parent; anchors.fill: parent;
}
FontLoader {
id: globalFont;
source: "./fonts/OpenSans-VariableFont_wdth.ttf"
} }
FontLoader { id: globalFont; source: "./fonts/OpenSans-VariableFont_wdth.ttf" }
Connections { Connections {
target: core_app target: core_app
function onGameStarted(done) { function onGameStarted(done) {
console.log("core_app: gameStarted"); // console.log("core_app: gameStarted");
window.scene = SceneConstants.runningScene; window.scene = SceneConstants.runningScene;
} }
function onGameEnded(done) { function onGameEnded(done) {
console.log("core_app: gameEnded"); // console.log("core_app: gameEnded");
window.scene = SceneConstants.gameInfoScene; window.scene = SceneConstants.gameInfoScene;
} }
function onGamepadClickedLB(done){ function onGamepadClickedLB(done){
// console.log("core_app: onGamepadClickedLB"); window._trigger("onGamepadClickedLB", done);
} }
function onGamepadClickedRB(done){ function onGamepadClickedRB(done){
// console.log("core_app: onGamepadClickedRB"); window._trigger("onGamepadClickedRB", done);
} }
function onGamepadAxisLeft(done){ function onGamepadAxisLeft(done){
// console.log("core_app: onGamepadAxisLeft"); window._trigger("onGamepadAxisLeft", done);
} }
function onGamepadAxisRight(done){ function onGamepadAxisRight(done){
// console.log("core_app: onGamepadAxisRight"); window._trigger("onGamepadAxisRight", done);
} }
function onGamepadClickedApply(done){ function onGamepadClickedApply(done){
// console.log("core_app: onGamepadClickedApply"); window._trigger("onGamepadClickedApply", done);
}
function onGamepadClickedBack(done){
window._trigger("onGamepadClickedBack", done);
} }
} }
function _trigger(_method, ...args){
let scenes = {};
scenes[SceneConstants.homeScene] = homeScene;
scenes[SceneConstants.gameInfoScene] = gameInfoScene;
scenes[SceneConstants.runningScene] = runningScene;
let d = scenes[scene];
if(d !== null && d[_method] !== undefined && d[_method] !== null)
d[_method](args);
}
Component.onDestruction: { Component.onDestruction: {
console.log("Desctructing window"); // console.log("Desctructing window");
} }
id: window id: window
......
...@@ -25,15 +25,15 @@ Rectangle { ...@@ -25,15 +25,15 @@ Rectangle {
property double imgHight: 0 property double imgHight: 0
function startAnimation(){ function startAnimation(){
startPos.x = startX
startPos.x = startX startPos.y = startY
startPos.y = startY gameRect.anchors.left = startPos.left
gameRect.anchors.left = startPos.left gameRect.anchors.top = startPos.top
gameRect.anchors.top = startPos.top runGameButton.focus = true
runGameButton.focus = true root.state = "completed"
root.state = "completed"
} }
states:[
states: [
State { State {
name: "finish" name: "finish"
AnchorChanges { AnchorChanges {
...@@ -46,7 +46,6 @@ Rectangle { ...@@ -46,7 +46,6 @@ Rectangle {
width: imgWight width: imgWight
height: imgHight height: imgHight
} }
}, },
State { State {
name: "completed" name: "completed"
...@@ -60,14 +59,14 @@ Rectangle { ...@@ -60,14 +59,14 @@ Rectangle {
width: finishPos.width width: finishPos.width
height: finishPos.height height: finishPos.height
} }
} }
] ]
transitions: Transition {
AnchorAnimation { duration: 300 }
}
transitions: Transition {
AnchorAnimation {
duration: 300
}
}
onVisibleChanged: function(){ onVisibleChanged: function(){
// if(visible){ // if(visible){
...@@ -86,11 +85,9 @@ Rectangle { ...@@ -86,11 +85,9 @@ Rectangle {
// anchors.fill:parent // anchors.fill:parent
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
anchors.fill:parent anchors.fill: parent
id: content id: content
anchors.leftMargin: parent.width / 100 * 3 anchors.leftMargin: parent.width / 100 * 3
anchors.rightMargin: parent.width / 100 * 3 anchors.rightMargin: parent.width / 100 * 3
anchors.topMargin: parent.height / 100 * 3 anchors.topMargin: parent.height / 100 * 3
...@@ -98,18 +95,17 @@ Rectangle { ...@@ -98,18 +95,17 @@ Rectangle {
spacing: 6 spacing: 6
ItemGroup{ ItemGroup{
id: topPanel id: topPanel
Button { Button {
id: back id: back
background.opacity: 0.0 background.opacity: 0.0
opacity: 0.8 opacity: 0.8
text:"Back" text: "Back"
width: text.contentWidth + backImg.width + 5 width: text.contentWidth + backImg.width + 5
hoverEnabled: true hoverEnabled: true
contentItem: Text { contentItem: Text {
id: text id: text
text: back.text text: back.text
font.pixelSize:Math.max(19,root.height / 100 * 3.2) font.pixelSize: Math.max(19, root.height / 100 * 3.2)
font.family: globalFont.font font.family: globalFont.font
font.weight: 500 font.weight: 500
...@@ -135,7 +131,8 @@ Rectangle { ...@@ -135,7 +131,8 @@ Rectangle {
states: [ states: [
// Карточка в фокуске // Карточка в фокуске
State { State {
name: "focus"; when: back.activeFocus name: "focus";
when: back.activeFocus
PropertyChanges { PropertyChanges {
target: back; target: back;
opacity: 1; opacity: 1;
...@@ -147,7 +144,8 @@ Rectangle { ...@@ -147,7 +144,8 @@ Rectangle {
}, },
// На карточку навели курсор мыши // На карточку навели курсор мыши
State { State {
name: "hover"; when: back.hovered name: "hover";
when: back.hovered
PropertyChanges { PropertyChanges {
target: back; target: back;
opacity: 1; opacity: 1;
...@@ -159,7 +157,7 @@ Rectangle { ...@@ -159,7 +157,7 @@ Rectangle {
//to: "focus" //to: "focus"
reversible: true reversible: true
NumberAnimation { NumberAnimation {
//target: back; // target: back;
property: "opacity"; property: "opacity";
duration: 100 duration: 100
} }
...@@ -186,16 +184,16 @@ Rectangle { ...@@ -186,16 +184,16 @@ Rectangle {
anchors.top: gameRect.parent.top anchors.top: gameRect.parent.top
anchors.leftMargin: root.width / 100 * 3 anchors.leftMargin: root.width / 100 * 3
anchors.topMargin: root.width / 100 * 3 anchors.topMargin: root.width / 100 * 3
width: height /3 * 2 //root.width / 100 * 20 width: height / 3 * 2 //root.width / 100 * 20
height: root.height / 2 //width / 2 * 3 height: root.height / 2 //width / 2 * 3
color:"#00000000" color: "#00000000"
} }
Rectangle{ Rectangle {
id:gameRect id: gameRect
width: imgWight width: imgWight
height: imgHight height: imgHight
color:"#000000" color: "#000000"
Image { Image {
id: gameImage id: gameImage
anchors.fill: parent anchors.fill: parent
...@@ -219,36 +217,28 @@ Rectangle { ...@@ -219,36 +217,28 @@ Rectangle {
} }
} }
RowLayout{ RowLayout {
id:info id: info
width: parent.width - finishPos.width - root.width / 100 * 6 width: parent.width - finishPos.width - root.width / 100 * 6
anchors.left: finishPos.right anchors.left: finishPos.right
anchors.top: finishPos.top anchors.top: finishPos.top
anchors.leftMargin: root.width / 100 * 3 anchors.leftMargin: root.width / 100 * 3
ColumnLayout{ ColumnLayout {
Layout.alignment: Qt.AlignLeft | Qt.AlignTop Layout.alignment: Qt.AlignLeft | Qt.AlignTop
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
spacing: 40 spacing: 40
Text { Text {
id: title id: title
Layout.maximumWidth: root.width / 100 * 30 Layout.maximumWidth: root.width / 100 * 30
font.weight: 600 font.weight: 600
wrapMode: Text.Wrap wrapMode: Text.Wrap
text: root.title text: root.title
font.pixelSize:Math.max(19,root.height / 100 * 4.2) font.pixelSize: Math.max(19, root.height / 100 * 4.2)
color: "white" color: "white"
} }
Button { Button {
id: runGameButton id: runGameButton
focus: true focus: true
...@@ -256,17 +246,17 @@ Rectangle { ...@@ -256,17 +246,17 @@ Rectangle {
//background.opacity: 0.2 //background.opacity: 0.2
leftPadding: textGame.font.pixelSize * 3 leftPadding: textGame.font.pixelSize * 3
rightPadding: leftPadding rightPadding: leftPadding
topPadding: leftPadding/ 8 topPadding: leftPadding / 8
bottomPadding: leftPadding/8 bottomPadding: leftPadding / 8
//opacity: 0.8 //opacity: 0.8
text:"Play" text: "Play"
width: textGame.contentWidth + 5 width: textGame.contentWidth + 5
hoverEnabled: true hoverEnabled: true
contentItem: Text { contentItem: Text {
id: textGame id: textGame
text: runGameButton.text text: runGameButton.text
font.pixelSize:Math.max(19,root.height / 100 * 3) font.pixelSize: Math.max(19, root.height / 100 * 3)
font.family: globalFont.font font.family: globalFont.font
font.weight: 800 font.weight: 800
...@@ -275,16 +265,13 @@ Rectangle { ...@@ -275,16 +265,13 @@ Rectangle {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }
padding:10 padding: 10
background: Rectangle { background: Rectangle {
id:runGameBg id: runGameBg
color: "white" //control.down ? "#aaaaaa" : (control.activeFocus ? "#aaaaaa" : "#000000") color: "white" //control.down ? "#aaaaaa" : (control.activeFocus ? "#aaaaaa" : "#000000")
opacity: 0.1 opacity: 0.1
radius: runGameButton.width * 0.3 radius: runGameButton.width * 0.3
} }
onClicked: function(){ onClicked: function(){
...@@ -296,7 +283,8 @@ Rectangle { ...@@ -296,7 +283,8 @@ Rectangle {
states: [ states: [
// Карточка в фокуске // Карточка в фокуске
State { State {
name: "focus"; when: runGameButton.activeFocus name: "focus";
when: runGameButton.activeFocus
PropertyChanges { PropertyChanges {
target: runGameBg; target: runGameBg;
opacity: 1; opacity: 1;
...@@ -304,19 +292,20 @@ Rectangle { ...@@ -304,19 +292,20 @@ Rectangle {
PropertyChanges { PropertyChanges {
target: textGame; target: textGame;
font.weight: 800; font.weight: 800;
color:"black" color: "black"
} }
}, },
// На карточку навели курсор мыши // На карточку навели курсор мыши
State { State {
name: "hover"; when: runGameButton.hovered name: "hover";
when: runGameButton.hovered
PropertyChanges { PropertyChanges {
target: runGameBg; target: runGameBg;
opacity: 1; opacity: 1;
} }
PropertyChanges { PropertyChanges {
target: textGame; target: textGame;
color:"black" color: "black"
} }
} }
] ]
...@@ -327,27 +316,32 @@ Rectangle { ...@@ -327,27 +316,32 @@ Rectangle {
property: "opacity"; property: "opacity";
duration: 300 duration: 300
} }
} }
} }
} }
Text { Text {
horizontalAlignment: Text.AlignJustif horizontalAlignment: Text.AlignJustif
Layout.alignment:Qt.AlignRight| Qt.AlignTop Layout.alignment: Qt.AlignRight | Qt.AlignTop
id: title2 id: title2
Layout.maximumWidth: root.width / 100 * 30 Layout.maximumWidth: root.width / 100 * 30
Layout.maximumHeight: root.height / 100 * 70 Layout.maximumHeight: root.height / 100 * 70
elide: Text.ElideRight elide: Text.ElideRight
wrapMode: Text.Wrap wrapMode: Text.Wrap
text: "SD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfv SD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfv SD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfv SD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfvSD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfv SD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfvSD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfv SD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfv " text:
font.pixelSize:Math.max(13,root.height / 100 * 2.2) "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " +
"Sed a ligula dolor. Cras eu sapien felis. Praesent placerat " +
"interdum mi at commodo. Nulla leo lacus, semper sed neque a, " +
"viverra convallis enim. Maecenas eget ligula eu augue posuere " +
"tincidunt sit amet et orci. In hac habitasse platea dictumst. " +
"Donec rutrum pharetra scelerisque. Sed quam mi, accumsan eget " +
"bibendum non, varius a nisi. Vivamus commodo turpis vitae " +
"vulputate tempus. Pellentesque efficitur risus nibh, sit amet " +
"interdum ante pulvinar sit amet. Ut hendrerit diam eu felis " +
"ornare, a sollicitudin lacus auctor. In hac habitasse platea dictumst. " +
"Vivamus sodales, purus at fermentum mattis, nulla libero porttitor " +
"orci, vitae scelerisque quam elit sit amet eros."
font.pixelSize: Math.max(13, root.height / 100 * 2.2)
color: "white" color: "white"
} }
...@@ -357,22 +351,6 @@ Rectangle { ...@@ -357,22 +351,6 @@ Rectangle {
} }
// LOGIC // LOGIC
property int focusedItems: 0; property int focusedItems: 0;
...@@ -405,25 +383,23 @@ Rectangle { ...@@ -405,25 +383,23 @@ Rectangle {
c[i].forceActiveFocus(); c[i].forceActiveFocus();
} }
Connections {
target: core_app function onGamepadAxisLeft(done){
function onGamepadAxisLeft(done){ if(window.scene !== S.gameInfoScene) return;
if(window.scene !== S.gameInfoScene) return; root.applyItemsFocus(-1)
root.applyItemsFocus(-1) }
} function onGamepadAxisRight(done){
function onGamepadAxisRight(done){ if(window.scene !== S.gameInfoScene) return;
if(window.scene !== S.gameInfoScene) return; root.applyItemsFocus(1)
root.applyItemsFocus(1) }
} function onGamepadClickedApply(done){
function onGamepadClickedApply(done){ if(window.scene !== S.gameInfoScene) return;
if(window.scene !== S.gameInfoScene) return; let c = focusElements();
let c = focusElements(); c[root.focusedItems].clicked();
c[root.focusedItems].clicked(); }
} function onGamepadClickedBack(done){
function onGamepadClickedBack(done){ if(window.scene !== S.gameInfoScene) return;
if(window.scene !== S.gameInfoScene) return; back.clicked();
back.clicked();
}
} }
......
...@@ -41,4 +41,21 @@ Rectangle { ...@@ -41,4 +41,21 @@ Rectangle {
anchors.leftMargin: 0 anchors.leftMargin: 0
anchors.rightMargin: 0 anchors.rightMargin: 0
} }
function onGamepadClickedLB(done){
tabs.onGamepadClickedLB(done)
}
function onGamepadClickedRB(done){
tabs.onGamepadClickedRB(done)
}
function onGamepadAxisLeft(done){
tabs.onGamepadAxisLeft(done)
}
function onGamepadAxisRight(done){
tabs.onGamepadAxisRight(done)
}
function onGamepadClickedApply(done){
tabs.onGamepadClickedApply(done)
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment