Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Projet Interface Graphique
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Le Tiec Aymeric
Projet Interface Graphique
Commits
93613b47
Commit
93613b47
authored
1 month ago
by
Ruf Quentin
Browse files
Options
Downloads
Patches
Plain Diff
avancement du menu de personnalisation
parent
a3332bf7
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
Jeu_2048/Case.qml
+7
-0
7 additions, 0 deletions
Jeu_2048/Case.qml
Jeu_2048/Main.qml
+6
-2
6 additions, 2 deletions
Jeu_2048/Main.qml
Jeu_2048/Menu_de_Controle.qml
+154
-0
154 additions, 0 deletions
Jeu_2048/Menu_de_Controle.qml
Jeu_2048/Partie.qml
+86
-36
86 additions, 36 deletions
Jeu_2048/Partie.qml
with
253 additions
and
38 deletions
Jeu_2048/Case.qml
+
7
−
0
View file @
93613b47
...
...
@@ -43,4 +43,11 @@ Rectangle {
color
:
value
<=
4
?
"
#776e65
"
:
"
white
"
font.family
:
"
Tahoma
"
}
Behavior
on
x
{
NumberAnimation
{
duration
:
120
;
easing.type
:
Easing
.
InOutQuad
}
}
Behavior
on
y
{
NumberAnimation
{
duration
:
120
;
easing.type
:
Easing
.
InOutQuad
}
}
}
This diff is collapsed.
Click to expand it.
Jeu_2048/Main.qml
+
6
−
2
View file @
93613b47
...
...
@@ -6,6 +6,7 @@ Window {
width
:
600
height
:
900
visible
:
true
property
bool
hasGameStarted
:
false
StackView
{
id
:
stackView
...
...
@@ -46,14 +47,17 @@ Window {
Text
{
anchors.centerIn
:
parent
text
:
"
Nouvelle Partie
"
text
:
hasGameStarted
?
"
Reprendre la partie
"
:
"
Nouvelle Partie
"
font.pixelSize
:
24
color
:
"
white
"
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
stackView
.
push
(
"
Partie.qml
"
)
onClicked
:
{
hasGameStarted
=
true
stackView
.
push
(
"
Partie.qml
"
)
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Jeu_2048/Menu_de_Controle.qml
+
154
−
0
View file @
93613b47
import
QtQuick
import
QtQuick
.
Controls
import
QtQuick
.
Layouts
Item
{
id
:
controlMenu
width
:
600
height
:
900
property
var
themes
:
{
"
Classique
"
:
{
bg
:
"
#ffffff
"
,
tiles
:
{
2
:
"
#eee4da
"
,
4
:
"
#ede0c8
"
,
8
:
"
#f2b179
"
,
16
:
"
#f59563
"
,
32
:
"
#f67c5f
"
,
64
:
"
#f65e3b
"
,
128
:
"
#edcf72
"
,
256
:
"
#edcc61
"
,
512
:
"
#edc850
"
,
1024
:
"
#edc53f
"
,
2048
:
"
#edc22e
"
},
textColors
:
{
2
:
"
#776e65
"
,
4
:
"
#776e65
"
,
8
:
"
white
"
,
16
:
"
white
"
,
32
:
"
white
"
,
64
:
"
white
"
,
128
:
"
white
"
,
256
:
"
white
"
,
512
:
"
white
"
,
1024
:
"
white
"
,
2048
:
"
white
"
}
},
"
Sombre
"
:
{
bg
:
"
#222222
"
,
tiles
:
{
2
:
"
#444
"
,
4
:
"
#555
"
,
8
:
"
#666
"
,
16
:
"
#777
"
,
32
:
"
#888
"
,
64
:
"
#999
"
,
128
:
"
#aaa
"
,
256
:
"
#bbb
"
,
512
:
"
#ccc
"
,
1024
:
"
#ddd
"
,
2048
:
"
#eee
"
},
textColors
:
{
2
:
"
white
"
,
4
:
"
white
"
,
8
:
"
white
"
,
16
:
"
white
"
,
32
:
"
white
"
,
64
:
"
white
"
,
128
:
"
black
"
,
256
:
"
black
"
,
512
:
"
black
"
,
1024
:
"
black
"
,
2048
:
"
black
"
}
},
"
Pastel
"
:
{
bg
:
"
#fcefee
"
,
tiles
:
{
2
:
"
#fae3e3
"
,
4
:
"
#f9dcdc
"
,
8
:
"
#f7d3d3
"
,
16
:
"
#f5caca
"
,
32
:
"
#f3c2c2
"
,
64
:
"
#f1baba
"
,
128
:
"
#efb2b2
"
,
256
:
"
#edadad
"
,
512
:
"
#eba6a6
"
,
1024
:
"
#e9a0a0
"
,
2048
:
"
#e79a9a
"
},
textColors
:
{
2
:
"
#70475d
"
,
4
:
"
#70475d
"
,
8
:
"
#70475d
"
,
16
:
"
#70475d
"
,
32
:
"
#70475d
"
,
64
:
"
#70475d
"
,
128
:
"
#70475d
"
,
256
:
"
#70475d
"
,
512
:
"
#70475d
"
,
1024
:
"
#70475d
"
,
2048
:
"
#70475d
"
}
}
}
property
var
selectedTheme
:
themes
[
"
Classique
"
]
signal
applyTheme
(
var
theme
)
Rectangle
{
anchors.fill
:
parent
color
:
"
#f9f6f2
"
ColumnLayout
{
anchors.centerIn
:
parent
spacing
:
30
Text
{
text
:
"
Personnalisation
"
font.pixelSize
:
28
font.bold
:
true
horizontalAlignment
:
Text
.
AlignHCenter
Layout.alignment
:
Qt
.
AlignHCenter
}
ComboBox
{
id
:
themeSelector
model
:
Object
.
keys
(
themes
)
Layout.alignment
:
Qt
.
AlignHCenter
Layout.preferredWidth
:
250
onCurrentTextChanged
:
{
selectedTheme
=
themes
[
themeSelector
.
currentText
]
}
}
Rectangle
{
width
:
260
height
:
260
radius
:
15
color
:
selectedTheme
.
bg
border.color
:
"
#aaa
"
Layout.alignment
:
Qt
.
AlignHCenter
Grid
{
anchors.centerIn
:
parent
columns
:
4
spacing
:
8
Repeater
{
model
:
[
2
,
4
,
8
,
16
,
32
,
64
,
128
,
256
,
512
,
1024
,
2048
]
Rectangle
{
width
:
50
height
:
50
radius
:
6
color
:
selectedTheme
.
tiles
[
modelData
]
||
"
#ccc
"
Text
{
anchors.centerIn
:
parent
text
:
modelData
color
:
selectedTheme
.
textColors
[
modelData
]
||
"
black
"
font.pixelSize
:
14
font.bold
:
true
}
}
}
}
}
Rectangle
{
width
:
300
height
:
60
radius
:
10
color
:
"
#8f7a66
"
Layout.alignment
:
Qt
.
AlignHCenter
Text
{
anchors.centerIn
:
parent
text
:
"
Appliquer le thème
"
color
:
"
white
"
font.pixelSize
:
20
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
applyTheme
(
selectedTheme
)
}
}
Rectangle
{
width
:
300
height
:
60
radius
:
10
color
:
"
#8f7a66
"
Layout.alignment
:
Qt
.
AlignHCenter
Text
{
anchors.centerIn
:
parent
text
:
"
Retour au menu principal
"
color
:
"
white
"
font.pixelSize
:
20
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
stackView
.
pop
()
}
}
}
}
}
This diff is collapsed.
Click to expand it.
Jeu_2048/Partie.qml
+
86
−
36
View file @
93613b47
import
QtQuick
import
QtQuick
.
Controls
import
QtQuick
2.15
import
QtQuick
.
Controls
2.15
Item
{
id
:
_item
width
:
600
height
:
900
Component.onCompleted
:
_item
.
forceActiveFocus
()
focus
:
true
Component.onCompleted
:
_item
.
forceActiveFocus
()
Keys.onPressed
:
function
(
event
)
{
switch
(
event
.
key
)
{
case
Qt.Key_Left
:
game
.
moveLeft
();
break
;
case
Qt.Key_Right
:
game
.
moveRight
();
break
;
case
Qt.Key_Up
:
game
.
moveUp
();
break
;
case
Qt.Key_Down
:
game
.
moveDown
();
break
;
}
}
Rectangle
{
id
:
background
...
...
@@ -25,19 +33,68 @@ Item {
anchors.horizontalCenter
:
parent
.
horizontalCenter
Grid
{
id
:
backgroundGrid
rows
:
4
columns
:
4
spacing
:
10
rowSpacing
:
10
columnSpacing
:
10
anchors.centerIn
:
parent
Repeater
{
model
:
game
.
board
.
length
Case
{
value
:
game
.
board
[
index
]
model
:
16
Rectangle
{
width
:
100
height
:
100
radius
:
8
color
:
"
#cdc1b4
"
}
}
}
Item
{
id
:
tileLayer
width
:
parent
.
width
height
:
parent
.
height
anchors.centerIn
:
parent
Repeater
{
id
:
tileRepeater
model
:
16
Case
{
id
:
tile
width
:
100
height
:
100
property
int
row
:
Math
.
floor
(
index
/
4
)
property
int
col
:
index
%
4
property
int
valueFromBoard
:
game
.
board
[
index
]
value
:
valueFromBoard
x
:
col
*
(
width
+
10
)
+
35
y
:
row
*
(
height
+
10
)
+
35
Behavior
on
x
{
NumberAnimation
{
duration
:
150
;
easing.type
:
Easing
.
InOutQuad
}
}
Behavior
on
y
{
NumberAnimation
{
duration
:
150
;
easing.type
:
Easing
.
InOutQuad
}
}
// Apparition douce
opacity
:
value
>
0
?
1
:
0
scale
:
value
>
0
?
1
:
0.8
Behavior
on
opacity
{
NumberAnimation
{
duration
:
150
}
}
Behavior
on
scale
{
NumberAnimation
{
duration
:
150
;
easing.type
:
Easing
.
OutBack
}
}
}
}
}
}
Rectangle
{
id
:
icon_rectangle
...
...
@@ -48,7 +105,9 @@ Item {
id
:
icon_text
anchors.centerIn
:
parent
color
:
"
#ffffff
"
;
text
:
"
2048
"
font.pixelSize
:
50
;
font.bold
:
true
;
font.family
:
"
Tahoma
"
font.pixelSize
:
50
font.bold
:
true
font.family
:
"
Tahoma
"
}
}
...
...
@@ -58,23 +117,21 @@ Item {
color
:
"
#3c3a33
"
;
radius
:
15
Text
{
text
:
"
Score
"
;
y
:
2
;
color
:
"
#c1c1c1
"
;
font.pixelSize
:
20
;
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
Text
{
id
:
current_score
;
y
:
28
;
color
:
"
#ffffff
"
;
text
:
game
.
score
;
font.pixelSize
:
25
;
font.family
:
"
Tahoma
"
;
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
}
Rectangle
{
id
:
best_score_rectangle
x
:
420
;
y
:
50
;
width
:
130
;
height
:
65
color
:
"
#
8f7a66
"
;
radius
:
15
color
:
"
#
bbada0
"
;
radius
:
15
Text
{
text
:
"
Best
"
;
y
:
2
;
color
:
"
#c1c1c1
"
;
font.pixelSize
:
20
;
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
Text
{
id
:
best_score
;
y
:
28
;
color
:
"
#ffffff
"
;
text
:
game
.
bestScore
;
font.pixelSize
:
25
;
font.family
:
"
Tahoma
"
;
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
}
Rectangle
{
id
:
new_rectangle
x
:
270
;
y
:
1
2
5
;
width
:
130
;
height
:
65
x
:
270
;
y
:
1
3
5
;
width
:
130
;
height
:
65
color
:
"
#f65e3d
"
;
radius
:
15
Text
{
text
:
"
NEW
"
;
color
:
"
#ffffff
"
;
font.pixelSize
:
30
;
font.family
:
"
Tahoma
"
;
anchors.centerIn
:
parent
}
...
...
@@ -90,12 +147,15 @@ Item {
Rectangle
{
id
:
menu_rectangle
x
:
420
;
y
:
1
2
5
;
width
:
130
;
height
:
65
color
:
"
#
6a9eda
"
;
radius
:
15
x
:
420
;
y
:
1
3
5
;
width
:
130
;
height
:
65
color
:
"
#
8f7a66
"
;
radius
:
15
Text
{
text
:
"
MENU
"
;
color
:
"
#ffffff
"
;
font.pixelSize
:
30
;
font.family
:
"
Tahoma
"
;
anchors.centerIn
:
parent
}
MouseArea
{
anchors.fill
:
parent
;
onClicked
:
console
.
log
(
"
Menu clicked
"
)
/* À implémenter */
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
stackView
.
pop
()
}
}
Text
{
...
...
@@ -103,24 +163,14 @@ Item {
x
:
50
;
y
:
225
;
width
:
500
;
height
:
50
text
:
"
Join the numbers and get the 2048 tile!
"
font.pixelSize
:
20
;
font.bold
:
true
;
horizontalAlignment
:
Text
.
AlignHCenter
}
}
Connections
{
target
:
game
function
onGameOver
()
{
join_the_numbers_text
.
text
=
"
Game Over !
"
console
.
log
(
"
Signal GAME OVER reçu
"
)
}
}
}
}
focus
:
true
Keys.onPressed
:
function
(
event
)
{
switch
(
event
.
key
)
{
case
Qt.Key_Left
:
game
.
moveLeft
();
break
;
case
Qt.Key_Right
:
game
.
moveRight
();
break
;
case
Qt.Key_Up
:
game
.
moveUp
();
break
;
case
Qt.Key_Down
:
game
.
moveDown
();
break
;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment