Skip to content

Commit

Permalink
Final
Browse files Browse the repository at this point in the history
  • Loading branch information
Hu Zecong committed Aug 30, 2015
1 parent e0393bd commit 2b2538f
Show file tree
Hide file tree
Showing 60 changed files with 1,362 additions and 367 deletions.
Binary file added .DS_Store
Binary file not shown.
11 changes: 7 additions & 4 deletions FlowFree.pro
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ TEMPLATE = app
VERSION = 1.0

SOURCES += main.cpp \
gamelogic.cpp
gamelogic.cpp \
gamesolver.cpp

HEADERS += \
gamelogic.h
gamelogic.h \
gamesolver.h

FORMS +=

DISTFILES += \
FlowFreeMainView.qml \
main.qml \
GameBoard.qml \
GameBoardToggle.js \
Expand Down Expand Up @@ -59,7 +60,9 @@ DISTFILES += \
sound/Hero.wav \
sound/Blow.wav \
FollowMouseCircle.qml \
icon/icon.ico
icon/icon.ico \
HelpDialog.qml \
MainView.qml \

RESOURCES += \
qml.qrc
Expand Down
2 changes: 1 addition & 1 deletion FlowFree.pro.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.0, 2015-08-29T23:40:04. -->
<!-- Written by QtCreator 3.5.0, 2015-08-30T17:38:47. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
Expand Down
271 changes: 0 additions & 271 deletions FlowFree.pro.user.745494c

This file was deleted.

49 changes: 37 additions & 12 deletions GameBoard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,35 @@ Item {
signal pressed()
signal gameFinished()
signal gameNeedFill()
signal solveFinished(int time)
signal loadFailed(string message)

function restart() {
logic.restart()
finished = false
}
function solve() {
logic.solve()
}
function canSolve() {
return logic.canSolve()
}
function abortSolve() {
logic.abortSolve()
}

SoundEffect {
id: needFillSound
source: "qrc:/sound/Blow.wav"
}

SoundEffect {
id: lastConnectionSound
source: "qrc:/sound/Hero.wav"
}

SoundEffect {
id: connectedSound
source: "qrc:/sound/Submarine.wav"
}

SoundEffect {
id: disconnectedSound
source: "qrc:/sound/Pop.wav"
Expand All @@ -53,6 +62,20 @@ Item {
Toggle.createBoard(n, m, gridLength)
logic.displayCircles()
}
onLoadFailed: {
console.log("load failed")
root.loadFailed(message)
root.finished = true
}

onNoSolution: {
console.log("no solution")
}
onSolveFinished: {
root.solveFinished(time)
root.finished = true
}

onHideAll: Toggle.hideAll()
onRipple: Toggle.ripple(x, y)
onChangeGridColor: Toggle.changeGridColor(x, y, color)
Expand Down Expand Up @@ -112,18 +135,20 @@ Item {
}

onPositionChanged: {
var y = Math.floor(mouse.x / gridLength)
var x = Math.floor(mouse.y / gridLength)
// console.log("moved ", x, y);
logic.movePath(x, y);
if (!root.finished) {
var y = Math.floor(mouse.x / gridLength)
var x = Math.floor(mouse.y / gridLength)
logic.movePath(x, y);
}
}

onReleased: {
var y = Math.floor(mouse.x / gridLength)
var x = Math.floor(mouse.y / gridLength)
// console.log("released ", x, y)
logic.endPath(x, y);
followCircle.state = "hidden"
if (!root.finished) {
var y = Math.floor(mouse.x / gridLength)
var x = Math.floor(mouse.y / gridLength)
logic.endPath(x, y);
followCircle.state = "hidden"
}
}
}
}
Expand Down
17 changes: 17 additions & 0 deletions HelpDialog.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import QtQuick 2.5
import Material 0.1
import QtQuick.Layouts 1.1

Dialog {
id: dialog
width: Units.dp(400)
title: qsTr("Instructions")
text: qsTr("Drag to connect matching colors with pipe, creating a flow.\n
Pair all colors, and cover the entire board with pipe to solve each puzzle.\n
But watch out, pipes will break if they cross or overlap!\n
Too easy? Try selecting a larger board.\n
Too hard? Try using the auto-solve function. But note that the last level is too complex for the solver, so you're on yourself on that one.\n");
negativeButtonText: "OK"
positiveButton.visible: false
}

Loading

0 comments on commit 2b2538f

Please sign in to comment.