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$ ** ******************************************************************************/
pragma singleton; import QtQuick 2.0 Item { property int appSize: 390 readonly property int animationDuration: 400 readonly property int gameStartDelay: 5000 readonly property color colorAppBackground: "black" readonly property color colorPageBackground: "#1b1d1e" readonly property color colorLines: "#464747" readonly property color colorHighlight: "#ef7427" readonly property color colorText: "#ffffff" readonly property color colorButtonBackground: "#363738" readonly property color colorLightText: "#6c604e" readonly property color colorArrowBackground: "#404141" readonly property color colorWarning: "#ef2727" // used for frames, lines and similar structures readonly property int lineSize: Math.max(appSize * 0.01, 2) readonly property int listSpacing: appSize * 0.05 readonly property int marginDefault: appSize * 0.08 readonly property int marginBig: appSize * 0.15 readonly property int buttonHeight: appSize * 0.15 readonly property int buttonTextMargins: buttonHeight * 0.2 readonly property int buttonRadius: 4 readonly property int swipeAreaSizeDefault: appSize * 0.18 readonly property int swipeAreaSizeSmall: appSize * 0.12 readonly property int swipeThreshold: appSize * 0.2 // min distance of position to center for a touch to be taken into account readonly property int swipeCircleMinDistance: appSize * 0.25 // how many degrees a circular swipe must cover to trigger. // swipe angle calculations will fail if the threshold nears 180. readonly property int swipeArcThreshold: 60 // pixel sizes for smaller resolutions (272 pixel height like MIMXRT1064) readonly property font lowResFontSmall : Qt.font({ pixelSize: 14, unicodeCoverage: [Font.UnicodeBlock_BasicLatin]}) readonly property font lowResFontMedium : Qt.font({ pixelSize: 28, unicodeCoverage: [Font.UnicodeBlock_BasicLatin]}) readonly property font lowResFontBig : Qt.font({ pixelSize: 42, unicodeCoverage: [Font.UnicodeBlock_BasicLatin]}) // font sizes for medium resolutions (390 pixel height) readonly property font mediumResFontSmall : Qt.font({ pixelSize: 20, unicodeCoverage: [Font.UnicodeBlock_BasicLatin]}) readonly property font mediumResFontMedium : Qt.font({ pixelSize: 40, unicodeCoverage: [Font.UnicodeBlock_BasicLatin]}) readonly property font mediumResFontBig : Qt.font({ pixelSize: 60, unicodeCoverage: [Font.UnicodeBlock_BasicLatin]}) readonly property font textFontSmall: appSize < 300 ? lowResFontSmall : mediumResFontSmall readonly property font textFontDefault: appSize < 300 ? lowResFontMedium : mediumResFontMedium readonly property font textFontBig: appSize < 300 ? lowResFontBig : mediumResFontBig }