Skip to content

Commit

Permalink
game information added to drawer
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahdijamebozorg committed Aug 29, 2021
1 parent 5a1e27a commit 1f3f0ab
Show file tree
Hide file tree
Showing 9 changed files with 644 additions and 240 deletions.
Binary file modified Advanced_Chess
Binary file not shown.
2 changes: 1 addition & 1 deletion Advanced_Chess.pro.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.0, 2021-08-29T06:29:43. -->
<!-- Written by QtCreator 4.10.0, 2021-08-29T06:45:02. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
Expand Down
Binary file added Assets/Icons/info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions InfoDialog.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import QtQuick 2.9
import QtQuick.Controls 2.5
import QtQuick.Dialogs 1.2
import QtQuick.Window 2.3

Dialog {
id: infoDialog
title: persian.checked ? "Info" : "اطلاعات"
standardButtons: Dialog.Close
width: Screen.width * 0.5
height: Screen.height * 0.4
contentItem: Rectangle {
color: "black"
ScrollView {
anchors.fill: parent
clip: true
Text {
id: info
color: "white"
text: "
This game is a modified 2P chess with all chess rules plus some features:\n
Score:\n
\t Score is the key to win in this game, some movement have score:\n
\t Hit: Pawn->+3 , Queen->+15 , others->+8 (you can't hit king!)\n
\t Move: Pawn pass away half of board ->+3 , Check enemy king ->+10 , checkmate ->+50\n
\t Extra move: if you have 30 scores, you can make an extram move!\n\n
Negative score:\n
\t Some works add your negatice score , if your negative score reachs 15 , you will have a random move.\n
\t Undo: return last moved piece and adds 5 negative scores\n
\t Touch piece: if you choose a moveable piece and reselct in this turn, you'll get 5 negative scores\n\n
***Important notes***\n
\t Game has auto save and you can continue crashed or closed games\n
\t Negative scores won't be saved in file\n
\t For game name, if a file exists with the same name, file will be overwriten\n
\t In promotion, if you don't choose any chessman, game will crash\n
\t Canceling game will delete save file and restarting will clear move history in file\n
\t Saved Files with free spaces or unreadable moves, won't be opened\n
"
}
}
}
}
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ compiler_rcc_clean:
-$(DEL_FILE) qrc_qml.cpp
qrc_qml.cpp: qml.qrc \
/opt/Qt5.13.1/5.13.1/gcc_64/bin/rcc \
InfoDialog.qml \
BoardBottomSide.qml \
MainPage.qml \
LoadGameDialog.qml \
Expand Down Expand Up @@ -771,6 +772,7 @@ qrc_qml.cpp: qml.qrc \
Assets/Icons/BRook.png \
Assets/Icons/WQueen.png \
Assets/Icons/WBishop.png \
Assets/Icons/info.png \
Assets/Images/Wood5.jpg \
Assets/Images/Main.jpg \
Assets/Images/Board.jpg \
Expand Down
63 changes: 46 additions & 17 deletions main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ ApplicationWindow {
minimumWidth: 700
title: persian.checked ? "شطرنج پیشرفته" : "Advanced Chess"

InfoDialog {
id: infoDialog
}

header: ToolBar {
id: toolbar
height: window.height * 0.05
Expand Down Expand Up @@ -41,26 +45,51 @@ ApplicationWindow {
id: drawer
width: window.width * 0.25
height: window.height

Column {
Rectangle {
anchors.fill: parent
color: "black"
Column {
anchors.fill: parent

Switch {
id: soundOn
text: persian.checked ? "صدا" : "Sound"
checked: true
}
Switch {
id: persian
text: "پارسی"
checked: false
Switch {
id: soundOn
text: persian.checked ? "صدا" : "Sound"
checked: true
}
Switch {
id: persian
text: "پارسی"
checked: false
}
Switch {
id: fullScreen
text: persian.checked ? "تمام صفحه" : "FullScreen"
checked: true
onCheckedChanged: {
this.checked ? window.showFullScreen(
) : window.showNormal()
}
}
}
Switch {
id: fullScreen
text: persian.checked ? "تمام صفحه" : "FullScreen"
checked: true
onCheckedChanged: {
this.checked ? window.showFullScreen() : window.showNormal()
Rectangle {
anchors.bottom: parent.bottom
anchors.bottomMargin: 8
anchors.left: parent.left
anchors.leftMargin: 8
width: parent.width * 0.2
height: parent.height * 0.06
Image {
anchors.fill: parent
source: "qrc:/Assets/Icons/info.png"
}
Button {
anchors.fill: parent
flat: true
id: infBtn
onPressed: {
infoDialog.open()
drawer.close()
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
<file>Assets/Sound_Effects/move.mp3</file>
<file>LoadGameDialog.qml</file>
<file>Assets/Musics/Johann_Johannsson_Flight_From_The_City_2021.mp3</file>
<file>InfoDialog.qml</file>
<file>Assets/Icons/info.png</file>
<file>Assets/Icons/delete.png</file>
</qresource>
</RCC>
Loading

0 comments on commit 1f3f0ab

Please sign in to comment.