Merge branch 'main' into qt6

This commit is contained in:
Andrei Yankovich 2021-07-27 20:56:17 +03:00
commit 0e530442be
32 changed files with 171 additions and 34 deletions

View File

@ -2,7 +2,7 @@
<!DOCTYPE TS>
<TS version="2.1" language="de">
<context>
<name>AbsLvlWorld</name>
<name>AbstractLevel::AbsLvlWorld</name>
<message>
<source>This a abstract lvl</source>
<translation type="unfinished"></translation>

View File

@ -2,7 +2,7 @@
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>AbsLvlWorld</name>
<name>AbstractLevel::AbsLvlWorld</name>
<message>
<source>This a abstract lvl</source>
<translation type="unfinished"></translation>

View File

@ -2,7 +2,7 @@
<!DOCTYPE TS>
<TS version="2.1" language="ru">
<context>
<name>AbsLvlWorld</name>
<name>AbstractLevel::AbsLvlWorld</name>
<message>
<source>This a abstract lvl</source>
<translation type="unfinished"></translation>

View File

@ -2,7 +2,7 @@
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>AbsLvlWorld</name>
<name>AbstractLevel::AbsLvlWorld</name>
<message>
<source>This a abstract lvl</source>
<translation type="unfinished"></translation>

View File

@ -2,7 +2,7 @@
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>AbsLvlWorld</name>
<name>AbstractLevel::AbsLvlWorld</name>
<message>
<source>This a abstract lvl</source>
<translation type="unfinished"></translation>

View File

@ -2,7 +2,7 @@
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>AbsLvlWorld</name>
<name>AbstractLevel::AbsLvlWorld</name>
<message>
<source>This a abstract lvl</source>
<translation type="unfinished"></translation>

View File

@ -2,7 +2,7 @@
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>AbsLvlWorld</name>
<name>AbstractLevel::AbsLvlWorld</name>
<message>
<source>This a abstract lvl</source>
<translation type="unfinished"></translation>

View File

@ -2,7 +2,7 @@
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>AbsLvlWorld</name>
<name>AbstractLevel::AbsLvlWorld</name>
<message>
<source>This a abstract lvl</source>
<translation type="unfinished"></translation>

View File

@ -2,7 +2,7 @@
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>AbsLvlWorld</name>
<name>AbstractLevel::AbsLvlWorld</name>
<message>
<source>This a abstract lvl</source>
<translation type="unfinished"></translation>

View File

@ -2,7 +2,7 @@
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>AbsLvlWorld</name>
<name>AbstractLevel::AbsLvlWorld</name>
<message>
<source>This a abstract lvl</source>
<translation type="unfinished"></translation>

View File

