diff --git a/Jeu_2048/.gitignore b/Jeu_2048/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..aa3808c5a9e01bdb4728d53628e036914f616c56 --- /dev/null +++ b/Jeu_2048/.gitignore @@ -0,0 +1,82 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* +*.qbs.user* +CMakeLists.txt.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + +# Directories with generated files +.moc/ +.obj/ +.pch/ +.rcc/ +.uic/ +/build*/ diff --git a/Jeu_2048/CMakeLists.txt b/Jeu_2048/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..5fba64af03e53978d5cb49fea52478268cd1c439 --- /dev/null +++ b/Jeu_2048/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required(VERSION 3.16) + +project(Jeu_2048 VERSION 0.1 LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +find_package(Qt6 REQUIRED COMPONENTS Quick) + +qt_standard_project_setup(REQUIRES 6.5) + +qt_add_executable(appJeu_2048 + main.cpp +) + +qt_add_qml_module(appJeu_2048 + URI Jeu_2048 + VERSION 1.0 + QML_FILES + Main.qml + SOURCES bouton.h bouton.cpp + SOURCES case.h case.cpp + QML_FILES Partie.qml + QML_FILES Menu_de_Controle.qml +) + +# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. +# If you are developing for iOS or macOS you should consider setting an +# explicit, fixed bundle identifier manually though. +set_target_properties(appJeu_2048 PROPERTIES +# MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appJeu_2048 + MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} + MACOSX_BUNDLE TRUE + WIN32_EXECUTABLE TRUE +) + +target_link_libraries(appJeu_2048 + PRIVATE Qt6::Quick +) + +include(GNUInstallDirs) +install(TARGETS appJeu_2048 + BUNDLE DESTINATION . + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/Jeu_2048/Main.qml b/Jeu_2048/Main.qml new file mode 100644 index 0000000000000000000000000000000000000000..41424f88973df650d0672dfdc62f670e86708de2 --- /dev/null +++ b/Jeu_2048/Main.qml @@ -0,0 +1,8 @@ +import QtQuick + +Window { + width: 640 + height: 480 + visible: true + title: qsTr("Hello World") +} diff --git a/Jeu_2048/Menu_de_Controle.qml b/Jeu_2048/Menu_de_Controle.qml new file mode 100644 index 0000000000000000000000000000000000000000..5560aee72760e390f8f001f3163d06bc2ed5d055 --- /dev/null +++ b/Jeu_2048/Menu_de_Controle.qml @@ -0,0 +1,5 @@ +import QtQuick + +Item { + +} diff --git a/Jeu_2048/Partie.qml b/Jeu_2048/Partie.qml new file mode 100644 index 0000000000000000000000000000000000000000..6090d223dfc1e8ca47edcc3c30fd2d1d911a26c1 --- /dev/null +++ b/Jeu_2048/Partie.qml @@ -0,0 +1,244 @@ +import QtQuick + +Item { + id: _item + width: 600 + height: 900 + + Rectangle { + id: background + color: "#ffffff" + anchors.fill: parent + + Rectangle { + id: grille + y: 300 + width: 500 + height: 500 + color: "#a49381" + anchors.horizontalCenterOffset: 0 + anchors.horizontalCenter: parent.horizontalCenter + + Rectangle { + id: rectangle1 + x: 20 + y: 20 + width: 100 + height: 100 + color: "#c9c6ac" + } + + Rectangle { + id: rectangle2 + x: 140 + y: 20 + width: 100 + height: 100 + color: "#c9c6ac" + rotation: 0 + } + + Rectangle { + id: rectangle3 + x: 260 + y: 20 + width: 100 + height: 100 + color: "#c9c6ac" + } + + Rectangle { + id: rectangle4 + x: 380 + y: 20 + width: 100 + height: 100 + color: "#c9c6ac" + } + + Rectangle { + id: rectangle5 + x: 20 + y: 140 + width: 100 + height: 100 + color: "#c9c6ac" + } + + Rectangle { + id: rectangle6 + x: 140 + y: 140 + width: 100 + height: 100 + color: "#c9c6ac" + rotation: 0 + } + + Rectangle { + id: rectangle7 + x: 260 + y: 140 + width: 100 + height: 100 + color: "#c9c6ac" + } + + Rectangle { + id: rectangle8 + x: 380 + y: 140 + width: 100 + height: 100 + color: "#c9c6ac" + } + + Rectangle { + id: rectangle9 + x: 20 + y: 260 + width: 100 + height: 100 + color: "#c9c6ac" + } + + Rectangle { + id: rectangle10 + x: 140 + y: 260 + width: 100 + height: 100 + color: "#c9c6ac" + rotation: 0 + } + + Rectangle { + id: rectangle11 + x: 260 + y: 260 + width: 100 + height: 100 + color: "#c9c6ac" + } + + Rectangle { + id: rectangle12 + x: 380 + y: 260 + width: 100 + height: 100 + color: "#c9c6ac" + } + + Rectangle { + id: rectangle13 + x: 20 + y: 380 + width: 100 + height: 100 + color: "#c9c6ac" + } + + Rectangle { + id: rectangle14 + x: 140 + y: 380 + width: 100 + height: 100 + color: "#c9c6ac" + rotation: 0 + } + + Rectangle { + id: rectangle15 + x: 260 + y: 380 + width: 100 + height: 100 + color: "#c9c6ac" + } + + Rectangle { + id: rectangle16 + x: 380 + y: 380 + width: 100 + height: 100 + color: "#c9c6ac" + } + } + + Rectangle { + id: rectangle + x: 50 + y: 50 + width: 200 + height: 150 + color: "#edcc5f" + + Text { + id: _text + width: 200 + height: 150 + text: qsTr("2048") + anchors.verticalCenter: parent.verticalCenter + font.pixelSize: 50 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + font.family: "Tahoma" + font.bold: true + anchors.horizontalCenter: parent.horizontalCenter + } + } + + Rectangle { + id: rectangle17 + x: 270 + y: 50 + width: 130 + height: 65 + color: "#3c3a33" + } + + Rectangle { + id: rectangle18 + x: 420 + y: 50 + width: 130 + height: 65 + color: "#3c3a33" + } + + Rectangle { + id: rectangle19 + x: 270 + y: 135 + width: 130 + height: 65 + color: "#f65e3d" + } + + Text { + id: _text1 + x: 50 + y: 225 + width: 500 + height: 50 + text: qsTr("Join the numbers and get the 2048 tile!") + font.pixelSize: 20 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + font.bold: true + } + } + + Rectangle { + id: rectangle20 + x: 420 + y: 135 + width: 130 + height: 65 + color: "#f65e3d" + } + +} diff --git a/Jeu_2048/bouton.cpp b/Jeu_2048/bouton.cpp new file mode 100644 index 0000000000000000000000000000000000000000..411e95acaf3fa454342e9145e8d92afbf71be42b --- /dev/null +++ b/Jeu_2048/bouton.cpp @@ -0,0 +1,3 @@ +#include "bouton.h" + +Bouton::Bouton() {} diff --git a/Jeu_2048/bouton.h b/Jeu_2048/bouton.h new file mode 100644 index 0000000000000000000000000000000000000000..5c908fe89f30adbd8e89eb7bd731865930a19c8b --- /dev/null +++ b/Jeu_2048/bouton.h @@ -0,0 +1,10 @@ +#ifndef BOUTON_H +#define BOUTON_H + +class Bouton +{ +public: + Bouton(); +}; + +#endif // BOUTON_H diff --git a/Jeu_2048/case.cpp b/Jeu_2048/case.cpp new file mode 100644 index 0000000000000000000000000000000000000000..094b194cc96afb8200398a331142e135412d5b44 --- /dev/null +++ b/Jeu_2048/case.cpp @@ -0,0 +1,5 @@ +#include "case.h" + +case ::case (){ + +} diff --git a/Jeu_2048/case.h b/Jeu_2048/case.h new file mode 100644 index 0000000000000000000000000000000000000000..1e3eb70ff13998da19a32c04a4e981a9ebe40410 --- /dev/null +++ b/Jeu_2048/case.h @@ -0,0 +1,8 @@ +#ifndef CASE_H +#define CASE_H + +class case {public: + case(); +}; + +#endif // CASE_H diff --git a/Jeu_2048/main.cpp b/Jeu_2048/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bc907cef49cc8e8cbaa62dcb73d2f0da75ee4398 --- /dev/null +++ b/Jeu_2048/main.cpp @@ -0,0 +1,18 @@ +#include <QGuiApplication> +#include <QQmlApplicationEngine> + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + QObject::connect( + &engine, + &QQmlApplicationEngine::objectCreationFailed, + &app, + []() { QCoreApplication::exit(-1); }, + Qt::QueuedConnection); + engine.loadFromModule("Jeu_2048", "Main"); + + return app.exec(); +}