refactor
6
.gitmodules
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
[submodule "QuasarAppLib"]
|
||||
path = QuasarAppLib
|
||||
url = https://github.com/QuasarApp/QuasarAppLib.git
|
||||
[submodule "CQtDeployer"]
|
||||
path = CQtDeployer
|
||||
url = https://github.com/QuasarApp/Console-QtDeployer.git
|
1
CQtDeployer
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 56afcefd5a790cc54ef8935ff52a02f86cb381d7
|
1
QuasarAppLib
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 89b880fdd0f33361a6958da9de2acdf1c71f9a78
|
0
android/gradle/wrapper/gradle-wrapper.jar → Snake/android/gradle/wrapper/gradle-wrapper.jar
vendored
0
android/gradlew → Snake/android/gradlew
vendored
Before ![]() (image error) Size: 2.4 KiB After ![]() (image error) Size: 2.4 KiB ![]() ![]() |
Before ![]() (image error) Size: 2.4 KiB After ![]() (image error) Size: 2.4 KiB ![]() ![]() |
Before ![]() (image error) Size: 2.4 KiB After ![]() (image error) Size: 2.4 KiB ![]() ![]() |
@ -81,9 +81,10 @@ double Snake::sizeByLvl(double lvl , int count) const {
|
||||
double pos = (1 - (lvl / count));
|
||||
|
||||
QList<QPair<double, double>> snakeGradientSize {
|
||||
{1, 7},
|
||||
{0.9, 5},
|
||||
{0.8, 6},
|
||||
{1, 4},
|
||||
{0.99, 7},
|
||||
{0.8, 5},
|
||||
{0.6, 6},
|
||||
{0.0, 3}
|
||||
};
|
||||
|
Before ![]() (image error) Size: 52 KiB After ![]() (image error) Size: 52 KiB ![]() ![]() |
27
Snake/front-end/About.qml
Normal file
@ -0,0 +1,27 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls.Material 2.0
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
Page {
|
||||
|
||||
title: "Page"
|
||||
header: Rectangle {
|
||||
height: parent.height * 0.1
|
||||
color: "#cccccc"
|
||||
Label {
|
||||
id: title
|
||||
text: qsTr("About")
|
||||
font.pointSize: 13
|
||||
wrapMode: Text.WordWrap
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
anchors.fill: parent;
|
||||
anchors.margins: 5
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: AboutPage{
|
||||
}
|
||||
|
||||
}
|
75
Snake/front-end/AboutPage.qml
Normal file
@ -0,0 +1,75 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Controls.Material 2.0
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
Item {
|
||||
clip: true
|
||||
ColumnLayout {
|
||||
id: columnLayout
|
||||
anchors.fill: parent
|
||||
spacing: 10
|
||||
|
||||
Rectangle {
|
||||
Layout.preferredHeight: parent.width / 4
|
||||
Layout.preferredWidth: parent.width / 4
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
||||
color: "#00000000"
|
||||
Image {
|
||||
id: aboutLogo
|
||||
fillMode: Image.PreserveAspectFit
|
||||
|
||||
source: "qrc:/logo/logo"
|
||||
anchors.margins: 10
|
||||
anchors.fill: parent
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Flickable {
|
||||
id: flickable
|
||||
clip: true
|
||||
flickableDirection: Flickable.VerticalFlick
|
||||
|
||||
Layout.preferredHeight: parent.height - parent.height / 2.8
|
||||
|
||||
|
||||
TextArea.flickable: TextArea {
|
||||
id: textArea
|
||||
textFormat: Qt.RichText
|
||||
wrapMode: TextArea.Wrap
|
||||
readOnly: true
|
||||
persistentSelection: true
|
||||
|
||||
leftPadding: 6
|
||||
rightPadding: 6
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
background: null
|
||||
|
||||
text: qsTr("Управление игрой происходит посредством нажатия на тачпад вашего устройства, чем чаще нажимаете, тем быстрее двигается змейка. Каждое последующее нажатие, изменяет направление змейки, в противоположную сторону.
|
||||
Цель игры набрать максимальное количество очков. Количество очков зависит от пройденного расстояния. \n
|
||||
Автор: Янкович Роман. Группа 10903516");
|
||||
anchors.fill: parent
|
||||
font.family: "Verdana"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignTop
|
||||
|
||||
onLinkActivated: Qt.openUrlExternally(link)
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar { }
|
||||
Layout.fillWidth: true
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*##^## Designer {
|
||||
D{i:0;autoSize:true;height:480;width:640}
|
||||
}
|
||||
##^##*/
|
66
Snake/front-end/BasePopUp.qml
Normal file
@ -0,0 +1,66 @@
|
||||
import QtQuick 2.11
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Controls.Material 2.0
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
Popup {
|
||||
id : basePopup
|
||||
width: 200
|
||||
height: 100
|
||||
x: 0
|
||||
y: 0
|
||||
|
||||
transformOrigin: Item.Center
|
||||
|
||||
property bool autoClose: true
|
||||
property int closeInterval: 15000;
|
||||
property int margin : 0
|
||||
|
||||
NumberAnimation {
|
||||
id: animation;
|
||||
target: basePopup
|
||||
property: "opacity"
|
||||
easing.period: 0.33
|
||||
easing.amplitude: 1
|
||||
duration: 2000
|
||||
easing.type: Easing.OutElastic
|
||||
|
||||
onStopped: {
|
||||
if (to < 1)
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
function _show() {
|
||||
animation.from = 0;
|
||||
animation.to = 1;
|
||||
animation.start();
|
||||
|
||||
if (autoClose) {
|
||||
timerAnimation.start();
|
||||
}
|
||||
|
||||
open();
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: timerAnimation;
|
||||
running: false;
|
||||
repeat: false;
|
||||
|
||||
onTriggered: {
|
||||
animation.from = 1;
|
||||
animation.to = 0;
|
||||
animation.start();
|
||||
}
|
||||
}
|
||||
|
||||
onClosed: {
|
||||
if (autoClose)
|
||||
opacity = 0;
|
||||
}
|
||||
|
||||
closePolicy: (autoClose)? Popup.NoAutoClose: Popup.CloseOnReleaseOutside
|
||||
|
||||
|
||||
}
|
@ -40,12 +40,16 @@ Item {
|
||||
|
||||
Button {
|
||||
id: level
|
||||
text: qsTr("Select level")
|
||||
text: qsTr("My Status")
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
font.pixelSize: 20
|
||||
Layout.preferredHeight: item1.height / 5
|
||||
Layout.preferredWidth: item1.height * 0.8
|
||||
spacing: 2
|
||||
|
||||
onClicked: {
|
||||
// rec._show();
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
@ -73,8 +77,33 @@ Item {
|
||||
anchors.rightMargin: 23
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 20
|
||||
|
||||
onClicked: {
|
||||
about._show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PagePopUp {
|
||||
id: about;
|
||||
width: parent.width / 2
|
||||
height: parent.height / 2;
|
||||
x: parent.width / 2 - width / 2
|
||||
y: parent.height / 2 - height / 2
|
||||
|
||||
source: "About.qml"
|
||||
}
|
||||
|
||||
// PagePopUp {
|
||||
// id: rec;
|
||||
// width: parent.width / 2
|
||||
// height: parent.height / 2;
|
||||
// x: parent.width / 2 - width / 2
|
||||
// y: parent.height / 2 - height / 2
|
||||
|
||||
// source: "RecordsPage.qml"
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
/*##^## Designer {
|
@ -3,38 +3,10 @@ import QtQuick.Controls 2.3
|
||||
import QtQuick.Controls.Material 2.0
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
Popup {
|
||||
BasePopUp {
|
||||
id : popup
|
||||
width: 200
|
||||
height: 100
|
||||
x: 0
|
||||
y: 0
|
||||
transformOrigin: Item.Center
|
||||
|
||||
property bool autoClose: true
|
||||
property int closeInterval: 15000;
|
||||
property int margin : 0
|
||||
|
||||
NumberAnimation {
|
||||
id: animation;
|
||||
target: popup
|
||||
property: "opacity"
|
||||
easing.period: 0.33
|
||||
easing.amplitude: 1
|
||||
duration: 2000
|
||||
easing.type: Easing.OutElastic
|
||||
|
||||
onStopped: {
|
||||
if (to < 1)
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
function show(title_, message_, img_) {
|
||||
animation.from = 0;
|
||||
animation.to = 1;
|
||||
animation.start();
|
||||
|
||||
title.text = title_;
|
||||
message.text = message_;
|
||||
if (img_) {
|
||||
@ -43,27 +15,7 @@ Popup {
|
||||
image.source = "";
|
||||
}
|
||||
|
||||
if (autoClose) {
|
||||
timerAnimation.start();
|
||||
}
|
||||
|
||||
open();
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: timerAnimation;
|
||||
running: false;
|
||||
repeat: false;
|
||||
|
||||
onTriggered: {
|
||||
animation.from = 1;
|
||||
animation.to = 0;
|
||||
animation.start();
|
||||
}
|
||||
}
|
||||
|
||||
onClosed: {
|
||||
opacity = 0;
|
||||
_show();
|
||||
}
|
||||
|
||||
Page {
|
||||
@ -71,6 +23,7 @@ Popup {
|
||||
title: "Level Up!!!"
|
||||
anchors.fill: parent
|
||||
|
||||
|
||||
Label {
|
||||
id: title
|
||||
x: 0
|
||||
@ -132,7 +85,6 @@ Popup {
|
||||
}
|
||||
}
|
||||
}
|
||||
closePolicy: Popup.NoAutoClose
|
||||
|
||||
|
||||
}
|
23
Snake/front-end/PagePopUp.qml
Normal file
@ -0,0 +1,23 @@
|
||||
import QtQuick 2.11
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Controls.Material 2.0
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
BasePopUp {
|
||||
id: pagePopUp
|
||||
property string source: ""
|
||||
autoClose: false
|
||||
|
||||
Loader {
|
||||
id: sour
|
||||
anchors.fill: parent
|
||||
source: (pagePopUp.source)? pagePopUp.source: "Item.qml";
|
||||
|
||||
Connections {
|
||||
target: sour.item
|
||||
onClose: {
|
||||
pagePopUp.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
47
Snake/front-end/TextInput.qml
Normal file
@ -0,0 +1,47 @@
|
||||
import QtQuick 2.11
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Controls.Material 2.0
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
|
||||
Item {
|
||||
|
||||
signal close();
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
|
||||
|
||||
Label {
|
||||
text: qsTr("Write you name ");
|
||||
|
||||
}
|
||||
|
||||
TextField {
|
||||
|
||||
id: input;
|
||||
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
}
|
||||
|
||||
Button {
|
||||
|
||||
id: ok
|
||||
text: qsTr("Ok")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
|
||||
onClicked: {
|
||||
if (contr) {
|
||||
var rec = contr.getRecords()
|
||||
rec.append(input.text, contr.generalLong);
|
||||
}
|
||||
|
||||
close();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Before ![]() (image error) Size: 28 KiB After ![]() (image error) Size: 28 KiB ![]() ![]() |
Before ![]() (image error) Size: 186 KiB After ![]() (image error) Size: 186 KiB ![]() ![]() |
Before ![]() (image error) Size: 79 KiB After ![]() (image error) Size: 79 KiB ![]() ![]() |
Before (image error) Size: 2.5 KiB After (image error) Size: 2.5 KiB |
Before (image error) Size: 32 KiB After (image error) Size: 32 KiB |
Before ![]() (image error) Size: 2.4 KiB After ![]() (image error) Size: 2.4 KiB ![]() ![]() |
Before (image error) Size: 1.3 KiB After (image error) Size: 1.3 KiB |
@ -5,9 +5,13 @@
|
||||
<file>front-end/MainMenu.qml</file>
|
||||
<file>qtquickcontrols2.conf</file>
|
||||
<file>front-end/Scene.qml</file>
|
||||
<file>front-end/Image.qml</file>
|
||||
<file>front-end/NotificationForm.qml</file>
|
||||
<file>front-end/SnakeItem.qml</file>
|
||||
<file>front-end/About.qml</file>
|
||||
<file>front-end/AboutPage.qml</file>
|
||||
<file>front-end/BasePopUp.qml</file>
|
||||
<file>front-end/TextInput.qml</file>
|
||||
<file>front-end/PagePopUp.qml</file>
|
||||
</qresource>
|
||||
<qresource prefix="/texture">
|
||||
<file alias="up">img/up.svg</file>
|
@ -1,5 +1,5 @@
|
||||
QT += quick
|
||||
CONFIG += c++11
|
||||
CONFIG += c++17
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which as been marked deprecated (the exact warnings
|
||||
@ -31,6 +31,14 @@ SOURCES += \
|
||||
|
||||
RESOURCES += qml.qrc
|
||||
|
||||
|
||||
CONFIG(release, debug|release): {
|
||||
DESTDIR = $$PWD/build/release
|
||||
|
||||
} else {
|
||||
DESTDIR = $$PWD/build/debug
|
||||
}
|
||||
|
||||
# Additional import path used to resolve QML modules in Qt Creator's code model
|
||||
QML_IMPORT_PATH =
|
||||
|
||||
@ -66,7 +74,8 @@ DISTFILES += \
|
||||
android/res/values/libs.xml \
|
||||
android/build.gradle \
|
||||
android/gradle/wrapper/gradle-wrapper.properties \
|
||||
android/gradlew.bat
|
||||
android/gradlew.bat \
|
||||
front-end/PagePopUp.qml
|
||||
|
||||
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
|
||||
|
13
SnakeMain.pro
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
TEMPLATE = subdirs
|
||||
CONFIG += ordered
|
||||
|
||||
SUBDIRS += \
|
||||
QuasarAppLib \
|
||||
CQtDeployer \
|
||||
Snake
|
||||
|
||||
QuasarAppLib.file = QuasarAppLib/QuasarApp.pro
|
||||
Snake.file = Snake/snake.pro
|
||||
Snake.depends = QuasarAppLib CQtDeployer
|
||||
|
@ -1,8 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls.Material 2.0
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
Image {
|
||||
id: image
|
||||
}
|