Skip to content

Commit

Permalink
Merge pull request #84 from Northeastern-Electric-Racing/#82-Add-Games
Browse files Browse the repository at this point in the history
#82 add games
  • Loading branch information
Peyton-McKee authored Feb 28, 2024
2 parents c8af005 + d81b9f1 commit eccc581
Show file tree
Hide file tree
Showing 28 changed files with 1,245 additions and 13 deletions.
6 changes: 6 additions & 0 deletions NERODevelopment/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ set(PROJECT_SOURCES
src/controllers/offviewcontroller.h
src/controllers/buttoncontroller.h
src/controllers/navigationcontroller.h
src/controllers/flappybirdcontroller.h
src/controllers/keyboardcontroller.h
src/controllers/configurationcontroller.h

src/models/mock_model.h
src/models/model.h
Expand All @@ -44,6 +47,9 @@ set(PROJECT_SOURCES
src/controllers/offviewcontroller.cpp
src/controllers/buttoncontroller.cpp
src/controllers/navigationcontroller.cpp
src/controllers/flappybirdcontroller.cpp
src/controllers/keyboardcontroller.cpp
src/controllers/configurationcontroller.cpp

src/models/mock_model.cpp
src/models/model.cpp
Expand Down
8 changes: 8 additions & 0 deletions NERODevelopment/content/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,16 @@ qt6_add_qml_module(content
DescriptionModal.qml
NavigationController.qml
HomeMenuItem.qml
FlappyBird.qml
KeyboardInput.qml
Keyboard.qml
KeyboardController.qml
Configuration.qml

RESOURCES
fonts/fonts.txt
fonts/Roboto-Black.ttf
images/bg.png
images/pipe.png
images/flappy-bird.png
)
141 changes: 141 additions & 0 deletions NERODevelopment/content/Configuration.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
import QtQuick 2.15
import QtQuick.Controls
import NERO

Item {
id: configuration
anchors.fill: parent
property string title: "Configuration"
property string driverText: ""
property string locationText: ""
property string systemText: ""
property int selectedConfigurationIndex: configurationController.selectedConfigurationIndex
property bool isKeyboardSelected: configurationController.isKeyboardSelected
property int inputHeight: 70
property bool isFocused: false
focus: isFocused

Keys.onPressed: event => {
switch (event.key) {
case Qt.Key_Up:
configurationController.upButtonPressed()
break
case Qt.Key_Down:
configurationController.downButtonPressed()
break
case Qt.Key_Return:
configurationController.enterButtonPressed()
break
}
}

onVisibleChanged: {
if (visible) {
isFocused = false
isFocused = true
}
}

onIsFocusedChanged: {
focus = isFocused
console.log("setting focus to", isFocused, focus)
}

ValueText {
id: title
anchors.top: parent.top
anchors.topMargin: 5
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Configuration")
}

Row {
id: driverBackground
anchors.top: title.bottom
anchors.topMargin: 5
anchors.horizontalCenter: parent.horizontalCenter

KeyboardInput {
id: driverKeyboard
label: "Enter Driver"
onAccepted: {
configuration.driverText = text
configuration.isFocused = false
configuration.isFocused = true
configurationController.setDriverName(text)
configurationController.setIsKeyboardSelected(false)
}
selected: configuration.isKeyboardSelected
&& configuration.selectedConfigurationIndex === 0

border.width: configuration.selectedConfigurationIndex === 0 ? 2 : 0
border.color: "blue"
height: configuration.inputHeight
}
}

Row {
id: locationBackground
anchors.top: driverBackground.bottom
anchors.topMargin: 5
anchors.horizontalCenter: parent.horizontalCenter

KeyboardInput {
label: "Enter Location"
onAccepted: {
configuration.locationText = text
configuration.isFocused = false
configuration.isFocused = true
configurationController.setLocationName(text)
configurationController.setIsKeyboardSelected(false)
}
selected: configuration.isKeyboardSelected
&& configuration.selectedConfigurationIndex === 1

border.width: configuration.selectedConfigurationIndex === 1 ? 2 : 0
border.color: "blue"
height: configuration.inputHeight
}
}

Row {
id: systemBackground
anchors.top: locationBackground.bottom
anchors.topMargin: 5
anchors.horizontalCenter: parent.horizontalCenter
KeyboardInput {
label: "Enter System"
onAccepted: {
configuration.systemText = text
configuration.isFocused = false
configuration.isFocused = true
configurationController.setSystemName(text)
configurationController.setIsKeyboardSelected(false)
}
selected: configuration.isKeyboardSelected
&& configuration.selectedConfigurationIndex === 2

border.width: configuration.selectedConfigurationIndex === 2 ? 2 : 0
border.color: "blue"
height: configuration.inputHeight
}
}

Button {
id: submitButton
anchors.top: systemBackground.bottom
anchors.topMargin: 5
anchors.horizontalCenter: parent.horizontalCenter

background: Rectangle {
border.color: "blue"
border.width: configuration.selectedConfigurationIndex === 3 ? 2 : 0
radius: 10
}

contentItem: LabelText {
text: "Save"
color: "black"
}
}
}
14 changes: 10 additions & 4 deletions NERODevelopment/content/DebugTable.qml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Item {
anchors.top: parent.top
anchors.bottom: parent.bottom
width: parent.width / 4
color: 'black'

HorizontalHeaderView {
id: topicsHeader
Expand Down Expand Up @@ -74,9 +75,11 @@ Item {
implicitWidth: topicsTableView.width
implicitHeight: debugTable.rowHeight
border.width: scrollingTopics
&& model.index === debugTable.selectedTopicIndex ? 5 : 1
&& model.index === debugTable.selectedTopicIndex ? 3 : 1
color: 'black'
border.color: 'white'

Text {
LabelText {
text: display
anchors.centerIn: parent
}
Expand All @@ -88,6 +91,7 @@ Item {
anchors.top: parent.top
anchors.bottom: parent.bottom
width: parent.width * 3 / 4
color: 'black'

HorizontalHeaderView {
id: valuesHeader
Expand Down Expand Up @@ -125,9 +129,11 @@ Item {
implicitWidth: parent.width / 3
implicitHeight: debugTable.rowHeight
border.width: !scrollingTopics
&& model.index === debugTable.selectedValueIndex ? 5 : 1
&& model.index === debugTable.selectedValueIndex ? 3 : 1
color: 'black'
border.color: 'white'

Text {
LabelText {
anchors.centerIn: parent
text: display
}
Expand Down
Loading

0 comments on commit eccc581

Please sign in to comment.