diff --git a/src/Core/Crawl/controlpos.cpp b/src/Core/Crawl/layout.cpp similarity index 85% rename from src/Core/Crawl/controlpos.cpp rename to src/Core/Crawl/layout.cpp index e26b3ed..9e6f62b 100644 --- a/src/Core/Crawl/controlpos.cpp +++ b/src/Core/Crawl/layout.cpp @@ -5,41 +5,41 @@ //# of this license document, but changing it is not allowed. //# -#include "controlpos.h" +#include "layout.h" #include "clasteritem.h" #include <QtMath> namespace CRAWL { -ControlPos::ControlPos() { +Layout::Layout() { } -void ControlPos::add(ClasterItem *object) { +void Layout::add(ClasterItem *object) { Claster::add(object); updatePosition(); } -void ControlPos::remove(ClasterItem *object) { +void Layout::remove(ClasterItem *object) { Claster::remove(object); updatePosition(); } -void ControlPos::changeLayout(const Refresh &fig) { +void Layout::changeLayout(const Refresh &fig) { _shape = fig; updatePosition(); } -void ControlPos::setDistance(int dist) { +void Layout::setDistance(int dist) { _distance = dist; updatePosition(); } -void ControlPos::updatePosition() { +void Layout::updatePosition() { switch (_shape) { case CIRCLE: @@ -60,7 +60,7 @@ void ControlPos::updatePosition() { } -void ControlPos::drawCircle() { +void Layout::drawCircle() { if (objects().size() == 0) { QuasarAppUtils::Params::log(QString("The number of objects is zero. Add object."), QuasarAppUtils::Error); @@ -81,7 +81,7 @@ void ControlPos::drawCircle() { } -void ControlPos::drawSquare() { +void Layout::drawSquare() { if (objects().size() == 0) { QuasarAppUtils::Params::log(QString("The number of objects is zero. Add object."), QuasarAppUtils::Error); @@ -105,7 +105,7 @@ void ControlPos::drawSquare() { } -void ControlPos::drawLine() { +void Layout::drawLine() { if (objects().size() == 0) { QuasarAppUtils::Params::log(QString("The number of objects is zero. Add object."), QuasarAppUtils::Error); diff --git a/src/Core/Crawl/controlpos.h b/src/Core/Crawl/layout.h similarity index 93% rename from src/Core/Crawl/controlpos.h rename to src/Core/Crawl/layout.h index c1c6d95..ba5828f 100644 --- a/src/Core/Crawl/controlpos.h +++ b/src/Core/Crawl/layout.h @@ -5,8 +5,8 @@ //# of this license document, but changing it is not allowed. //# -#ifndef CONTROLPOS_H -#define CONTROLPOS_H +#ifndef LAYOUT_H +#define LAYOUT_H #include <Crawl/groupobject.h> @@ -25,9 +25,9 @@ enum Refresh { /** * @brief The ControlPos class The class that control position of group objects. */ -class ControlPos: public GroupObject { +class Layout: public GroupObject { public: - ControlPos(); + Layout(); // Claster interface public: @@ -75,4 +75,4 @@ private: }; } -#endif // CONTROLPOS_H +#endif // LAYOUT_H diff --git a/src/CrawlTestLvl/private/box.cpp b/src/CrawlTestLvl/private/box.cpp index f1df44c..1803795 100644 --- a/src/CrawlTestLvl/private/box.cpp +++ b/src/CrawlTestLvl/private/box.cpp @@ -11,7 +11,7 @@ namespace TestLvl { -Box::Box(): IWorldItem("Box") { +Box::Box(): ClasterItem("Box") { setMash("qrc:/mesh/meshes/cube.mesh"); setSize({2,2,2}); setColor(QColor::fromRgb(rand()).name()); diff --git a/src/CrawlTestLvl/private/box.h b/src/CrawlTestLvl/private/box.h index 16adf4b..0b2f757 100644 --- a/src/CrawlTestLvl/private/box.h +++ b/src/CrawlTestLvl/private/box.h @@ -7,12 +7,12 @@ #ifndef BOX_H #define BOX_H -#include "Crawl/iworlditem.h" +#include "Crawl/clasteritem.h" namespace TestLvl { -class Box: public CRAWL::IWorldItem { +class Box: public CRAWL::ClasterItem { public: Box(); diff --git a/src/CrawlTestLvl/private/groupobjbox.cpp b/src/CrawlTestLvl/private/groupobjbox.cpp index 3c48aaf..ff2a33a 100644 --- a/src/CrawlTestLvl/private/groupobjbox.cpp +++ b/src/CrawlTestLvl/private/groupobjbox.cpp @@ -7,20 +7,34 @@ #include "box.h" #include "groupobjbox.h" -#include "groupobjboxitem.h" namespace TestLvl { -GroupObjBox::GroupObjBox(): CRAWL::IWorldItem("GroupObjBox") { +GroupObjBox::GroupObjBox(): CRAWL::ClasterItem("GroupObjBox") { setDistance(2); changeLayout(CRAWL::Refresh::CIRCLE); - add(new GroupObjboxItem); - add(new GroupObjboxItem); - add(new GroupObjboxItem); - add(new GroupObjboxItem); - add(new GroupObjboxItem); + add(new Box); + add(new Box); + add(new Box); + add(new Box); + add(new Box); + add(new Box); + add(new Box); + add(new Box); + add(new Box); + add(new Box); + add(new Box); + add(new Box); + add(new Box); + add(new Box); + add(new Box); + add(new Box); + add(new Box); + add(new Box); + add(new Box); + add(new Box); } @@ -35,4 +49,6 @@ void GroupObjBox::init() } + + } diff --git a/src/CrawlTestLvl/private/groupobjbox.h b/src/CrawlTestLvl/private/groupobjbox.h index dccb9ae..7946724 100644 --- a/src/CrawlTestLvl/private/groupobjbox.h +++ b/src/CrawlTestLvl/private/groupobjbox.h @@ -8,12 +8,12 @@ #ifndef GROUPOBJBOX_H #define GROUPOBJBOX_H -#include "Crawl/controlpos.h" -#include "Crawl/iworlditem.h" +#include "Crawl/layout.h" +#include "Crawl/clasteritem.h" namespace TestLvl { -class GroupObjBox: public CRAWL::ControlPos, public CRAWL::IWorldItem { +class GroupObjBox: public CRAWL::Layout, public CRAWL::ClasterItem { public: GroupObjBox(); @@ -22,6 +22,7 @@ public: public: void render(unsigned int tbfMsec); void init(); + }; } diff --git a/src/CrawlTestLvl/private/groupobjboxitem.cpp b/src/CrawlTestLvl/private/groupobjboxitem.cpp deleted file mode 100644 index 89135c4..0000000 --- a/src/CrawlTestLvl/private/groupobjboxitem.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//# -//# 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 "groupobjboxitem.h" - -namespace TestLvl { - -GroupObjboxItem::GroupObjboxItem(): CRAWL::ClasterItem("GroupObjboxItem") { - -} - -void GroupObjboxItem::init() { - -} - -void GroupObjboxItem::render(unsigned int tbfMsec) { - -} - -} diff --git a/src/CrawlTestLvl/private/groupobjboxitem.h b/src/CrawlTestLvl/private/groupobjboxitem.h deleted file mode 100644 index 77615a7..0000000 --- a/src/CrawlTestLvl/private/groupobjboxitem.h +++ /dev/null @@ -1,29 +0,0 @@ -//# -//# 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 GROUPOBJBOXITEM_H -#define GROUPOBJBOXITEM_H - -#include "box.h" -#include "Crawl/clasteritem.h" - -namespace TestLvl { - -class GroupObjboxItem: public CRAWL::ClasterItem, public Box { - -public: - GroupObjboxItem(); - - // IRender interface -public: - void init(); - void render(unsigned int tbfMsec); -}; - -} - -#endif // GROUPOBJBOXITEM_H diff --git a/src/CrawlTestLvl/private/world.cpp b/src/CrawlTestLvl/private/world.cpp index 0b3cf2e..d0d5927 100644 --- a/src/CrawlTestLvl/private/world.cpp +++ b/src/CrawlTestLvl/private/world.cpp @@ -32,7 +32,7 @@ CRAWL::WorldRule *World::initWorldRules() { using Day = CRAWL::Day<CRAWL::Sun, CRAWL::Moon>; return new CRAWL::WorldRule { - {0, {{registerObject<Box>(), 1000}, + {0, {{registerObject<Box>(), 1}, {registerObject<CRAWL::Fire>(), 10}, {registerObject<CRAWL::DynamicWint>(), 1}, @@ -40,7 +40,7 @@ CRAWL::WorldRule *World::initWorldRules() { {registerObject<Day>(), 1}}}, {500, { - {registerObject<GroupObjBox>(),20} + {registerObject<GroupObjBox>(),1} } },