diff --git a/Jeu_2048/CMakeLists.txt b/Jeu_2048/CMakeLists.txt index f38abf72d119d635416cfd53c95338ad09ea5c0b..852865407cc83bcb77216aa5baab5b1ac52db201 100644 --- a/Jeu_2048/CMakeLists.txt +++ b/Jeu_2048/CMakeLists.txt @@ -22,6 +22,7 @@ qt_add_qml_module(appJeu_2048 QML_FILES Partie.qml QML_FILES Menu_de_Controle.qml SOURCES game2048.h game2048.cpp + QML_FILES Case.qml ) # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. diff --git a/Jeu_2048/Case.qml b/Jeu_2048/Case.qml new file mode 100644 index 0000000000000000000000000000000000000000..e457f67cf386dde98c7572b9e9f1e6d5fbe77522 --- /dev/null +++ b/Jeu_2048/Case.qml @@ -0,0 +1,30 @@ +import QtQuick + +Item { + property alias _textText: _text.text + property alias _textColor: _text.color + property alias _textFontpixelSize: _text.font.pixelSize + property alias rectangleColor: rectangle.color + property alias rectangleX: rectangle.x + property alias rectangleY: rectangle.y + Rectangle { + id: rectangle + x: 0 + y: 0 + width: 100 + height: 100 + visible: true + color: "#c9c6ac" + radius: 16 + + Text { + id: _text + text: qsTr("") + anchors.verticalCenter: parent.verticalCenter + font.pixelSize: 20 + anchors.horizontalCenter: parent.horizontalCenter + font.family: "Tahoma" + } + } + +} diff --git a/Jeu_2048/Main.qml b/Jeu_2048/Main.qml index 3b28f4f6d611f9e493bc5eb27b83616a9c70d689..ee6e3a930b4a2588e4c452693237ffa6a08e543c 100644 --- a/Jeu_2048/Main.qml +++ b/Jeu_2048/Main.qml @@ -1,14 +1,86 @@ import QtQuick Window { + id: window visible: true - width: 400 - height: 400 + color: "#ffffff" + width: 600 + height: 900 title: qsTr("2048") - Text { - text: qsTr("Hello 2048") - anchors.centerIn: parent - font.pointSize: 24 + Rectangle { + id: rectangle + y: 100 + width: 400 + height: 200 + color: "#edcc5f" + radius: 30 + anchors.horizontalCenter: parent.horizontalCenter + + Text { + id: _text + x: 69 + color: "#ffffff" + text: qsTr("2048") + anchors.verticalCenter: parent.verticalCenter + font.pixelSize: 80 + font.weight: Font.Bold + font.family: "Tahoma" + anchors.horizontalCenter: parent.horizontalCenter + } + } + + Rectangle { + id: rectangle1 + x: 100 + y: 350 + width: 400 + height: 500 + color: "#3c3a33" + radius: 15 + + Rectangle { + id: rectangle2 + y: 20 + width: 360 + height: 100 + color: "#c9c6ac" + radius: 15 + anchors.horizontalCenter: parent.horizontalCenter + } + + Rectangle { + id: rectangle3 + y: 140 + width: 360 + height: 100 + color: "#c9c6ac" + radius: 15 + anchors.horizontalCenterOffset: 0 + anchors.horizontalCenter: parent.horizontalCenter + } + + Rectangle { + id: rectangle4 + y: 260 + width: 360 + height: 100 + color: "#c9c6ac" + radius: 15 + anchors.horizontalCenterOffset: 0 + anchors.horizontalCenter: parent.horizontalCenter + } + + Rectangle { + id: rectangle5 + x: 20 + y: 380 + width: 360 + height: 100 + color: "#c9c6ac" + radius: 15 + anchors.horizontalCenterOffset: 0 + anchors.horizontalCenter: parent.horizontalCenter + } } } diff --git a/Jeu_2048/Partie.qml b/Jeu_2048/Partie.qml index 6090d223dfc1e8ca47edcc3c30fd2d1d911a26c1..780420b936440ab438331b53544e3f9840b87baa 100644 --- a/Jeu_2048/Partie.qml +++ b/Jeu_2048/Partie.qml @@ -4,6 +4,7 @@ Item { id: _item width: 600 height: 900 + property alias _text3Text: current_score.text Rectangle { id: background @@ -11,175 +12,126 @@ Item { anchors.fill: parent Rectangle { - id: grille + id: grid y: 300 width: 500 height: 500 color: "#a49381" + radius: 15 anchors.horizontalCenterOffset: 0 anchors.horizontalCenter: parent.horizontalCenter - Rectangle { - id: rectangle1 + Case { + id: case1 x: 20 y: 20 - width: 100 - height: 100 - color: "#c9c6ac" } - Rectangle { - id: rectangle2 + Case { + id: case2 x: 140 y: 20 - width: 100 - height: 100 - color: "#c9c6ac" - rotation: 0 } - Rectangle { - id: rectangle3 + Case { + id: case3 x: 260 y: 20 - width: 100 - height: 100 - color: "#c9c6ac" } - Rectangle { - id: rectangle4 + Case { + id: case4 x: 380 y: 20 - width: 100 - height: 100 - color: "#c9c6ac" } - Rectangle { - id: rectangle5 + Case { + id: case5 x: 20 y: 140 - width: 100 - height: 100 - color: "#c9c6ac" } - Rectangle { - id: rectangle6 + Case { + id: case6 x: 140 y: 140 - width: 100 - height: 100 - color: "#c9c6ac" - rotation: 0 } - Rectangle { - id: rectangle7 + Case { + id: case7 x: 260 y: 140 - width: 100 - height: 100 - color: "#c9c6ac" } - Rectangle { - id: rectangle8 + Case { + id: case8 x: 380 y: 140 - width: 100 - height: 100 - color: "#c9c6ac" } - Rectangle { - id: rectangle9 + Case { + id: case9 x: 20 y: 260 - width: 100 - height: 100 - color: "#c9c6ac" } - Rectangle { - id: rectangle10 + Case { + id: case10 x: 140 y: 260 - width: 100 - height: 100 - color: "#c9c6ac" - rotation: 0 } - Rectangle { - id: rectangle11 + Case { + id: case11 x: 260 y: 260 - width: 100 - height: 100 - color: "#c9c6ac" } - Rectangle { - id: rectangle12 + Case { + id: case12 x: 380 y: 260 - width: 100 - height: 100 - color: "#c9c6ac" } - Rectangle { - id: rectangle13 + Case { + id: case13 x: 20 y: 380 - width: 100 - height: 100 - color: "#c9c6ac" } - Rectangle { - id: rectangle14 + Case { + id: case14 x: 140 y: 380 - width: 100 - height: 100 - color: "#c9c6ac" - rotation: 0 } - Rectangle { - id: rectangle15 + Case { + id: case15 x: 260 y: 380 - width: 100 - height: 100 - color: "#c9c6ac" } - Rectangle { - id: rectangle16 + Case { + id: case16 x: 380 - y: 380 - width: 100 - height: 100 - color: "#c9c6ac" + y: 375 } } Rectangle { - id: rectangle + id: icon_rectangle x: 50 y: 50 width: 200 height: 150 color: "#edcc5f" + radius: 15 Text { - id: _text + id: icon_text width: 200 height: 150 + color: "#ffffff" text: qsTr("2048") anchors.verticalCenter: parent.verticalCenter font.pixelSize: 50 @@ -192,34 +144,126 @@ Item { } Rectangle { - id: rectangle17 + id: score_rectangle x: 270 y: 50 width: 130 height: 65 color: "#3c3a33" + radius: 15 + + Text { + id: score_text + y: 2 + color: "#c1c1c1" + text: qsTr("Score") + font.pixelSize: 20 + font.weight: Font.Bold + anchors.horizontalCenter: parent.horizontalCenter + } + + Text { + id: current_score + y: 28 + color: "#ffffff" + text: qsTr("0") + font.pixelSize: 25 + font.weight: Font.ExtraBold + font.family: "Tahoma" + anchors.horizontalCenter: parent.horizontalCenter + } } Rectangle { - id: rectangle18 + id: best_rectangle x: 420 y: 50 width: 130 height: 65 color: "#3c3a33" + radius: 15 + Text { + id: best_text + y: 2 + color: "#c1c1c1" + text: qsTr("Best") + font.pixelSize: 20 + font.weight: Font.Bold + anchors.horizontalCenter: parent.horizontalCenter + } + + Text { + id: best_score + y: 28 + color: "#ffffff" + text: qsTr("0") + font.pixelSize: 25 + font.weight: Font.ExtraBold + font.family: "Tahoma" + anchors.horizontalCenter: parent.horizontalCenter + } } Rectangle { - id: rectangle19 + id: new_rectangle x: 270 y: 135 width: 130 height: 65 color: "#f65e3d" + radius: 15 + + Text { + id: new_text + color: "#ffffff" + text: qsTr("NEW") + anchors.verticalCenter: parent.verticalCenter + font.pixelSize: 30 + font.family: "Tahoma" + font.weight: Font.ExtraBold + anchors.horizontalCenter: parent.horizontalCenter + } + + MouseArea { + id: new_mouse_area + x: 0 + y: 0 + width: 130 + height: 65 + } + } + + + Rectangle { + id: undo_rectangle + x: 420 + y: 135 + width: 130 + height: 65 + color: "#f65e3d" + radius: 15 + Text { + id: undo_text + color: "#ffffff" + text: qsTr("UNDO") + anchors.verticalCenter: parent.verticalCenter + font.pixelSize: 30 + font.weight: Font.ExtraBold + font.family: "Tahoma" + anchors.horizontalCenter: parent.horizontalCenter + } + + MouseArea { + id: undo_mouse_area + x: 0 + y: 0 + width: 130 + height: 65 + } } Text { - id: _text1 + id: join_the_numbers_text x: 50 y: 225 width: 500 @@ -230,15 +274,8 @@ Item { verticalAlignment: Text.AlignVCenter font.bold: true } - } - Rectangle { - id: rectangle20 - x: 420 - y: 135 - width: 130 - height: 65 - color: "#f65e3d" + } }