Warning, /education/gcompris/src/activities/oware/Board.qml is written in an unsupported language. File is not indexed.

0001 /* GCompris - Board.qml
0002  *
0003  * SPDX-FileCopyrightText: 2021 Harsh Kumar <hadron43@yahoo.com>
0004  *
0005  * Authors:
0006  *   Harsh Kumar <hadron43@yahoo.com>
0007  *   Timothée Giet <animtim@gmail.com> (redesign)
0008  *
0009  *   SPDX-License-Identifier: GPL-3.0-or-later
0010  */
0011 
0012 import QtQuick 2.12
0013 import GCompris 1.0
0014 
0015 import "../../core"
0016 import "oware.js" as Activity
0017 
0018 Rectangle {
0019     id: board
0020     color: "#80FFFFFF"
0021     radius: pitWidth / 2
0022     height: topSideBg.height * 3
0023     opacity: 1
0024 
0025     property double margin: 15 * ApplicationInfo.ratio
0026     property double pitWidth: (width - 7 * margin) / numberOfPitsInOneRow
0027     property alias pitRepeater1: pitRepeater1
0028     property alias pitRepeater2: pitRepeater2
0029 
0030     readonly property int numberOfPitsInOneRow: 6
0031 
0032     signal init
0033     onInit: {
0034         for(var i = 0; i < numberOfPitsInOneRow; ++i) {
0035             pitRepeater1.itemAt(i).seeds = 4
0036             pitRepeater2.itemAt(i).seeds = 4
0037             pitRepeater1.itemAt(i).index = pitRepeater2.itemAt(i).index = i
0038         }
0039     }
0040 
0041     Image {
0042         id: topSideBg
0043         source: Activity.url + "boardSide.svg"
0044         width: parent.width
0045         height: rowPlayer1.height * 1.5
0046         sourceSize.width: width
0047         sourceSize.height: height
0048         anchors.horizontalCenter: parent.horizontalCenter
0049         anchors.bottom: parent.verticalCenter
0050     }
0051 
0052     Image {
0053         id: bottomSideBg
0054         source: Activity.url + "boardSide.svg"
0055         width: parent.width
0056         height: topSideBg.height
0057         sourceSize.width: width
0058         sourceSize.height: height
0059         rotation: 180
0060         anchors.horizontalCenter: parent.horizontalCenter
0061         anchors.top: parent.verticalCenter
0062     }
0063 
0064     Row {
0065         id: rowPlayer1
0066         anchors{
0067             verticalCenter: topSideBg.verticalCenter
0068             left: parent.left
0069             leftMargin: margin
0070         }
0071         spacing: margin
0072         Repeater {
0073             id: pitRepeater1
0074             model: numberOfPitsInOneRow
0075             delegate: Pit {
0076                 player: 1
0077                 width: pitWidth
0078             }
0079         }
0080     }
0081 
0082     Row {
0083         id: rowPlayer2
0084         anchors{
0085             verticalCenter: bottomSideBg.verticalCenter
0086             left: parent.left
0087             leftMargin: margin
0088         }
0089         spacing: margin
0090         Repeater {
0091             id: pitRepeater2
0092             model: numberOfPitsInOneRow
0093             delegate: Pit {
0094                 player: 2
0095                 width: pitWidth
0096             }
0097         }
0098     }
0099 }