C

Qt Quick Ultralite swipe_game Demo

/****************************************************************************** ** ** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Ultralite module. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ******************************************************************************/
import QtQuick 2.0 import StyleModule 1.0 /* This component controls the visibility of the game views. It also adds a MouseArea (plus visual feedback) to abort the game from anywhere in these views. */ Item { id: root signal gameAborted() implicitWidth: Style.appSize implicitHeight: Style.appSize onVisibleChanged: { gameRunningView.visible = false gameOverView.visible = false gameStartView.visible = visible } MouseArea { id: stopArea anchors.fill: parent enabled: root.visible onPressAndHold: root.gameAborted() } GameStartView { id: gameStartView visible: false onGameStarted: { visible = false gameRunningView.visible = true } } GameRunningView { id: gameRunningView visible: false onGameOver: { visible = false gameOverView.visible = true } onGameAborted: { root.gameAborted() } } GameOverView { id: gameOverView visible: false } Image { anchors.fill: parent source: "mask_circle_highlight.svg" visible: stopArea.pressed } }