diff --git a/Button.qml b/Button.qml new file mode 100644 index 0000000..8d2e2d1 --- /dev/null +++ b/Button.qml @@ -0,0 +1,32 @@ +import QtQuick 2.0 + +Rectangle { + id: root + color: "transparent" + property alias source: _button.source + property alias text: _icon.text + property alias margin: _icon.anchors.bottomMargin + Image { + id: _button + antialiasing: false + smooth: false + source: "qrc:/resources/Button1.png" + + anchors{ + fill: parent + margins: 10 + } + } + Icon{ + id: _icon + height: Math.min (root.height, root.width) + width: Math.min (root.height, root.width) + anchors{ + left: root.left + leftMargin: 0 + bottom: root.bottom + bottomMargin: 20 + } + } + +} diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..f31742a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,66 @@ +cmake_minimum_required(VERSION 3.5) + +project(rockPaperScissors LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + + +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + +option(BUILD_SHARED_LIBS "Build using shared libraries" ON) + +if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") + enable_language("RC") + set (WIN32_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/rockPaperScissors.rc) +endif() + + +# QtCreator supports the following variables for Android, which are identical to qmake Android variables. +# Check http://doc.qt.io/qt-5/deployment-android.html for more information. +# They need to be set before the find_package(Qt5 ...) call. + +#if(ANDROID) +# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") +# if (ANDROID_ABI STREQUAL "armeabi-v7a") +# set(ANDROID_EXTRA_LIBS +# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so +# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so) +# endif() +#endif() + +find_package(Qt5 COMPONENTS Core Quick REQUIRED) + +if(ANDROID) + add_library(rockPaperScissors SHARED + main.cpp + gamelogic.cpp + qml.qrc + resources.qrc + ) +else() + add_executable(rockPaperScissors + main.cpp + gamelogic.cpp + qml.qrc + resources.qrc + ${PROJECT_SOURCES} + ${WIN32_RESOURCES} + ) +endif() + +target_compile_definitions(rockPaperScissors + PRIVATE $<$,$>:QT_QML_DEBUG>) +target_link_libraries(rockPaperScissors + PRIVATE Qt5::Core Qt5::Quick) + + + diff --git a/CMakeLists.txt.user b/CMakeLists.txt.user new file mode 100644 index 0000000..ea8ab30 --- /dev/null +++ b/CMakeLists.txt.user @@ -0,0 +1,695 @@ + + + + + + EnvironmentId + {5ac0d72a-5f7f-41f5-8571-40988ba02825} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + -fno-delayed-template-parsing + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.14.2 MinGW 32-bit + Desktop Qt 5.14.2 MinGW 32-bit + qt.qt5.5142.win32_mingw73_kit + 1 + 0 + 0 + + + CMAKE_BUILD_TYPE:STRING=Debug + CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx} + CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C} + CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX} + QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable} + + C:/Users/User/Documents/cppqt/build-rockPaperScissors-Desktop_Qt_5_14_2_MinGW_32_bit-Debug + + + + + all + + true + CMakeProjectManager.MakeStep + + 1 + Сборка + Сборка + ProjectExplorer.BuildSteps.Build + + + + + + clean + + true + CMakeProjectManager.MakeStep + + 1 + Очистка + Очистка + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Отладка + CMakeProjectManager.CMakeBuildConfiguration + + + + CMAKE_BUILD_TYPE:STRING=Release + CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx} + CMAKE_CXX_FLAGS:STRING=-mwindows + CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C} + CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX} + QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable} + + C:/Users/User/Documents/cppqt/build-rockPaperScissors-Desktop_Qt_5_14_2_MinGW_32_bit-Release + + + + + all + + true + CMakeProjectManager.MakeStep + + 1 + Сборка + Сборка + ProjectExplorer.BuildSteps.Build + + + + + + clean + + true + CMakeProjectManager.MakeStep + + 1 + Очистка + Очистка + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Выпуск + CMakeProjectManager.CMakeBuildConfiguration + + + + CMAKE_BUILD_TYPE:STRING=RelWithDebInfo + CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx} + CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C} + CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX} + QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable} + + C:/Users/User/Documents/cppqt/build-rockPaperScissors-Desktop_Qt_5_14_2_MinGW_32_bit-RelWithDebInfo + + + + + all + + true + CMakeProjectManager.MakeStep + + 1 + Сборка + Сборка + ProjectExplorer.BuildSteps.Build + + + + + + clean + + true + CMakeProjectManager.MakeStep + + 1 + Очистка + Очистка + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Выпуск с отладочной информацией + CMakeProjectManager.CMakeBuildConfiguration + + + + CMAKE_BUILD_TYPE:STRING=MinSizeRel + CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx} + CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C} + CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX} + QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable} + + C:/Users/User/Documents/cppqt/build-rockPaperScissors-Desktop_Qt_5_14_2_MinGW_32_bit-MinSizeRel + + + + + all + + true + CMakeProjectManager.MakeStep + + 1 + Сборка + Сборка + ProjectExplorer.BuildSteps.Build + + + + + + clean + + true + CMakeProjectManager.MakeStep + + 1 + Очистка + Очистка + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Выпуск минимального размера + CMakeProjectManager.CMakeBuildConfiguration + + 4 + + + 0 + Развёртывание + Развёртывание + ProjectExplorer.BuildSteps.Deploy + + 1 + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + rockPaperScissors + CMakeProjectManager.CMakeRunConfiguration.rockPaperScissors + rockPaperScissors + + false + + false + true + true + false + false + true + + C:/Users/User/Documents/cppqt/build-rockPaperScissors-Desktop_Qt_5_14_2_MinGW_32_bit-Release + + + dwarf + + cpu-cycles + + + 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + MyApp + CMakeProjectManager.CMakeRunConfiguration.MyApp + MyApp + + false + + false + true + true + false + false + true + + + + 2 + + + + ProjectExplorer.Project.Target.1 + + Desktop Qt 5.14.2 MinGW 64-bit + Desktop Qt 5.14.2 MinGW 64-bit + qt.qt5.5142.win64_mingw73_kit + 0 + 0 + 0 + + + CMAKE_BUILD_TYPE:STRING=Debug + CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx} + CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C} + CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX} + QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable} + + C:/Users/User/Documents/cppqt/build-rockPaperScissors-Desktop_Qt_5_14_2_MinGW_64_bit-Debug + + + + + all + + true + CMakeProjectManager.MakeStep + + 1 + Сборка + Сборка + ProjectExplorer.BuildSteps.Build + + + + + + clean + + true + CMakeProjectManager.MakeStep + + 1 + Очистка + Очистка + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Отладка + CMakeProjectManager.CMakeBuildConfiguration + + + + CMAKE_BUILD_TYPE:STRING=Release + CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx} + CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C} + CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX} + QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable} + + C:/Users/User/Documents/cppqt/build-rockPaperScissors-Desktop_Qt_5_14_2_MinGW_64_bit-Release + + + + + all + + true + CMakeProjectManager.MakeStep + + 1 + Сборка + Сборка + ProjectExplorer.BuildSteps.Build + + + + + + clean + + true + CMakeProjectManager.MakeStep + + 1 + Очистка + Очистка + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Выпуск + CMakeProjectManager.CMakeBuildConfiguration + + + + CMAKE_BUILD_TYPE:STRING=RelWithDebInfo + CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx} + CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C} + CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX} + QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable} + + C:/Users/User/Documents/cppqt/build-rockPaperScissors-Desktop_Qt_5_14_2_MinGW_64_bit-RelWithDebInfo + + + + + all + + true + CMakeProjectManager.MakeStep + + 1 + Сборка + Сборка + ProjectExplorer.BuildSteps.Build + + + + + + clean + + true + CMakeProjectManager.MakeStep + + 1 + Очистка + Очистка + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Выпуск с отладочной информацией + CMakeProjectManager.CMakeBuildConfiguration + + + + CMAKE_BUILD_TYPE:STRING=MinSizeRel + CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx} + CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C} + CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX} + QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable} + + C:/Users/User/Documents/cppqt/build-rockPaperScissors-Desktop_Qt_5_14_2_MinGW_64_bit-MinSizeRel + + + + + all + + true + CMakeProjectManager.MakeStep + + 1 + Сборка + Сборка + ProjectExplorer.BuildSteps.Build + + + + + + clean + + true + CMakeProjectManager.MakeStep + + 1 + Очистка + Очистка + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Выпуск минимального размера + CMakeProjectManager.CMakeBuildConfiguration + + 4 + + + 0 + Развёртывание + Развёртывание + ProjectExplorer.BuildSteps.Deploy + + 1 + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + + ProjectExplorer.CustomExecutableRunConfiguration + + + false + + false + true + false + false + true + + + + 1 + + + + ProjectExplorer.Project.TargetCount + 2 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/Icon.qml b/Icon.qml new file mode 100644 index 0000000..f08c9c6 --- /dev/null +++ b/Icon.qml @@ -0,0 +1,31 @@ +import QtQuick 2.4 + +Rectangle { + id: root + color: "transparent" + property string text: "" + + Image { + id: _icon + width: root.height + height: root.height + antialiasing: false + smooth: false + + anchors{ + fill: parent + margins: 40 + } + + source: if (root.text === "Камень"){ + "qrc:/resources/rock.png" + } + else if (root.text === "Ножницы"){ + "qrc:/resources/scissors.png" + } + else if (root.text === "Бумага"){ + "qrc:/resources/paper.png" + } + else "" + } +} diff --git a/IconForm.ui.qml b/IconForm.ui.qml new file mode 100644 index 0000000..9c6428c --- /dev/null +++ b/IconForm.ui.qml @@ -0,0 +1,6 @@ +import QtQuick 2.4 + +Item { + width: 400 + height: 400 +} diff --git a/Monitor.qml b/Monitor.qml new file mode 100644 index 0000000..af910f5 --- /dev/null +++ b/Monitor.qml @@ -0,0 +1,33 @@ +import QtQuick 2.0 + +Rectangle { + id: root + color: "transparent" + property alias source: _button.source + property alias text: _icon.text + property string type: "ai" + property alias margin: _icon.anchors.bottomMargin + Image { + id: _button + antialiasing: false + smooth: false + source: { + if (parent.type === "ai") "qrc:/resources/monitor_ai.png" + else "qrc:/resources/monitor_player.png" + } + + anchors{ + fill: parent + margins: 10 + } + } + Icon{ + id: _icon + height: Math.min (root.height, root.width) + width: Math.min (root.height, root.width) + anchors{ + centerIn: parent + } + } + +} diff --git a/gamelogic.cpp b/gamelogic.cpp new file mode 100644 index 0000000..46c80c6 --- /dev/null +++ b/gamelogic.cpp @@ -0,0 +1,81 @@ +#include "gamelogic.h" +#include +#include + + +GameLogic::GameLogic(QObject *parent) : QObject(parent) +{ + m_mainLabel = "Да начнётся игра"; +} + +QString GameLogic::mainLabel() +{ + return m_mainLabel; +} + +QString GameLogic::playerValue() +{ + return m_playerValue; +} + +QString GameLogic::aiValue() +{ + return m_aiValue; +} + +void GameLogic::playerChoice(int choice) +{ + startGame(choice); +} + +void GameLogic::setMainLabel(QString text) +{ + m_mainLabel = text; + emit mainLabelChanged(); +} + +void GameLogic::setPlayerValue(QString value) +{ + m_playerValue = value; + emit playerValueChanged(); +} + +void GameLogic::setAiValue(QString value) +{ + m_aiValue = value; + emit aiValueChanged(); +} + +void GameLogic::aiChoice() +{ + m_aiChoice = std::rand() % 3; +} + +void GameLogic::startGame(int plChoice) +{ + QVector naming(3); + naming[0] = "Камень"; + naming[1] = "Ножницы"; + naming[2] = "Бумага"; + + aiChoice(); + if (m_aiChoice == plChoice) + { + setMainLabel("Ничья"); + setAiValue(naming[m_aiChoice]); + setPlayerValue(naming[plChoice]); + } + else if ((m_aiChoice == 0 && plChoice == 2) || (m_aiChoice == 1 && plChoice == 0) || (m_aiChoice == 2 && plChoice == 1)) + { + setMainLabel("Победа!"); + setAiValue(naming[m_aiChoice]); + setPlayerValue(naming[plChoice]); + } + else if ((m_aiChoice == 2 && plChoice == 0) || (m_aiChoice == 0 && plChoice == 1) || (m_aiChoice == 1 && plChoice == 2)) + { + setMainLabel("Поражение!"); + setAiValue(naming[m_aiChoice]); + setPlayerValue(naming[plChoice]); + } + else return; +} diff --git a/gamelogic.h b/gamelogic.h new file mode 100644 index 0000000..6f8d725 --- /dev/null +++ b/gamelogic.h @@ -0,0 +1,44 @@ +#ifndef GAMELOGIC_H +#define GAMELOGIC_H + +#include + +class GameLogic : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString mainLabel READ mainLabel WRITE setMainLabel NOTIFY mainLabelChanged) + Q_PROPERTY(QString playerValue READ playerValue WRITE setPlayerValue NOTIFY playerValueChanged) + Q_PROPERTY(QString aiValue READ aiValue WRITE setAiValue NOTIFY aiValueChanged) + +public: + explicit GameLogic(QObject *parent = nullptr); + QString mainLabel(); + QString playerValue(); + QString aiValue(); + +signals: + void mainLabelChanged(); + void playerValueChanged(); + void aiValueChanged(); + +public slots: + void playerChoice(int choice); + void setMainLabel(QString text); + void setPlayerValue(QString value); + void setAiValue(QString value); + + +private: + //Атрибуты + QString m_mainLabel; + QString m_playerValue; + QString m_aiValue; + int m_aiChoice; + + //Методы + void aiChoice(); + void startGame(int plChoice); + +}; + +#endif // GAMELOGIC_H diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..093f024 --- /dev/null +++ b/main.cpp @@ -0,0 +1,22 @@ +#include +#include +#include "gamelogic.h" + +int main(int argc, char *argv[]) +{ + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + + QGuiApplication app(argc, argv); + qmlRegisterType< GameLogic >("RPS", 1, 0, "GameLogic"); + + QQmlApplicationEngine engine; + const QUrl url(QStringLiteral("qrc:/main.qml")); + QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, + &app, [url](QObject *obj, const QUrl &objUrl) { + if (!obj && url == objUrl) + QCoreApplication::exit(-1); + }, Qt::QueuedConnection); + engine.load(url); + + return app.exec(); +} diff --git a/main.qml b/main.qml new file mode 100644 index 0000000..9b099ca --- /dev/null +++ b/main.qml @@ -0,0 +1,130 @@ +import QtQuick 2.12 +import QtQuick.Window 2.12 +import RPS 1.0 + +Window { + id: root + visible: true + width: 640 + height: 480 + title: qsTr("Камень Ножницы Бумага") + + Rectangle { + id: _background + anchors.fill: parent + color: "#110022" + z: -100 + } + + GameLogic { + id: _rps + } + + Text { + id: _label + color: "#ffffff" + smooth: false + antialiasing: false + FontLoader{ + id: _font + source: "qrc:/resources/vcrosdmonorusbyd.ttf" + } + + font{ + family: _font.name + pointSize: 24 + } + + z: 5 + anchors { + centerIn: parent + } + text: _rps.mainLabel + } + Monitor{ + id: _playerMonitor + text: _rps.playerValue + type: "player" + width: root.width / 2 + height: root.height / 2 -10 + anchors.left: _background.left + anchors.top: _background.top + } + Monitor{ + id: _aiMonitor + text: _rps.aiValue + type: "ai" + width: root.width / 2 + height: root.height / 2 -10 + anchors.right: _background.right + anchors.top: _background.top + } + + Button{ + id: _rock + text: "Камень" + width: root.width / 3 + height: root.height / 2 -10 + anchors.left: _background.left + anchors.bottom: _background.bottom + MouseArea{ + anchors.fill: parent + onPressed: { + _rps.playerChoice(0) + parent.source = "qrc:/resources/Button2.png" + parent.margin = 10 + } + onReleased: { + parent.source = "qrc:/resources/Button1.png" + parent.margin = 20 + } + + } + } + Button{ + id: _scisseors + text: "Ножницы" + width: root.width / 3 + height: root.height / 2 -10 + anchors.horizontalCenter: _background.horizontalCenter + anchors.bottom: _background.bottom + MouseArea{ + anchors.fill: parent + onPressed: { + _rps.playerChoice(1) + parent.source = "qrc:/resources/Button2.png" + parent.margin = 10 + } + onReleased: { + parent.source = "qrc:/resources/Button1.png" + parent.margin = 20 + } + + } + } + Button{ + id: _paper + text: "Бумага" + width: root.width / 3 + height: root.height / 2 -10 + anchors.right: _background.right + anchors.bottom: _background.bottom + MouseArea{ + anchors.fill: parent + onPressed: { + _rps.playerChoice(2) + parent.source = "qrc:/resources/Button2.png" + parent.margin = 10 + } + onReleased: { + parent.source = "qrc:/resources/Button1.png" + parent.margin = 20 + } + + } + } + + + + +} diff --git a/qml.qrc b/qml.qrc new file mode 100644 index 0000000..fedbe40 --- /dev/null +++ b/qml.qrc @@ -0,0 +1,9 @@ + + + main.qml + resources.qrc + Button.qml + Icon.qml + Monitor.qml + + diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..d54ddff --- /dev/null +++ b/readme.md @@ -0,0 +1,29 @@ +Это игра Камень-ножницы-бумага. +Правила игры знакомы с детства, если нет, то вот краткое описание: + +"Камень сильнее Ножниц, Ножницы сильнее Бумаги, а Бумага сильнее Камня. +Суть игры в том, чтобы выбрать сущность сильнее оппонента." + +Программа разделена на игровую логику, написанную на C++, +где класс GameLogic, наследованный от QObject, передаёт в логику отображения +три параметра: mainLabel, playerValue, aiValue через Q_PROPERTY. + +mainLabel содержит текст, который оповещает о победе, поражении и ничьей. +playerValue - тоже текст с выбором Камень, Ножницы или Бумага от лица Игрока. +aiValue аналогично с playerValue, только от лица Противника(ИИ). + +ИИ выбирает простым генератором псевдослучайных чисел от 0 до 2, с шансом 33.3%. + +Логика отображения написана на QML. +Были созданы два элимента Button и Monitor, которые располагаются в главном окне. + +Мониторы имеют две текстуры, Игрока и Противника, которые выбираются в зависимости от +параметра type. + +Кнопки передают в игровую логику запуск метода startGame с атрибутом от 0 до 2, +в зависимости от выбора Игрока: Камень = 0, Ножницы = 1, Бумага = 2. + +Элемент Icon содежит в себе иконки для кнопок и мониторов, в зависимости от параметра text +иконка отображает текстуру Камня, Ножниц или Бумаги. + +Файл resources.qrc содержит в себе графику и шрифт. \ No newline at end of file diff --git a/resources.qrc b/resources.qrc new file mode 100644 index 0000000..1ad409c --- /dev/null +++ b/resources.qrc @@ -0,0 +1,13 @@ + + + resources/paper.png + resources/rock.png + resources/scissors.png + resources/Button1.png + resources/Button2.png + resources/monitor_ai.png + resources/monitor_player.png + resources/rpc.ico + resources/vcrosdmonorusbyd.ttf + + diff --git a/resources/Button1.png b/resources/Button1.png new file mode 100644 index 0000000..5402f90 Binary files /dev/null and b/resources/Button1.png differ diff --git a/resources/Button2.png b/resources/Button2.png new file mode 100644 index 0000000..8089212 Binary files /dev/null and b/resources/Button2.png differ diff --git a/resources/icon.ico b/resources/icon.ico new file mode 100644 index 0000000..1bcc4db Binary files /dev/null and b/resources/icon.ico differ diff --git a/resources/monitor_ai.png b/resources/monitor_ai.png new file mode 100644 index 0000000..3f5e698 Binary files /dev/null and b/resources/monitor_ai.png differ diff --git a/resources/monitor_player.png b/resources/monitor_player.png new file mode 100644 index 0000000..6508760 Binary files /dev/null and b/resources/monitor_player.png differ diff --git a/resources/paper.png b/resources/paper.png new file mode 100644 index 0000000..d6d1525 Binary files /dev/null and b/resources/paper.png differ diff --git a/resources/rock.png b/resources/rock.png new file mode 100644 index 0000000..4e49b3d Binary files /dev/null and b/resources/rock.png differ diff --git a/resources/scissors.png b/resources/scissors.png new file mode 100644 index 0000000..d0b8bcb Binary files /dev/null and b/resources/scissors.png differ diff --git a/resources/vcrosdmonorusbyd.ttf b/resources/vcrosdmonorusbyd.ttf new file mode 100644 index 0000000..5c10de0 Binary files /dev/null and b/resources/vcrosdmonorusbyd.ttf differ diff --git a/rockPaperScissors.rc b/rockPaperScissors.rc new file mode 100644 index 0000000..46227e3 --- /dev/null +++ b/rockPaperScissors.rc @@ -0,0 +1 @@ +IDI_ICON1 ICON "/resources/icon.ico"