Changeset View
Changeset View
Standalone View
Standalone View
src/activities/maze-3D/maze-3D.js
- This file was added.
1 | /* GCompris - maze-3D.js | ||||
---|---|---|---|---|---|
2 | * | ||||
3 | * Copyright (C) 2017 YOUR NAME <xx@yy.org> | ||||
4 | * | ||||
5 | * Authors: | ||||
6 | * <THE GTK VERSION AUTHOR> (GTK+ version) | ||||
7 | * "YOUR NAME" <YOUR EMAIL> (Qt Quick port) | ||||
8 | * | ||||
9 | * This program is free software; you can redistribute it and/or modify | ||||
10 | * it under the terms of the GNU General Public License as published by | ||||
11 | * the Free Software Foundation; either version 3 of the License, or | ||||
12 | * (at your option) any later version. | ||||
13 | * | ||||
14 | * This program is distributed in the hope that it will be useful, | ||||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
17 | * GNU General Public License for more details. | ||||
18 | * | ||||
19 | * You should have received a copy of the GNU General Public License | ||||
20 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||||
21 | */ | ||||
22 | .pragma library | ||||
23 | .import QtQuick 2.6 as Quick | ||||
24 | | ||||
25 | var currentLevel = 0 | ||||
26 | var numberOfLevel = 4 | ||||
27 | var items | ||||
28 | | ||||
29 | function start(items_) { | ||||
30 | items = items_ | ||||
31 | currentLevel = 0 | ||||
32 | initLevel() | ||||
33 | } | ||||
34 | | ||||
35 | function stop() { | ||||
36 | } | ||||
37 | | ||||
38 | function initLevel() { | ||||
39 | items.bar.level = currentLevel + 1 | ||||
40 | } | ||||
41 | | ||||
42 | function nextLevel() { | ||||
43 | if(numberOfLevel <= ++currentLevel ) { | ||||
44 | currentLevel = 0 | ||||
45 | } | ||||
46 | initLevel(); | ||||
47 | } | ||||
48 | | ||||
49 | function previousLevel() { | ||||
50 | if(--currentLevel < 0) { | ||||
51 | currentLevel = numberOfLevel - 1 | ||||
52 | } | ||||
53 | initLevel(); | ||||
54 | } |