mirror of
https://github.com/QuasarApp/Snake.git
synced 2025-04-26 01:34:40 +00:00
Merge branch 'main' into task_74
This commit is contained in:
commit
487e547127
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -13,6 +13,9 @@
|
||||
[submodule "src/CrawlTestLvl/CrawlTestLvlAssets"]
|
||||
path = src/CrawlTestLvl/CrawlTestLvlAssets
|
||||
url = ssh://web@quasarapp.ddns.net:2022/QuasarApp/CrawlTestLvlAssets.git
|
||||
[submodule "src/CrawlAbstractLvl/CrawlAbstractLevelAssets"]
|
||||
path = src/CrawlAbstractLvl/CrawlAbstractLevelAssets
|
||||
url = ssh://web@quasarapp.ddns.net:2022/QuasarApp/CrawlAbstractLevelAssets.git
|
||||
[submodule "src/JungleLvl/CrawlJungleLvlAssests"]
|
||||
path = src/JungleLvl/CrawlJungleLvlAssests
|
||||
url = ssh://web@quasarapp.ddns.net:2022/QuasarApp/CrawlJungleLvlAssests.git
|
||||
|
@ -65,6 +65,7 @@ add_subdirectory(submodules/ViewSolutions)
|
||||
|
||||
add_subdirectory(src/Core)
|
||||
add_subdirectory(src/CrawlTestLvl)
|
||||
add_subdirectory(src/CrawlAbstractLvl)
|
||||
add_subdirectory(src/JungleLvl)
|
||||
|
||||
add_subdirectory(src/Client)
|
||||
|
@ -26,7 +26,7 @@ else()
|
||||
add_executable(${CURRENT_PROJECT} ${SOURCE_CPP})
|
||||
endif()
|
||||
|
||||
target_link_libraries(${CURRENT_PROJECT} PUBLIC ${PROJECT_NAME}Core TestLvl JungleLvl)
|
||||
target_link_libraries(${CURRENT_PROJECT} PUBLIC ${PROJECT_NAME}Core TestLvl JungleLvl AbstractLvl)
|
||||
|
||||
target_include_directories(${CURRENT_PROJECT} PUBLIC ${PUBLIC_INCUDE_DIR})
|
||||
target_include_directories(${CURRENT_PROJECT} PRIVATE ${PRIVATE_INCUDE_DIR})
|
||||
@ -37,6 +37,8 @@ file(MAKE_DIRECTORY ${TARGET_DIR})
|
||||
if (ANDROID)
|
||||
set(SNAKE_EXTRA_LIBS "${PROJECT_NAME}Core"
|
||||
TestLvl
|
||||
AbstractLvl
|
||||
JungleLvl
|
||||
QuasarApp
|
||||
QmlNotyfyService
|
||||
ViewSolutions)
|
||||
|
@ -1,6 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>AbsLvlWorld</name>
|
||||
<message>
|
||||
<source>This a abstract lvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AbstractLvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
|
@ -1,6 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>AbsLvlWorld</name>
|
||||
<message>
|
||||
<source>This a abstract lvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AbstractLvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
|
@ -1,6 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>AbsLvlWorld</name>
|
||||
<message>
|
||||
<source>This a abstract lvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AbstractLvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
|
@ -1,6 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>AbsLvlWorld</name>
|
||||
<message>
|
||||
<source>This a abstract lvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AbstractLvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
|
@ -1,6 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>AbsLvlWorld</name>
|
||||
<message>
|
||||
<source>This a abstract lvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AbstractLvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
|
@ -1,6 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>AbsLvlWorld</name>
|
||||
<message>
|
||||
<source>This a abstract lvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AbstractLvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
|
@ -1,6 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>AbsLvlWorld</name>
|
||||
<message>
|
||||
<source>This a abstract lvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AbstractLvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
|
@ -1,6 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>AbsLvlWorld</name>
|
||||
<message>
|
||||
<source>This a abstract lvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AbstractLvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
|
@ -1,6 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>AbsLvlWorld</name>
|
||||
<message>
|
||||
<source>This a abstract lvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AbstractLvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
|
@ -1,6 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>AbsLvlWorld</name>
|
||||
<message>
|
||||
<source>This a abstract lvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AbstractLvl</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <QQmlContext>
|
||||
#include <Crawl/clientapp.h>
|
||||
#include <testlevel.h>
|
||||
#include <abstractlvl.h>
|
||||
#include <quasarapp.h>
|
||||
#include <jungle.h>
|
||||
|
||||
@ -39,6 +40,7 @@ int main(int argc, char *argv[])
|
||||
CRAWL::ClientApp client;
|
||||
|
||||
client.registerLevel<TestLevel>();
|
||||
client.registerLevel<AbstractLvl>();
|
||||
client.registerLevel<Jungle>();
|
||||
|
||||
if (!client.init(&engine)) {
|
||||
|
@ -8,8 +8,13 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls.Material 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
AbstractMenuView {
|
||||
|
||||
columns: 2
|
||||
rows: 2
|
||||
|
||||
Button {
|
||||
text: qsTr("Back to menu.")
|
||||
onClicked: {
|
||||
@ -18,4 +23,18 @@ AbstractMenuView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
cursorShape: Qt.DragMoveCursor
|
||||
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
Layout.rowSpan: 2
|
||||
|
||||
onClicked: {
|
||||
model.userTap()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
14
src/CrawlAbstractLvl/AbsLvlControl.qml
Normal file
14
src/CrawlAbstractLvl/AbsLvlControl.qml
Normal file
@ -0,0 +1,14 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
import QtQuick 2.15
|
||||
import CrawlModule 1.0
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
DefaultMenu {
|
||||
|
||||
}
|
5
src/CrawlAbstractLvl/AbstractLvl.qrc
Normal file
5
src/CrawlAbstractLvl/AbstractLvl.qrc
Normal file
@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/qml">
|
||||
<file>AbsLvlControl.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
33
src/CrawlAbstractLvl/CMakeLists.txt
Normal file
33
src/CrawlAbstractLvl/CMakeLists.txt
Normal file
@ -0,0 +1,33 @@
|
||||
#
|
||||
# Copyright (C) 2020-2021 QuasarApp.
|
||||
# Distributed under the lgplv3 software license, see the accompanying
|
||||
# Everyone is permitted to copy and distribute verbatim copies
|
||||
# of this license document, but changing it is not allowed.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
set(CURRENT_PROJECT "AbstractLvl")
|
||||
|
||||
add_definitions(-DCRAWL_ABSTRACT_LEVEL_LIBRARY)
|
||||
|
||||
|
||||
file(GLOB SOURCE_CPP
|
||||
"*.cpp"
|
||||
"private/*.cpp"
|
||||
"*.qrc"
|
||||
"private/*.qrc"
|
||||
"CrawlAbstractLevelAssets/*.qrc"
|
||||
)
|
||||
|
||||
set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(PRIVATE_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/private")
|
||||
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ../Client/modules)
|
||||
|
||||
add_library(${CURRENT_PROJECT} ${SOURCE_CPP} ${SOURCE_QRC})
|
||||
|
||||
target_link_libraries(${CURRENT_PROJECT} PUBLIC ${PROJECT_NAME}Core)
|
||||
|
||||
target_include_directories(${CURRENT_PROJECT} PUBLIC ${PUBLIC_INCUDE_DIR})
|
||||
target_include_directories(${CURRENT_PROJECT} PRIVATE ${PRIVATE_INCUDE_DIR})
|
||||
|
1
src/CrawlAbstractLvl/CrawlAbstractLevelAssets
Submodule
1
src/CrawlAbstractLvl/CrawlAbstractLevelAssets
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 07295d0e4ea37e7e17b1eca717b6ab6d1f5c8c60
|
13
src/CrawlAbstractLvl/README.md
Normal file
13
src/CrawlAbstractLvl/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Crawl Abstract lvl
|
||||
|
||||
|
||||
# 
|
||||
|
||||
This level is a tutorial in which you are offered to pass a short level during which tooltips will be shown:
|
||||
* How to control a snake.
|
||||
* How to interact with game objects.
|
||||
|
||||
There are 3 types of objects in the level:
|
||||
* Repulsive (blue) will push the snake side away from itself, just like the edges of the card.
|
||||
* Destructive (red) destroys the snake.
|
||||
* Buff (green) whose function is that it removes all obstacles visible on the screen.
|
18
src/CrawlAbstractLvl/abstractlvl.cpp
Normal file
18
src/CrawlAbstractLvl/abstractlvl.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#include "abstractlvl.h"
|
||||
#include "abslvlworld.h"
|
||||
|
||||
AbstractLvl::AbstractLvl() {
|
||||
|
||||
}
|
||||
|
||||
CRAWL::IWorld *AbstractLvl::world() {
|
||||
initAbstractLvlResources();
|
||||
return new AbsLvlWorld();
|
||||
}
|
28
src/CrawlAbstractLvl/abstractlvl.h
Normal file
28
src/CrawlAbstractLvl/abstractlvl.h
Normal file
@ -0,0 +1,28 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#ifndef ABSTRACTLVL_H
|
||||
#define ABSTRACTLVL_H
|
||||
|
||||
#include <Crawl/ilevel.h>
|
||||
#include "abstractlvl_global.h"
|
||||
|
||||
inline void initAbstractLvlResources() { Q_INIT_RESOURCE(AbstractLvl);
|
||||
Q_INIT_RESOURCE(absLvlRes);}
|
||||
/**
|
||||
* @brief The AbstractLvl class This is test lvlv wraper of the crawl
|
||||
*/
|
||||
class CRAWL_ABSTRACT_LEVEL_EXPORT AbstractLvl: public CRAWL::ILevel {
|
||||
public:
|
||||
AbstractLvl();
|
||||
|
||||
// ILevel interface
|
||||
public:
|
||||
CRAWL::IWorld *world() override;
|
||||
};
|
||||
|
||||
#endif // ABSTRACTLVL_H
|
12
src/CrawlAbstractLvl/abstractlvl_global.h
Normal file
12
src/CrawlAbstractLvl/abstractlvl_global.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef Crawl_ABSTRACT_LEVEL_GLOBAL_H
|
||||
#define Crawl_ABSTRACT_LEVEL_GLOBAL_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#if defined(CRAWL_ABSTRACT_LEVEL_LIBRARY)
|
||||
# define CRAWL_ABSTRACT_LEVEL_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define CRAWL_ABSTRACT_LEVEL_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#endif // Crawl_ABSTRACT_LEVEL_GLOBAL_H
|
16
src/CrawlAbstractLvl/private/abslvlcontrol.cpp
Normal file
16
src/CrawlAbstractLvl/private/abslvlcontrol.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#include "abslvlcontrol.h"
|
||||
|
||||
AbsLvlControl::AbsLvlControl() {
|
||||
|
||||
}
|
||||
|
||||
QString AbsLvlControl::initQmlView() const {
|
||||
return "qrc:/qml/AbsLvlControl.qml";
|
||||
}
|
24
src/CrawlAbstractLvl/private/abslvlcontrol.h
Normal file
24
src/CrawlAbstractLvl/private/abslvlcontrol.h
Normal file
@ -0,0 +1,24 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#ifndef ABSLVLCONTROL_H
|
||||
#define ABSLVLCONTROL_H
|
||||
#include "Crawl/defaultcontrol.h"
|
||||
|
||||
/**
|
||||
* @brief The AbsLvlControl class This controll support custom camera-ratation functions.
|
||||
*/
|
||||
class AbsLvlControl: public CRAWL::DefaultControl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AbsLvlControl();
|
||||
QString initQmlView() const override;
|
||||
|
||||
};
|
||||
|
||||
#endif // ABSLVLCONTROL_H
|
23
src/CrawlAbstractLvl/private/abslvlsnake.cpp
Normal file
23
src/CrawlAbstractLvl/private/abslvlsnake.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#include "abslvlsnake.h"
|
||||
#include "abslvlsnakeitem.h"
|
||||
|
||||
AbsLvlSnake::AbsLvlSnake(): Snake("Snake") {
|
||||
setBreakingForce(50);
|
||||
setAngularVelocity(100);
|
||||
setColor("#90faaa");
|
||||
setMash("qrc:/mesh/meshes/SnakePatternHead.mesh");
|
||||
setSize({2,1,1});
|
||||
|
||||
registerBodyitem<AbsLvlSnakeItem>();
|
||||
}
|
||||
|
||||
void AbsLvlSnake::onIntersects(const IWorldItem *item) {
|
||||
Q_UNUSED(item);
|
||||
}
|
26
src/CrawlAbstractLvl/private/abslvlsnake.h
Normal file
26
src/CrawlAbstractLvl/private/abslvlsnake.h
Normal file
@ -0,0 +1,26 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#ifndef ABSLVLSNAKE_H
|
||||
#define ABSLVLSNAKE_H
|
||||
|
||||
#include "Crawl/snake.h"
|
||||
|
||||
class AbsLvlSnake : public CRAWL::Snake {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AbsLvlSnake();
|
||||
|
||||
// IWorldItem interface
|
||||
protected:
|
||||
void onIntersects(const IWorldItem *item) override;
|
||||
|
||||
};
|
||||
|
||||
#endif // ABSLVLSNAKE_H
|
19
src/CrawlAbstractLvl/private/abslvlsnakeitem.cpp
Normal file
19
src/CrawlAbstractLvl/private/abslvlsnakeitem.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#include "abslvlsnakeitem.h"
|
||||
|
||||
AbsLvlSnakeItem::AbsLvlSnakeItem() {
|
||||
setMash("qrc:/mesh/meshes/SnakePatternBody.mesh");
|
||||
setColor("#20aa9a");
|
||||
setSize({1,1,1});
|
||||
}
|
||||
|
||||
void AbsLvlSnakeItem::onIntersects(const IWorldItem *item) {
|
||||
Q_UNUSED(item);
|
||||
|
||||
}
|
25
src/CrawlAbstractLvl/private/abslvlsnakeitem.h
Normal file
25
src/CrawlAbstractLvl/private/abslvlsnakeitem.h
Normal file
@ -0,0 +1,25 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#ifndef ABSLVLSNAKEITEM_H
|
||||
#define ABSLVLSNAKEITEM_H
|
||||
|
||||
#include "Crawl/snakeitem.h"
|
||||
|
||||
class AbsLvlSnakeItem: public CRAWL::SnakeItem {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AbsLvlSnakeItem();
|
||||
|
||||
// IWorldItem interface
|
||||
protected:
|
||||
void onIntersects(const IWorldItem *item) override;
|
||||
};
|
||||
|
||||
#endif // ABSLVLSNAKEITEM_H
|
60
src/CrawlAbstractLvl/private/abslvlworld.cpp
Normal file
60
src/CrawlAbstractLvl/private/abslvlworld.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#include "baff.h"
|
||||
#include "obstacleblue.h"
|
||||
#include "obstaclered.h"
|
||||
#include "abslvlcontrol.h"
|
||||
#include "abslvlworld.h"
|
||||
#include <abslvlsnake.h>
|
||||
#include "Crawl/iworlditem.h"
|
||||
|
||||
|
||||
AbsLvlWorld::AbsLvlWorld() {
|
||||
setCameraReleativePosition({0, 0, 100});
|
||||
}
|
||||
|
||||
CRAWL::IPlayer *AbsLvlWorld::initPlayer() const {
|
||||
return new AbsLvlSnake();
|
||||
}
|
||||
|
||||
CRAWL::WorldRule *AbsLvlWorld::initWorldRules() {
|
||||
return new CRAWL::WorldRule {
|
||||
{0, {{registerObject<Baff>(), 1}}},
|
||||
{10, {{registerObject<ObstacleBlue>(), 1}}},
|
||||
{20, {{registerObject<ObstacleRed>(), 1}}}
|
||||
};
|
||||
}
|
||||
|
||||
QString AbsLvlWorld::initHdrBackGround() const {
|
||||
return "qrc:/hdr/hdr/plate_absLvl.hdr";
|
||||
}
|
||||
|
||||
QString AbsLvlWorld::description() const {
|
||||
return tr("This a abstract lvl");
|
||||
}
|
||||
|
||||
QString AbsLvlWorld::imagePreview() const {
|
||||
return "qrc:/hdr/hdr/testHDR.jpg";
|
||||
|
||||
}
|
||||
|
||||
QString AbsLvlWorld::name() const {
|
||||
return tr("AbstractLvl");
|
||||
}
|
||||
|
||||
int AbsLvlWorld::costToUnlock() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
CRAWL::IControl *AbsLvlWorld::initUserInterface() const {
|
||||
return new AbsLvlControl();
|
||||
}
|
||||
|
||||
void AbsLvlWorld::initPlayerControl(CRAWL::IControl *control) {
|
||||
return IWorld::initPlayerControl(control);
|
||||
}
|
32
src/CrawlAbstractLvl/private/abslvlworld.h
Normal file
32
src/CrawlAbstractLvl/private/abslvlworld.h
Normal file
@ -0,0 +1,32 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#ifndef ABSLEVELWORLD_H
|
||||
#define ABSLEVELWORLD_H
|
||||
|
||||
#include "Crawl/iworld.h"
|
||||
|
||||
class AbsLvlWorld : public CRAWL::IWorld {
|
||||
|
||||
// IWorld interface
|
||||
public:
|
||||
|
||||
AbsLvlWorld();
|
||||
|
||||
CRAWL::IPlayer *initPlayer() const override;
|
||||
CRAWL::WorldRule *initWorldRules() override;
|
||||
QString initHdrBackGround() const override;
|
||||
QString description() const override;
|
||||
QString imagePreview() const override;
|
||||
QString name() const override;
|
||||
int costToUnlock() const override;
|
||||
CRAWL::IControl *initUserInterface() const override;
|
||||
void initPlayerControl(CRAWL::IControl *control) override;
|
||||
|
||||
};
|
||||
|
||||
#endif // ABSLEVELWORLD_H
|
18
src/CrawlAbstractLvl/private/baff.cpp
Normal file
18
src/CrawlAbstractLvl/private/baff.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#include "baff.h"
|
||||
|
||||
Baff::Baff() : IWorldItem("Baff") {
|
||||
setMash("qrc:/mesh/meshes/Baff.mesh");
|
||||
setSize({1,1,1});
|
||||
setZ(0);
|
||||
}
|
||||
|
||||
void Baff::onIntersects(const IWorldItem *item) {
|
||||
Q_UNUSED(item);
|
||||
}
|
22
src/CrawlAbstractLvl/private/baff.h
Normal file
22
src/CrawlAbstractLvl/private/baff.h
Normal file
@ -0,0 +1,22 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#ifndef OBJBAFF_H
|
||||
#define OBJBAFF_H
|
||||
#include "Crawl/iworlditem.h"
|
||||
|
||||
|
||||
class Baff: public CRAWL::IWorldItem {
|
||||
public:
|
||||
Baff();
|
||||
|
||||
// IWorldItem interface
|
||||
protected:
|
||||
void onIntersects(const IWorldItem *item) override;
|
||||
};
|
||||
|
||||
#endif // OBJBAFF_H
|
18
src/CrawlAbstractLvl/private/obstacleblue.cpp
Normal file
18
src/CrawlAbstractLvl/private/obstacleblue.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#include "obstacleblue.h"
|
||||
|
||||
ObstacleBlue::ObstacleBlue() : IWorldItem("OstacleBlue") {
|
||||
setMash("qrc:/mesh/meshes/ObstacleBlue.mesh");
|
||||
setSize({1,1,1});
|
||||
setZ(0);
|
||||
}
|
||||
|
||||
void ObstacleBlue::onIntersects(const IWorldItem *item) {
|
||||
Q_UNUSED(item);
|
||||
}
|
22
src/CrawlAbstractLvl/private/obstacleblue.h
Normal file
22
src/CrawlAbstractLvl/private/obstacleblue.h
Normal file
@ -0,0 +1,22 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#ifndef OBJOBSTACLEBLUE_H
|
||||
#define OBJOBSTACLEBLUE_H
|
||||
#include "Crawl/iworlditem.h"
|
||||
|
||||
|
||||
class ObstacleBlue: public CRAWL::IWorldItem {
|
||||
public:
|
||||
ObstacleBlue();
|
||||
|
||||
// IWorldItem interface
|
||||
protected:
|
||||
void onIntersects(const IWorldItem *item) override;
|
||||
};
|
||||
|
||||
#endif // OBJOBSTACLEBLUE_H
|
18
src/CrawlAbstractLvl/private/obstaclered.cpp
Normal file
18
src/CrawlAbstractLvl/private/obstaclered.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#include "obstaclered.h"
|
||||
|
||||
ObstacleRed::ObstacleRed() : IWorldItem("ObstacleRed") {
|
||||
setMash("qrc:/mesh/meshes/ObstacleRed.mesh");
|
||||
setSize({1,1,1});
|
||||
setZ(0);
|
||||
}
|
||||
|
||||
void ObstacleRed::onIntersects(const IWorldItem *item) {
|
||||
Q_UNUSED(item);
|
||||
}
|
22
src/CrawlAbstractLvl/private/obstaclered.h
Normal file
22
src/CrawlAbstractLvl/private/obstaclered.h
Normal file
@ -0,0 +1,22 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#ifndef OBJOBSTACLERED_H
|
||||
#define OBJOBSTACLERED_H
|
||||
#include "Crawl/iworlditem.h"
|
||||
|
||||
|
||||
class ObstacleRed: public CRAWL::IWorldItem {
|
||||
public:
|
||||
ObstacleRed();
|
||||
|
||||
// IWorldItem interface
|
||||
protected:
|
||||
void onIntersects(const IWorldItem *item) override;
|
||||
};
|
||||
|
||||
#endif // OBJOBSTACLERED_H
|
@ -8,67 +8,65 @@ DefaultMenu {
|
||||
columns: 2
|
||||
rows: 2
|
||||
|
||||
Button {
|
||||
text: "🌀"
|
||||
|
||||
onClicked: {
|
||||
model.userTap()
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
property bool track: false
|
||||
property real oldX: 0
|
||||
property real oldY: 0
|
||||
cursorShape: Qt.DragMoveCursor
|
||||
|
||||
Rectangle {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
Layout.rowSpan: 2
|
||||
|
||||
onPressed: {
|
||||
track = true
|
||||
oldX = mouse.x
|
||||
oldY = mouse.y
|
||||
color: "#22000000"
|
||||
|
||||
}
|
||||
MouseArea {
|
||||
property bool track: false
|
||||
property real oldX: 0
|
||||
property real oldY: 0
|
||||
cursorShape: Qt.DragMoveCursor
|
||||
onPressed: {
|
||||
track = true
|
||||
oldX = mouse.x
|
||||
oldY = mouse.y
|
||||
|
||||
onReleased: {
|
||||
track = false
|
||||
}
|
||||
|
||||
onMouseXChanged: {
|
||||
if (!model) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!track) {
|
||||
return;
|
||||
onReleased: {
|
||||
track = false
|
||||
}
|
||||
|
||||
const delta = mouse.x - oldX;
|
||||
const radianDelta = (delta / (parent.width / 2)) * 45
|
||||
onMouseXChanged: {
|
||||
if (!model) {
|
||||
return;
|
||||
}
|
||||
|
||||
model.xChanged(radianDelta)
|
||||
oldX = mouse.x;
|
||||
}
|
||||
if (!track) {
|
||||
return;
|
||||
}
|
||||
|
||||
onMouseYChanged: {
|
||||
if (!model) {
|
||||
return;
|
||||
const delta = mouse.x - oldX;
|
||||
const radianDelta = (delta / (parent.width / 2)) * 45
|
||||
|
||||
model.xChanged(radianDelta)
|
||||
oldX = mouse.x;
|
||||
}
|
||||
|
||||
if (!track) {
|
||||
return;
|
||||
onMouseYChanged: {
|
||||
if (!model) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!track) {
|
||||
return;
|
||||
}
|
||||
|
||||
const delta = mouse.y - oldY;
|
||||
const radianDelta = (delta / (parent.height / 2)) * 45
|
||||
|
||||
model.yChanged(radianDelta)
|
||||
oldY = mouse.y;
|
||||
}
|
||||
|
||||
const delta = mouse.y - oldY;
|
||||
const radianDelta = (delta / (parent.height / 2)) * 45
|
||||
|
||||
model.yChanged(radianDelta)
|
||||
oldY = mouse.y;
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user