Skip to content

Commit

Permalink
Merge branch 'feature/colors' into 'main'
Browse files Browse the repository at this point in the history
Feature/colors

See merge request asxa86/aspire!20
  • Loading branch information
ASxa86 committed Nov 14, 2024
2 parents 496baa6 + 9f1b561 commit b0916dc
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 72 deletions.
13 changes: 12 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,20 @@
"cmake/preset/use-gcc.json",
"cmake/preset/use-msvc.json",
"cmake/preset/use-ninja.json",
"cmake/preset/use-vcpkg.json"
"cmake/preset/use-vcpkg.json",
"cmake/preset/use-visualstudio.json"
],
"configurePresets": [
{
"name": "x64-windows-visualstudio",
"inherits": [
"host-x64-windows",
"target-x64-windows",
"config-build-dir",
"use-visualstudio",
"use-vcpkg"
]
},
{
"name": "x64-windows-msvc-debug",
"inherits": [
Expand Down
7 changes: 7 additions & 0 deletions app/edh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,10 @@ if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL Android)

install(SCRIPT ${deploy_script})
endif()

# Make it possible to easily debug applications throug the visual studio debugger.
if(MSVC)
set(PROJECT_VCPKG_ROOT ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>)
set(PROJECT_IMPORT_DIR ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR}/module ${PROJECT_VCPKG_ROOT}/Qt6/qml)
set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_ENVIRONMENT "PATH=%PATH%;${PROJECT_VCPKG_ROOT}/bin\nQML_IMPORT_PATH=${PROJECT_IMPORT_DIR}\nQT_PLUGIN_PATH=${PROJECT_VCPKG_ROOT}/Qt6/plugins")
endif()
6 changes: 5 additions & 1 deletion app/edh/Counter.qml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ Rectangle {
Rectangle {
width: parent.width
height: parent.height * 0.1
color: Qt.rgba(0, 0, 0, 0.3)

Component.onCompleted: {
color = Style.color.cardback;
color.a = 0.3;
}

TextEDH {
id: time
Expand Down
35 changes: 16 additions & 19 deletions app/edh/Main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Window {
height: 720
visible: true
visibility: Qt.platform.os == "android" ? Window.FullScreen : Window.AutomaticVisibility
color: "#1F0C0A"
color: Style.color.cardback
title: "EDH"

ModelPlayers {
Expand All @@ -21,7 +21,7 @@ Window {
anchors.fill: parent
columns: 2
rows: 2
columnSpacing: parent.width / 24
columnSpacing: parent.width / 20

Repeater {
id: repeater
Expand All @@ -34,10 +34,11 @@ Window {
Layout.fillHeight: true
Layout.fillWidth: true

// required property int index
// required property color color
// required property bool selected
// required property int life
required property int index
required property color background
required property bool selected
required property int life
required property int time

rotation: index < layout.rows == 0 ? 0 : 180
clip: true
Expand All @@ -56,13 +57,12 @@ Window {
layer.enabled: true
layer.effect: MultiEffect {
blurEnabled: true
blur: 0.7
blur: 0
brightness: 0.5
}

radius: width / 16
color: "gold"
scale: 0.94
color: Style.color.darkplainsBG
opacity: selected ? 1 : 0

TapHandler {
Expand All @@ -81,20 +81,17 @@ Window {
maskEnabled: true
}

scale: 0.93
scale: 0.99

Counter {
id: counter
anchors.fill: parent

color: background

gradient: Gradient {
GradientStop { position: 0.0; color: background }
GradientStop { position: 1.0; color: Qt.darker(background, 2.0) }
GradientStop { position: 1.0; color: Qt.darker(background) }
}


text: life.toString()
textTime: Qt.formatTime(new Date(time * 1000), "mm:ss")
active: selected
Expand Down Expand Up @@ -249,22 +246,22 @@ Window {
source: Icons.heart_filled
color: {
if(index == 0) {
return Style.color.verydarkyellow;
return Style.color.darkplainsBG;
}

if(index == 1) {
return Style.color.verydarkblue;
return Style.color.darkisland;
}

if(index == 2) {
return Style.color.verydarkblack;
return Style.color.darkswamp;
}

if(index == 3) {
return Style.color.verydarkred;
return Style.color.darkmountain;
}

return Style.color.verydarkgreen;
return Style.color.darkforest;
}

TextEDH {
Expand Down
54 changes: 28 additions & 26 deletions app/edh/ModelPlayers.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,34 @@ import QtQuick
ListModel {
id: player

ListElement {
background: "#BB4430"
selected: false
life: 40
time: 0
}

ListElement {
background: "#B9CEB2"
selected: false
life: 40
time: 0
}

ListElement {
background: "#7EBDC2"
selected: false
life: 40
time: 0
}

ListElement {
background: "#F3E0A5"
selected: false
life: 40
time: 0
Component.onCompleted: {
player.append({
background: Style.color.mountain,
selected: false,
life: 40,
time: 0
});

player.append({
background: Style.color.forest,
selected: false,
life: 40,
time: 0
});

player.append({
background: Style.color.island,
selected: false,
life: 40,
time: 0
});

player.append({
background: Style.color.plainsBG,
selected: false,
life: 40,
time: 0
});
}

property Connections connection: Connections {
Expand Down
63 changes: 39 additions & 24 deletions app/edh/Style.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,48 @@ QtObject {
}

property QtObject color: QtObject {
property color lightblack: "#413A3B"
property color lightred: "#D1604D"
property color lightblue: "#9ECED1"
property color lightgreen: "#D2DFCD"
property color lightyellow: "#F8ECC9"
property color lightwhite: "#FFFFFF"
// Colors used for the background of the mana symbol.
property color mountainBG: "#EB9F82"
property color forestBG: "#C4D3CA"
property color plainsBG: "#F8E7B9"
property color islandBG: "#B3CEEA"
property color swampBG: "#A69F9D"
property color cardbackBG: "#B96E2A"

property color lightmountainBG: Qt.lighter(mountainBG)
property color lightforestBG: Qt.lighter(forestBG)
property color lightplainsBG: Qt.lighter(plainsBG)
property color lightislandBG: Qt.lighter(islandBG)
property color lightswampBG: Qt.lighter(swampBG)
property color lightcardbackBG: Qt.lighter(cardbackBG)

property color black: "#231F20"
property color red: "#BB4430"
property color blue: "#7EBDC2"
property color green: "#B9CEB2"
property color yellow: "#F3E0A5"
property color white: "#EFE6DD"
property color darkmountainBG: Qt.darker(mountainBG)
property color darkforestBG: Qt.darker(forestBG)
property color darkplainsBG: Qt.darker(plainsBG)
property color darkislandBG: Qt.darker(islandBG)
property color darkswampBG: Qt.darker(swampBG)
property color darkcardbackBG: Qt.darker(cardbackBG)

property color darkblack: "#161314"
property color darkred: "#A23C2A"
property color darkblue: "#66B2B7"
property color darkgreen: "#A6BF9B"
property color darkyellow: "#EED381"
property color darkwhite: "#D6D6D6"
// Colors used for the mana symbol.
property color mountain: "#D32018"
property color forest: "#00733E"
property color plains: "#F9FAF4"
property color island: "#0E68AB"
property color swamp: "#150B00"
property color cardback: "#361915"

property color verydarkblack: "#000000"
property color verydarkred: "#622318"
property color verydarkblue: "#346C6F"
property color verydarkgreen: "#668958"
property color verydarkyellow: "#B48D18"
property color verydarkwhite: "#A3A3A3"
property color lightmountain: Qt.lighter(mountain)
property color lightforest: Qt.lighter(forest)
property color lightplains: Qt.lighter(plains)
property color lightisland: Qt.lighter(island)
property color lightswamp: Qt.lighter(swamp)
property color lightback: Qt.lighter(cardback)

property color darkmountain: Qt.darker(mountain)
property color darkforest: Qt.darker(forest)
property color darkplains: Qt.darker(plains)
property color darkisland: Qt.darker(island)
property color darkswamp: Qt.darker(swamp)
property color darkcardback: Qt.darker(cardback)
}
}
2 changes: 1 addition & 1 deletion app/edh/TextEDH.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Text {
font.family: Style.davidlibre.font.family
font.weight: Style.davidlibre.font.weight
font.styleName: Style.davidlibre.font.styleName
color: Style.color.darkwhite
color: Style.color.plains
}
13 changes: 13 additions & 0 deletions cmake/preset/use-visualstudio.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 6,
"configurePresets": [
{
"name": "use-visualstudio",
"hidden": true,
"generator": "Visual Studio 17 2022",
"cacheVariables": {
"CMAKE_COMPILE_WARNING_AS_ERROR": "ON"
}
}
]
}

0 comments on commit b0916dc

Please sign in to comment.