From 0487091f48822a5a7b83fc72688233c511a71e19 Mon Sep 17 00:00:00 2001
From: Yanis Dziki <yanis.dziki@ens-lyon.fr>
Date: Mon, 31 Mar 2025 11:09:10 +0200
Subject: [PATCH] Bouton avec redirect vers page de jeux

---
 motus/Bouton.qml     | 33 +++++++++++++++++++++++++++++++++
 motus/CMakeLists.txt |  3 +++
 motus/GameWindow.qml | 19 +++++++++++++++++++
 motus/Main.qml       | 23 +++++++++++++++++++----
 motus/Resources.qrc  |  3 +++
 5 files changed, 77 insertions(+), 4 deletions(-)
 create mode 100644 motus/Bouton.qml
 create mode 100644 motus/GameWindow.qml

diff --git a/motus/Bouton.qml b/motus/Bouton.qml
new file mode 100644
index 0000000..cc23379
--- /dev/null
+++ b/motus/Bouton.qml
@@ -0,0 +1,33 @@
+import QtQuick
+
+Item {
+    x: 120
+    y: 50
+    width: 180
+    height: 40
+    property alias mouseArea: mouseArea
+
+    Rectangle {
+        id: rectangle
+        color: "#2ec27e"
+        anchors.fill: parent
+        anchors.leftMargin: 0
+        anchors.rightMargin: 0
+        anchors.topMargin: 0
+        anchors.bottomMargin: 0
+
+        Text {
+            id: _text
+            x: 40
+            y: 13
+            text: qsTr("Démarrer la partie")
+            font.pixelSize: 12
+        }
+    }
+
+    MouseArea {
+        id: mouseArea
+        anchors.fill: parent
+    }
+
+}
diff --git a/motus/CMakeLists.txt b/motus/CMakeLists.txt
index 11878d1..108da78 100644
--- a/motus/CMakeLists.txt
+++ b/motus/CMakeLists.txt
@@ -31,6 +31,9 @@ qt_add_qml_module(appmotus
         RESOURCES assets/enter.png assets/del.png
         RESOURCES words_alpha.txt
         QML_FILES MenuDeroulant.qml
+        QML_FILES Bouton.qml
+        RESOURCES
+        QML_FILES GameWindow.qml
 )
 
 # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
diff --git a/motus/GameWindow.qml b/motus/GameWindow.qml
new file mode 100644
index 0000000..abdd6f3
--- /dev/null
+++ b/motus/GameWindow.qml
@@ -0,0 +1,19 @@
+import QtQuick
+
+Item {
+    width: 900
+    height: 800
+
+    Rectangle {
+        id: rectangle
+        color: "#ffffff"
+        anchors.fill: parent
+
+        Clavier {
+            id: clavier
+            x: 225
+            y: 594
+        }
+    }
+
+}
diff --git a/motus/Main.qml b/motus/Main.qml
index 6e90d9b..4a50211 100644
--- a/motus/Main.qml
+++ b/motus/Main.qml
@@ -1,14 +1,29 @@
 import QtQuick
 
 Window {
-    width: 640
-    height: 480
+    width: 900
+    height: 800
     visible: true
     title: qsTr("Hello World")
 
     MenuDeroulant {
         id: menuDeroulant
-        x: 36
-        y: 269
+        x: 38
+        y: 301
     }
+
+    Bouton {
+        id: bouton
+        x: 360
+        y: 624
+        mouseArea.onClicked:{
+            pageLoader.source = "GameWindow.qml"
+        }
+    }
+    
+    Loader {
+        id: pageLoader
+        anchors.centerIn: parent
+    }
+
 }
diff --git a/motus/Resources.qrc b/motus/Resources.qrc
index 3d9b506..90f00a4 100644
--- a/motus/Resources.qrc
+++ b/motus/Resources.qrc
@@ -4,5 +4,8 @@
         <file>Main.qml</file>
         <file>Clavier.qml</file>
         <file>MenuDeroulant.qml</file>
+        <file>bouton.qml</file>
+        <file>Bouton.qml</file>
+        <file>GameWindow.qml</file>
     </qresource>
 </RCC>
-- 
GitLab