diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,7 +87,7 @@ set(QT_REQUIRED_VERSION 5.6.0) find_package(Qt5 ${QT_REQUIRED_VERSION} REQUIRED - Qml Quick Gui Multimedia Core Svg Xml XmlPatterns LinguistTools Sensors) + Qml Quick Gui Multimedia Core Svg Xml XmlPatterns LinguistTools Sensors 3DCore 3DExtras 3DRender 3DInput) find_package (KF5 QUIET COMPONENTS DocTools diff --git a/src/activities/activities.txt b/src/activities/activities.txt --- a/src/activities/activities.txt +++ b/src/activities/activities.txt @@ -81,6 +81,7 @@ magic-hat-minus magic-hat-plus maze +maze-3D mazeinvisible mazerelative melody diff --git a/src/activities/maze-3D/ActivityInfo.qml b/src/activities/maze-3D/ActivityInfo.qml new file mode 100644 --- /dev/null +++ b/src/activities/maze-3D/ActivityInfo.qml @@ -0,0 +1,40 @@ +/* GCompris - ActivityInfo.qml + * + * Copyright (C) 2017 Your Name + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import GCompris 1.0 + +ActivityInfo { + name: "maze-3D/Maze3D.qml" + difficulty: 1 + icon: "maze-3D/maze-3D.svg" + author: "Your Name <yy@zz.org>" + demo: true + //: Activity title + title: qsTr("Maze3D activity") + //: Help title + description: qsTr("") + //intro: "put here in comment the text for the intro voice" + //: Help goal + goal: "" + //: Help prerequisite + prerequisite: "" + //: Help manual + manual: "" + credit: "" + section: "discovery maze" + createdInVersion: +} diff --git a/src/activities/maze-3D/CMakeLists.txt b/src/activities/maze-3D/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/src/activities/maze-3D/CMakeLists.txt @@ -0,0 +1 @@ +GCOMPRIS_ADD_RCC(activities/maze-3D *.qml *.svg *.js resource/*) diff --git a/src/activities/maze-3D/Maze3D.qml b/src/activities/maze-3D/Maze3D.qml new file mode 100644 --- /dev/null +++ b/src/activities/maze-3D/Maze3D.qml @@ -0,0 +1,85 @@ +/* GCompris - maze-3D.qml + * + * Copyright (C) 2017 YOUR NAME + * + * Authors: + * (GTK+ version) + * YOUR NAME (Qt Quick port) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import QtQuick 2.6 + +import "../../core" +import "maze-3D.js" as Activity + +ActivityBase { + id: activity + + onStart: focus = true + onStop: {} + + pageComponent: Rectangle { + id: background + anchors.fill: parent + color: "#ABCDEF" + signal start + signal stop + + Component.onCompleted: { + activity.start.connect(start) + activity.stop.connect(stop) + } + + // Add here the QML items you need to access in javascript + QtObject { + id: items + property Item main: activity.main + property alias background: background + property alias bar: bar + property alias bonus: bonus + } + + onStart: { Activity.start(items) } + onStop: { Activity.stop() } + + GCText { + anchors.centerIn: parent + text: "maze-3D activity" + fontSize: largeSize + } + + DialogHelp { + id: dialogHelp + onClose: home() + } + + Bar { + id: bar + content: BarEnumContent { value: help | home | level } + onHelpClicked: { + displayDialog(dialogHelp) + } + onPreviousLevelClicked: Activity.previousLevel() + onNextLevelClicked: Activity.nextLevel() + onHomeClicked: activity.home() + } + + Bonus { + id: bonus + Component.onCompleted: win.connect(Activity.nextLevel) + } + } + +} diff --git a/src/activities/maze-3D/maze-3D.js b/src/activities/maze-3D/maze-3D.js new file mode 100644 --- /dev/null +++ b/src/activities/maze-3D/maze-3D.js @@ -0,0 +1,54 @@ +/* GCompris - maze-3D.js + * + * Copyright (C) 2017 YOUR NAME + * + * Authors: + * (GTK+ version) + * "YOUR NAME" (Qt Quick port) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +.pragma library +.import QtQuick 2.6 as Quick + +var currentLevel = 0 +var numberOfLevel = 4 +var items + +function start(items_) { + items = items_ + currentLevel = 0 + initLevel() +} + +function stop() { +} + +function initLevel() { + items.bar.level = currentLevel + 1 +} + +function nextLevel() { + if(numberOfLevel <= ++currentLevel ) { + currentLevel = 0 + } + initLevel(); +} + +function previousLevel() { + if(--currentLevel < 0) { + currentLevel = numberOfLevel - 1 + } + initLevel(); +} diff --git a/src/activities/maze-3D/maze-3D.svg b/src/activities/maze-3D/maze-3D.svg new file mode 100644 --- /dev/null +++ b/src/activities/maze-3D/maze-3D.svg @@ -0,0 +1,83 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -73,7 +73,7 @@ qt5_use_modules(${GCOMPRIS_EXECUTABLE_NAME} Qml Quick Gui Multimedia Network XmlPatterns Svg Xml Sensors Core) else() add_executable(${GCOMPRIS_EXECUTABLE_NAME} ${gcompris_SRCS} ${gcompris_MOC} ${gcompris_RES}) - qt5_use_modules(${GCOMPRIS_EXECUTABLE_NAME} Qml Quick Gui Multimedia Network XmlPatterns Svg Xml Sensors Core) + qt5_use_modules(${GCOMPRIS_EXECUTABLE_NAME} Qml Quick Gui Multimedia Network XmlPatterns Svg Xml Sensors Core 3DCore 3DExtras 3DRender 3DInput) endif() GCOMPRIS_ADD_RCC(core *.qml *.js resource/*.${COMPRESSED_AUDIO} resource/*.gif resource/*.png resource/*.svg resource/bonus/* resource/sounds/* resource/fonts/* qmldir COPYING)