-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from Northeastern-Electric-Racing/snake-button
added snake button to home menu
- Loading branch information
Showing
7 changed files
with
97 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ Rectangle { | |
LabelText { | ||
id: label | ||
padding: 8 | ||
font.pixelSize: 16 | ||
font.pixelSize: 12 | ||
text: parent.text | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import QtQuick 2.15 | ||
import QtQuick.Controls 2.15 | ||
|
||
Rectangle { | ||
id: snake | ||
|
||
anchors.fill: parent | ||
focus: snake.isFocused | ||
visible: true | ||
|
||
property bool isFocused: false | ||
|
||
width: 800 | ||
height: 480 | ||
color: "black" | ||
|
||
property int minX: 200 | ||
property int maxX: 600 | ||
property int minY: 40 | ||
property int maxY: 440 | ||
|
||
property var snakeBody: [{"x": 300, "y": 300}, {"x": 280, "y": 300}, {"x": 260, "y": 300}] | ||
property int segmentSize: 20 | ||
property string direction: "right" | ||
|
||
property int score: 0 | ||
|
||
Rectangle { | ||
width: 400 | ||
height: 400 | ||
anchors.centerIn: parent | ||
border.color: "white" | ||
border.width: 2 | ||
color: "transparent" | ||
} | ||
|
||
Text { | ||
id: scoreText | ||
text: "Score: " + snake.score | ||
font.pixelSize: 24 | ||
color: "white" | ||
anchors.top: parent.top | ||
anchors.horizontalCenter: parent.horizontalCenter | ||
anchors.topMargin: 10 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import QtQuick 2.15 | ||
import QtQuick.Controls 2.15 | ||
|
||
Item { | ||
id: food | ||
property int dimension: 20 | ||
|
||
width: dimension | ||
height: dimension | ||
|
||
Rectangle { | ||
id: foodColor | ||
height: dimension | ||
width: dimension | ||
color: "lime" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import QtQuick 2.15 | ||
import QtQuick.Controls 2.15 | ||
|
||
Item { | ||
id: food | ||
property int dimension: 20 | ||
|
||
width: dimension | ||
height: dimension | ||
|
||
Rectangle { | ||
id: foodColor | ||
height: dimension | ||
width: dimension | ||
color: "red" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters