Add in example of working audio.

This commit is contained in:
Dorian 2018-02-22 08:03:26 -05:00
parent a1e0c9ebb1
commit 2bb6ae818e
6 changed files with 18 additions and 6 deletions

View File

@ -1,8 +1,8 @@
import QtQuick 2.0 import QtQuick 2.0
import QtMultimedia 5.8
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: "blue"
Image { Image {
source: 'images/backdrop.jpg' source: 'images/backdrop.jpg'
@ -49,6 +49,17 @@ Rectangle {
MenuButton { MenuButton {
buttonText: "Save Game" buttonText: "Save Game"
// disabled: true // disabled: true
function actionOnClick() {
pingSound.seek(0)
pingSound.play()
}
// From: https://freesound.org/people/edsward/sounds/341871/
Audio {
id: pingSound
source: 'assets/ping.wav'
autoLoad: true
}
} }
MenuButton { MenuButton {

View File

@ -14,7 +14,7 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - 50 width: parent.width - 50
height: 50 height: parent.parent.height * 0.1
radius: 10 radius: 10
color: backgroundAtRest color: backgroundAtRest
@ -34,7 +34,7 @@ Rectangle {
Text { Text {
text: buttonText text: buttonText
font.pointSize: 18 font.pointSize: parent.height * 0.2
font.bold: true font.bold: true
height: 30 height: 30

BIN
assets/ping.wav Normal file

Binary file not shown.

View File

@ -1,4 +1,4 @@
QT += quick QT += quick multimedia multimediawidgets
CONFIG += c++11 CONFIG += c++11
# The following define makes your compiler emit warnings if you use # The following define makes your compiler emit warnings if you use

View File

@ -7,8 +7,8 @@ Window {
property var appVersion: "0.4.0" property var appVersion: "0.4.0"
visible: true visible: true
width: 800 width: 540
height: 600 height: 960
title: qsTr("justCheckers v" + appVersion) title: qsTr("justCheckers v" + appVersion)
Loader { Loader {

View File

@ -15,5 +15,6 @@
<file>images/play.png</file> <file>images/play.png</file>
<file>images/splash.jpg</file> <file>images/splash.jpg</file>
<file>MenuButton.qml</file> <file>MenuButton.qml</file>
<file>assets/ping.wav</file>
</qresource> </qresource>
</RCC> </RCC>