@ -10,7 +10,7 @@
#include <QQmlContext>
#include <Crawl/clientapp.h>
#include <testlevel.h>
#include <abstractlvl.h>
#include <abstractlevel.h>
#include <quasarapp.h>
#include <jungle.h>
@ -43,7 +43,7 @@ int main(int argc, char *argv[])
client.registerLevel<TestLevel>();
#endif
client.registerLevel<AbstractLvl>();
client.registerLevel<AbstractLevel>();
client.registerLevel<Jungle>();
if (!client.init(&engine)) {

View File

@ -20,8 +20,32 @@ template <class Sun, class Moon>
/**
* @brief The Day class is template wrapper for the moon and sun objects.
* The moon and sun objects moving around world center for imitation of the day.
*
* ### Integration on the world.
* You need to add one object of this class in the IWorld::initWorldRules method.
* **Example:**
*
* ```cpp
* CRAWL::WorldRule *World::initWorldRules() {
using Day = CRAWL::Day<CRAWL::Sun, CRAWL::Moon>;
return new CRAWL::WorldRule {
{0, {
{registerObject<Day>(), 1},
}
},
{1000, {
{registerObject<Day>(), 1},
}
},
};
}
* ```
* @note All objects will be moving around this objects with radius. The Radius by default is 2000.
* @note This class automaticly sets ligth force for the light objects.
*
*
*/
class Day: public IWorldItem, public Claster
{

View File

@ -14,7 +14,9 @@
namespace CRAWL {
/**
* @brief The DefaultLight class This is default implementation of the wirld light.
* @brief The DefaultLight class This is default implementation of the world light.
* This object create uniform illumination for all world.
* For integration This object yo worl see the IWorld::initWorldRules method
*/
class DefaultLight final: public IWorldLight
{

View File

@ -18,6 +18,28 @@ namespace CRAWL {
* You need to create own qml file with light.
*
* @note If you wnat to create a new qml file the you need to inherit from the Light.qml file.
*
* ### Integration on the world.
* You need to add one object of this class in the IWorld::initWorldRules method.
* **Example:**
*
* ```cpp
* CRAWL::WorldRule *World::initWorldRules() {
return new CRAWL::WorldRule {
{0, {
{registerObject<MyLightObject>(), 1},
}
},
{1000, {
{registerObject<MyLightObject>(), 1},
}
},
};
}
* ```
*
* For integration This object you world see the IWorld::initWorldRules method
*/
class CRAWL_EXPORT IWorldLight: public ClasterItem
{
@ -30,6 +52,7 @@ class CRAWL_EXPORT IWorldLight: public ClasterItem
Q_PROPERTY(float shadowBias READ shadowBias WRITE setShadowBias NOTIFY shadowBiasChanged)
public:
IWorldLight(const QString& name,
const QString& viewTempalte = "qrc:/CrawlModule/Light.qml",
QObject *ptr = nullptr);

@ -1 +1 @@
Subproject commit 07295d0e4ea37e7e17b1eca717b6ab6d1f5c8c60
Subproject commit f6554cb8c46e82f876961a0be781f06de42b0034

View File

@ -5,14 +5,14 @@
//# of this license document, but changing it is not allowed.
//#
#include "abstractlvl.h"
#include "abstractlevel.h"
#include "abslvlworld.h"
AbstractLvl::AbstractLvl() {
AbstractLevel::AbstractLevel() {
}
CRAWL::IWorld *AbstractLvl::world() {
CRAWL::IWorld *AbstractLevel::world() {
initAbstractLvlResources();
return new AbsLvlWorld();
return new AbstractLvl::AbsLvlWorld();
}

View File

@ -5,24 +5,24 @@
//# of this license document, but changing it is not allowed.
//#
#ifndef ABSTRACTLVL_H
#define ABSTRACTLVL_H
#ifndef ABSTRACTLEVEL_H
#define ABSTRACTLEVEL_H
#include <Crawl/ilevel.h>
#include "abstractlvl_global.h"
inline void initAbstractLvlResources() { Q_INIT_RESOURCE(AbstractLvl);
inline void initAbstractLvlResources() { Q_INIT_RESOURCE(abstractLevel);
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 {
class CRAWL_ABSTRACT_LEVEL_EXPORT AbstractLevel: public CRAWL::ILevel {
public:
AbstractLvl();
AbstractLevel();
// ILevel interface
public:
CRAWL::IWorld *world() override;
};
#endif // ABSTRACTLVL_H
#endif // ABSTRACTLEVEL_H

View File

@ -7,6 +7,8 @@
#include "abslvlcontrol.h"
namespace AbstractLvl {
AbsLvlControl::AbsLvlControl() {
}
@ -14,3 +16,5 @@ AbsLvlControl::AbsLvlControl() {
QString AbsLvlControl::initQmlView() const {
return "qrc:/qml/AbsLvlControl.qml";
}
}

View File

@ -9,6 +9,8 @@
#define ABSLVLCONTROL_H
#include "Crawl/defaultcontrol.h"
namespace AbstractLvl {
/**
* @brief The AbsLvlControl class This controll support custom camera-ratation functions.
*/
@ -21,4 +23,6 @@ public:
};
}
#endif // ABSLVLCONTROL_H

View File

@ -8,12 +8,24 @@
#include "abslvlsnake.h"
#include "abslvlsnakeitem.h"
AbsLvlSnake::AbsLvlSnake(): Snake("Snake") {
namespace AbstractLvl {
AbsLvlSnake::AbsLvlSnake(): Snake(AUTO_CLASS_NAME) {
setBreakingForce(50);
setAngularVelocity(100);
setColor("#90faaa");
setMash("qrc:/mesh/meshes/SnakePatternHead.mesh");
setSize({2,1,1});
setStaticRotation(QQuaternion::fromEulerAngles(0,0,90));
setSize({1,1,1});
setScales({{0, 0.9},
{0.6, 1},
{1, 0.5}});
setLengthBetwinItemsMap({{0, 3},
{0.001, 0.9},
{0.6, 1},
{1, 0.5}});
registerItemType<AbsLvlSnakeItem>();
}
@ -21,3 +33,5 @@ AbsLvlSnake::AbsLvlSnake(): Snake("Snake") {
void AbsLvlSnake::onIntersects(const IWorldItem *item) {
Q_UNUSED(item);
}
}

View File

@ -10,6 +10,8 @@
#include "Crawl/snake.h"
namespace AbstractLvl {
class AbsLvlSnake : public CRAWL::Snake {
Q_OBJECT
@ -23,4 +25,6 @@ protected:
};
}
#endif // ABSLVLSNAKE_H

View File

@ -7,7 +7,9 @@
#include "abslvlsnakeitem.h"
AbsLvlSnakeItem::AbsLvlSnakeItem():CRAWL::SnakeItem("AbstractSnakeItem") {
namespace AbstractLvl {
AbsLvlSnakeItem::AbsLvlSnakeItem():CRAWL::SnakeItem(AUTO_CLASS_NAME) {
setMash("qrc:/mesh/meshes/SnakePatternBody.mesh");
setColor("#20aa9a");
setSize({1,1,1});
@ -17,3 +19,5 @@ void AbsLvlSnakeItem::onIntersects(const IWorldItem *item) {
Q_UNUSED(item);
}
}

View File

@ -10,6 +10,8 @@
#include "Crawl/snakeitem.h"
namespace AbstractLvl {
class AbsLvlSnakeItem: public CRAWL::SnakeItem {
Q_OBJECT
@ -22,4 +24,6 @@ protected:
void onIntersects(const IWorldItem *item) override;
};
}
#endif // ABSLVLSNAKEITEM_H

View File

@ -13,9 +13,14 @@
#include <abslvlsnake.h>
#include "Crawl/iworlditem.h"
#include "Crawl/defaultlight.h"
namespace AbstractLvl {
AbsLvlWorld::AbsLvlWorld() {
setCameraReleativePosition({0, 0, 100});
setCameraReleativePosition({20,0,100});
setCameraRatation(QQuaternion::fromEulerAngles({0,0,0}));
}
CRAWL::IPlayer *AbsLvlWorld::initPlayer() const {
@ -23,10 +28,27 @@ CRAWL::IPlayer *AbsLvlWorld::initPlayer() const {
}
CRAWL::WorldRule *AbsLvlWorld::initWorldRules() {
return new CRAWL::WorldRule {
{0, {{registerObject<Baff>(), 1}}},
{10, {{registerObject<ObstacleBlue>(), 1}}},
{20, {{registerObject<ObstacleRed>(), 1}}}
{0,
{
{registerObject<Baff>(), 10}, {registerObject<CRAWL::DefaultLight>(), 1}
}
},
{20,
{
{registerObject<ObstacleBlue>(), 10}, {registerObject<CRAWL::DefaultLight>(), 1}
}
},
{30,
{
{registerObject<ObstacleRed>(), 40}, {registerObject<CRAWL::DefaultLight>(), 1}
}
}
};
}
@ -58,3 +80,5 @@ CRAWL::IControl *AbsLvlWorld::initUserInterface() const {
void AbsLvlWorld::initPlayerControl(CRAWL::IControl *control) {
return IWorld::initPlayerControl(control);
}
}

View File

@ -10,6 +10,8 @@
#include "Crawl/iworld.h"
namespace AbstractLvl {
class AbsLvlWorld : public CRAWL::IWorld {
// IWorld interface
@ -17,6 +19,7 @@ public:
AbsLvlWorld();
CRAWL::IPlayer *initPlayer() const override;
CRAWL::WorldRule *initWorldRules() override;
QString initHdrBackGround() const override;
@ -29,4 +32,6 @@ public:
};
}
#endif // ABSLEVELWORLD_H

View File

@ -7,12 +7,18 @@
#include "baff.h"
Baff::Baff() : IWorldItem("Baff") {
namespace AbstractLvl {
Baff::Baff() : IWorldItem(AUTO_CLASS_NAME) {
setMash("qrc:/mesh/meshes/Baff.mesh");
setSize({1,1,1});
setColor("#00ff00");
setposition({200, 0, 200});
setZ(0);
}
void Baff::onIntersects(const IWorldItem *item) {
Q_UNUSED(item);
}
}

View File

@ -9,6 +9,7 @@
#define OBJBAFF_H
#include "Crawl/iworlditem.h"
namespace AbstractLvl {
class Baff: public CRAWL::IWorldItem {
public:
@ -19,4 +20,6 @@ protected:
void onIntersects(const IWorldItem *item) override;
};
}
#endif // OBJBAFF_H

View File

@ -6,13 +6,18 @@
//#
#include "obstacleblue.h"
namespace AbstractLvl {
ObstacleBlue::ObstacleBlue() : IWorldItem("OstacleBlue") {
ObstacleBlue::ObstacleBlue() : IWorldItem(AUTO_CLASS_NAME) {
setMash("qrc:/mesh/meshes/ObstacleBlue.mesh");
setSize({1,1,1});
setColor("#00bfff");
setposition({250, 0, 200});
setZ(0);
}
void ObstacleBlue::onIntersects(const IWorldItem *item) {
Q_UNUSED(item);
}
}

View File

@ -9,6 +9,7 @@
#define OBJOBSTACLEBLUE_H
#include "Crawl/iworlditem.h"
namespace AbstractLvl {
class ObstacleBlue: public CRAWL::IWorldItem {
public:
@ -19,4 +20,6 @@ protected:
void onIntersects(const IWorldItem *item) override;
};
}
#endif // OBJOBSTACLEBLUE_H

View File

@ -7,12 +7,17 @@
#include "obstaclered.h"
ObstacleRed::ObstacleRed() : IWorldItem("ObstacleRed") {
namespace AbstractLvl {
ObstacleRed::ObstacleRed() : IWorldItem(AUTO_CLASS_NAME) {
setMash("qrc:/mesh/meshes/ObstacleRed.mesh");
setSize({1,1,1});
setColor("#ff1927");
setZ(0);
}
void ObstacleRed::onIntersects(const IWorldItem *item) {
Q_UNUSED(item);
}
}

View File

@ -9,6 +9,7 @@
#define OBJOBSTACLERED_H
#include "Crawl/iworlditem.h"
namespace AbstractLvl {
class ObstacleRed: public CRAWL::IWorldItem {
public:
@ -19,4 +20,6 @@ protected:
void onIntersects(const IWorldItem *item) override;
};
}
#endif // OBJOBSTACLERED_H