4
1
mirror of https://github.com/QuasarApp/Snake.git synced 2025-05-08 07:29:45 +00:00

begin work on plugin system

This commit is contained in:
Andrei Yankovich 2021-06-08 00:43:02 +03:00
parent f778384cc9
commit d2f1fe14f4
46 changed files with 239 additions and 720 deletions

@ -63,6 +63,8 @@ add_subdirectory(submodules/QuasarAppLib)
add_subdirectory(submodules/SimpleQmlNotify)
add_subdirectory(src/Core)
add_subdirectory(src/Empty)
add_subdirectory(src/Client)

@ -45,6 +45,6 @@ set(LANGS ${CMAKE_CURRENT_SOURCE_DIR}/languages/en.ts
${CMAKE_CURRENT_SOURCE_DIR}/languages/es.ts
${CMAKE_CURRENT_SOURCE_DIR}/languages/pl.ts)
prepareQM(${CURRENT_PROJECT} ${CMAKE_CURRENT_SOURCE_DIR} "${LANGS}")
prepareQM(${CURRENT_PROJECT} ${CMAKE_CURRENT_SOURCE_DIR}/../ "${LANGS}")
set(QML_IMPORT_PATH ${QML_IMPORT_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/src" CACHE STRING "" FORCE)

@ -12,7 +12,6 @@
<file>SnakeProjectModule/Scene.qml</file>
<file>SnakeProjectModule/SettingsView.qml</file>
<file>SnakeProjectModule/SnakeItem.qml</file>
<file>SnakeProject/IRender.qml</file>
</qresource>
<qresource prefix="/SnakeTr">
<file>languages/de.qm</file>
@ -26,13 +25,7 @@
<file>languages/zh.qm</file>
<file>languages/uk.qm</file>
</qresource>
<qresource prefix="/images">
<file>res/up.svg</file>
<file>res/logo.png</file>
<file>res/icon.ico</file>
</qresource>
<qresource prefix="/mesh">
<file>res/meshes/cube.mesh</file>
</qresource>
<qresource prefix="/images"/>
<qresource prefix="/mesh"/>
<qresource prefix="/hdr"/>
</RCC>

@ -1,13 +1,19 @@
#include "clientapp.h"
#include "imageprovider.h"
#include "iworld.h"
#include "mainmenumodel.h"
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <quasarapp.h>
#include <controller.h>
#include <engine.h>
#include <qmlnotifyservice.h>
#include <QStandardPaths>
#include <QDir>
#include "pluginloader.h"
#define PLUGINS_DIR QStandardPaths::
QByteArray ClientApp::initTheme() {
int themeIndex = Settings::instance()->getValue(THEME, THEME_DEFAULT).toInt();
@ -20,11 +26,11 @@ QByteArray ClientApp::initTheme() {
}
ClientApp::ClientApp() {
contr = new Controller();
_engine = new Engine();
}
ClientApp::~ClientApp() {
delete contr;
delete _engine;
}
void ClientApp::initLang() {
@ -42,13 +48,30 @@ void ClientApp::initLang() {
}
}
void ClientApp::initLvls() {
auto plugins = availablePlugins();
for (const auto& lvl: plugins) {
IWorld* worldModule = PluginLoader::load(lvl.absoluteFilePath());
if (worldModule) {
_availableLvls.insert(worldModule->name(), worldModule);
}
}
}
QList<QFileInfo> ClientApp::availablePlugins() const {
QDir dir(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
auto list = dir.entryInfoList(QStringList() << "*.so" << "*.dll", QDir::Files);
return list;
}
bool ClientApp::init(QQmlApplicationEngine *engine) {
qputenv("QT_QUICK_CONTROLS_MATERIAL_THEME", initTheme());
qputenv("QT_QUICK_CONTROLS_STYLE", "Basic");
qputenv("QT_QUICK_CONTROLS_STYLE", "Material");
qmlRegisterAnonymousType<GuiObject>("GuiObject", 1);
qmlRegisterAnonymousType<Diff>("Diff", 1);
qmlRegisterAnonymousType<MainMenuModel>("MainMenuModel", 1);
auto root = engine->rootContext();
@ -57,9 +80,10 @@ bool ClientApp::init(QQmlApplicationEngine *engine) {
engine->addImageProvider(QLatin1String("userItems"), new ImageProvider());
root->setContextProperty("contr", contr);
root->setContextProperty("engine", QVariant::fromValue(_engine));
initSnakeProjectResources();
initLang();
initLvls();
engine->addImportPath(":/SnakeProjectModule/");

@ -2,28 +2,49 @@
#define CLIENTAPP_H
#include <QByteArray>
#include <QFileInfo>
#include <QStringList>
#include "global.h"
class Controller;
class Engine;
class IWorld;
inline void initSnakeProjectResources() { Q_INIT_RESOURCE(SnakeProject); }
class QQmlApplicationEngine;
/**
* @brief The ClientApp class This is main class of the Game engine.
*/
class SNAKEPROJECT_EXPORT ClientApp
{
private:
Controller *contr = nullptr;
QByteArray initTheme();
void initLang();
public:
ClientApp();
~ClientApp();
virtual ~ClientApp();
/**
* @brief init This method initialize engine on application.
* @param engine This is qml engine instance object.
* @return true if all initialize successful
*/
bool init(QQmlApplicationEngine* engine);
private:
QByteArray initTheme();
void initLang();
void initLvls();
/**
* @brief availablePlugins This method read all available plugins.
* @return list of the available plugins.
*/
QList<QFileInfo> availablePlugins() const;
QHash<QString, IWorld*> _availableLvls;
Engine *_engine = nullptr;
};
#endif // CLIENTAPP_H

@ -65,6 +65,24 @@ public:
*/
virtual QString initHdrBackGround() const = 0;
/**
* @brief description This method shold be return lvl description.
* @return lvel description string.
*/
virtual QString description() const = 0;
/**
* @brief name This method shold be return lvl name.
* @return lvl name.
*/
virtual QString name() const = 0;
/**
* @brief amountToUnlock This method shold be return unlock cost.
* @return unlock cost
*/
virtual int amountToUnlock() const = 0;
/**
* @brief render this method recursive invoke all render functions of the all world items.
* The render function is main function of the SnakeEngine This method recal all propertyes of all objects.

@ -9,60 +9,6 @@ View3D {
id: scene;
property var model: null;
property var arrayObjects: []
readonly property bool showMenu: (model)? model.showMenu: false
property bool isPause: false
function add (cppObjId) {
if (!model) {
console.log("create object fail")
return;
}
var objModel = model.getGameObject(cppObjId);
if (!objModel) {
console.log("object model not found");
return;
}
var viewTemplate = objModel.viewTemplate;
var temp = Qt.createComponent( viewTemplate + ".qml")
if (temp.status === Component.Ready) {
var obj = temp.createObject(mainScane) // parent - это обьект на который будет помещен соззданный элемент
obj.model = model.getGameObject(cppObjId);
arrayObjects.push(obj)
} else {
console.log("wrong viewTemplate in model. Message: " + temp.errorString());
}
}
function remove(id) {
if (typeof id !== "number" || id < 0) {
console.log("id not found");
return;
}
for (var i = 0; i < arrayObjects.length; ++i) {
if (id === arrayObjects[i].guiId) {
arrayObjects.splice(i,1);
}
}
}
function updateBackgroundColor(lvl) {
switch(lvl % 7) {
case 0: background.clearColor = "#d6eaf8"; break;
case 1: background.clearColor = "#d0ece7"; break;
case 2: background.clearColor = "#d4efdf"; break;
case 3: background.clearColor = "#fcf3cf"; break;
case 4: background.clearColor = "#f6ddcc"; break;
case 5: background.clearColor = "#f2d7d5"; break;
case 6: background.clearColor = "#ebdef0"; break;
case 7: background.clearColor = "#fbfcfc"; break;
}
}
PerspectiveCamera {
id: camera
@ -101,29 +47,6 @@ View3D {
}
}
Connections {
target: model;
function onGameObjectsChanged(dif) {
if (!dif) {
console.log("dif not found");
return;
}
var tempDifRem = [];
tempDifRem = dif.getRemoveIds();
var tempDifAdd = [];
tempDifAdd = dif.getAddedIds();
for (var i = 0; i < tempDifAdd.length; ++i) {
add(tempDifAdd[i]);
}
for (i = 0; i < tempDifRem.length; ++i) {
remove(tempDifRem[i]);
}
}
}
Component.onCompleted: {
updateBackgroundColor(0);
model.handleNewGame();

@ -1,17 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>Controller</name>
<message>
<source> Next Lvl!!!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> You anblock next lvl (%0)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainMenu</name>
<message>

@ -1,17 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>Controller</name>
<message>
<source> Next Lvl!!!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> You anblock next lvl (%0)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainMenu</name>
<message>

@ -1,17 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>Controller</name>
<message>
<source> Next Lvl!!!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> You anblock next lvl (%0)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainMenu</name>
<message>

@ -1,17 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>Controller</name>
<message>
<source> Next Lvl!!!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> You anblock next lvl (%0)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainMenu</name>
<message>

@ -1,17 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>Controller</name>
<message>
<source> Next Lvl!!!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> You anblock next lvl (%0)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainMenu</name>
<message>

@ -1,17 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>Controller</name>
<message>
<source> Next Lvl!!!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> You anblock next lvl (%0)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainMenu</name>
<message>

@ -1,17 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>Controller</name>
<message>
<source> Next Lvl!!!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> You anblock next lvl (%0)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainMenu</name>
<message>

@ -1,17 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>Controller</name>
<message>
<source> Next Lvl!!!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> You anblock next lvl (%0)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainMenu</name>
<message>

@ -1,17 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>Controller</name>
<message>
<source> Next Lvl!!!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> You anblock next lvl (%0)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainMenu</name>
<message>

@ -1,17 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>Controller</name>
<message>
<source> Next Lvl!!!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> You anblock next lvl (%0)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainMenu</name>
<message>

@ -1,19 +0,0 @@
#include "background.h"
BackGround::BackGround(double x, double y): ItemWorld (x, y) {
this->setSize(200, 400);
setBeckGroundObject(true);
}
void BackGround::render() {
auto wPart = size().x() / 2;
if (position().x() + wPart < 200) {
setX(wPart);
}
}
void BackGround::reset() {
setX(0 - size().x());
render();
}

@ -1,16 +0,0 @@
#ifndef BACKGROUND_H
#define BACKGROUND_H
#include "itemworld.h"
class BackGround : public ItemWorld
{
public:
BackGround(double x, double y);
void render() override;
void reset() override;
};
#endif // BACKGROUND_H

@ -1,17 +0,0 @@
#include "backgrounditem.h"
#include <QColor>
BackGroundItem::BackGroundItem(double x, double y):
ItemWorld (x, y) {
setBeckGroundObject(true);
reset();
}
void BackGroundItem::reset() {
auto tempColor = QColor(rand() % 255, rand() % 255, rand() % 255, 10);
setColor(tempColor.name(QColor::HexArgb));
auto radius = rand() % 200;
setSize(radius , radius);
}

@ -1,15 +0,0 @@
#ifndef BACKGROUNDITEM_H
#define BACKGROUNDITEM_H
#include "itemworld.h"
class BackGroundItem : public ItemWorld
{
public:
BackGroundItem(double x, double y);
void reset() override;
};
#endif // BACKGROUNDITEM_H

@ -1,156 +0,0 @@
#include "controller.h"
#include <cmath>
#include <ctime>
#include "diff.h"
#include "lvls.h"
#include "mainmenumodel.h"
#include "qmlnotifyservice.h"
Controller::Controller() {
srand(static_cast<unsigned int>(time(nullptr)));
timer = new QTimer();
timer->setInterval(1);
_networkModel = new MainMenuModel(this);
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
connect(_networkModel, &MainMenuModel::newGame, this, &Controller::handleNewGame);
}
Controller::~Controller() {
}
bool Controller::nextLvl() {
if (lvl + 1 >= lvls.size()) {
return true;
}
m_generalLong += static_cast<int>(world.getCurrentLong());
generateDiff(world.init(lvls.value(++lvl)));
startTimer();
return false;
}
void Controller::generateDiff(const QMap<int, GuiObject *>& objs) {
auto removeIds = objectsContainer.keys();
QList<int> addedIds;
for (auto i = objs.begin(); i != objs.end(); ++i) {
if (objectsContainer.contains(i.key())) {
removeIds.removeOne(i.key());
} else {
objectsContainer.insert(i.key(), i.value());
addedIds.push_back(i.key());
}
}
if (removeIds.size() || addedIds.size()) {
Diff diff;
diff.setRemoveIds(removeIds);
diff.setAddedIds(addedIds);
emit gameObjectsChanged(diff);
}
}
void Controller::update() {
if (pause) {
return;
}
world.render();
if(world.isDefiat()) {
stopTimer();
if (!_showMenu) {
setShowMenu(true);
}
handleNewGame();
}
if (world.isEnd()) {
stopTimer();
if (!_showMenu) {
if (auto service = QmlNotificationService::NotificationService::getService()) {
QmlNotificationService::NotificationData notify(tr(" Next Lvl!!!"),
tr(" You anblock next lvl (%0)" ).arg(lvl),
"qrc:/texture/up");
service->setNotify(notify);
}
}
nextLvl();
}
emit long_changed(static_cast<int>(world.getCurrentLong()));
emit generalLongchanged(generalLong());
}
void Controller::handleNewGame() {
world.resetPosition();
WorldRules newGameRules = lvls.first();
lvl = 0;
m_generalLong = 0;
generateDiff(world.init(newGameRules));
startTimer();
}
QObject *Controller::getGameObject(int id) {
return objectsContainer.value(id, nullptr);
}
void Controller::startTimer() {
timer->start();
}
void Controller::stopTimer() {
timer->stop();
}
int Controller::long_() const {
return static_cast<int>(world.getCurrentLong());
}
int Controller::generalLong() const {
return m_generalLong + long_();
}
QObject *Controller::mainMenuModel() const {
return _networkModel;
}
void Controller::buttonPress() {
world.reversClick();
}
void Controller::setPause(bool p){
pause = p;
if (!pause) {
world.unPause();
}
}
bool Controller::showMenu() const {
return _showMenu;
}
void Controller::setShowMenu(bool showMenu) {
if (_showMenu == showMenu)
return;
_showMenu = showMenu;
emit showMenuChanged(_showMenu);
}

@ -1,88 +0,0 @@
#ifndef CONTROLLER_H
#define CONTROLLER_H
#include <QObject>
#include <QTimer>
#include <QTime>
#include "diff.h"
#include "snake.h"
#include "world.h"
class MainMenuModel;
class Controller : public QObject
{
Q_OBJECT
Q_PROPERTY(int long_ READ long_ NOTIFY long_changed)
Q_PROPERTY(int generalLong READ generalLong NOTIFY generalLongchanged)
Q_PROPERTY(QObject* mainMenuModel READ mainMenuModel NOTIFY mainMenuModelchanged)
Q_PROPERTY(bool showMenu READ showMenu WRITE setShowMenu NOTIFY showMenuChanged)
private:
World world;
QMap<int, GuiObject *> objectsContainer;
QTimer *timer = nullptr;
int lvl = 0;
int m_generalLong = 0;
bool pause = false;
bool _showMenu = true;
void generateDiff(const QMap<int, GuiObject *> &);
MainMenuModel* _networkModel = nullptr;
public:
Controller();
~Controller();
void startTimer();
void stopTimer();
int long_() const;
int generalLong() const;
bool showMenu() const;
QObject* mainMenuModel() const;
public slots:
void buttonPress();
void setPause(bool);
void update();
/**
* @brief nextLvl - switch to next lvl from array lvels
* @return true if all levels are passed
*/
bool nextLvl();
/**
* @brief newGame - start game from first lvl
*/
void handleNewGame();
/**
* @brief getGameObject
* @param id - id of guiObject;
* @return guiObject if (id is not valid return nullptr)
*/
QObject* getGameObject(int id);
void setShowMenu(bool showMenu);
signals:
/**
* @brief gameObjectsChanged
* @param dif
*/
void gameObjectsChanged(const Diff &dif);
void long_changed(int m_long);
void generalLongchanged(int generalLong);
void mainMenuModelchanged(QObject* mainMenuModel);
void showMenuChanged(bool showMenu);
};
#endif // CONTROLLER_H

@ -1,23 +0,0 @@
#include "guiobjectfactory.h"
#include "box.h"
#include "snakeutils.h"
#include "head.h"
#include "background.h"
#include "backgrounditem.h"
GuiObjectFactory::GuiObjectFactory() {}
ItemWorld *GuiObjectFactory::generate(const QString &name) {
ItemWorld *obj = nullptr;
if (name == "Box") {
obj = new Box(rand() % 400, 0);
}
else if (name == "BackGround") {
obj = new BackGround(0, 0);
}
else if (name == "BackGroundItem") {
obj = new BackGroundItem(0, 0);
}
return obj;
}

@ -1,27 +0,0 @@
#ifndef GUIOBJECTFACTORY_H
#define GUIOBJECTFACTORY_H
#include <QString>
class ItemWorld;
/**
* @brief The GuiObjectFactory class
* factory of gui ojects;
*/
class GuiObjectFactory
{
public:
GuiObjectFactory();
/**
* @brief generate - generate the child of GuiObject
* by object name.
* @param name - name of class of genereta object
* @return pointer of generated object.
* If method called with not valid name then return nullptr.
*/
static ItemWorld* generate(const QString& name);
};
#endif // GUIOBJECTFACTORY_H

@ -1,48 +0,0 @@
#include "head.h"
#include <cmath>
#include <QDateTime>
void Head::render() {
qint64 tempTime = QDateTime::currentMSecsSinceEpoch() - time;
time = QDateTime::currentMSecsSinceEpoch();
float u = ratation().toEulerAngles().z();
double dy = (*speed) * sin(u * TO_RADIAN) / 1000 * tempTime;
setY(position().y() + dy);
if (*speed < 1) {
setColor(generalSpeadColor);
} else if (*speed < normSpead) {
setColor(normSpeadColor);
} else if (*speed < fastSpead) {
setColor(fastSpeadColor);
} else if (*speed < megaFastSpead) {
setColor(megaFastSpeadColor);
}
}
void Head::reset() {
}
void Head::unPause() {
time = QDateTime::currentMSecsSinceEpoch();
}
Head::Head(float x, float y, float h, float w, float thickness, float *spead):
GuiObject ("SnakeItem") {
setposition({x, y, 0});
setSize({w, h, thickness});
this->speed = spead;
setMash("qrc:/mesh/res/meshes/cube.mesh");
}
Head::~Head() {
}

@ -1,31 +0,0 @@
#ifndef HEAD_H
#define HEAD_H
#define TO_RADIAN 0.017453293
#include "guiobject.h"
#include <QString>
class Head : public GuiObject
{
private:
qint64 time;
float *speed;
const int megaFastSpead = 200;
const int fastSpead = 100;
const int normSpead = 50;
const QString generalSpeadColor = "#616a6b";
const QString normSpeadColor = "#5d6d7e";
const QString fastSpeadColor = "#eb984e";
const QString megaFastSpeadColor = "#ec7063";
public:
Head(float x , float y, float h, float w, float thickness, float *speed);
void render() override;
void reset() override;
void unPause();
~Head() override;
};
#endif // HEAD_H

@ -1,11 +0,0 @@
#include "lvls.h"
QList<WorldRules> lvls {
WorldRules{{"Long", 500}, {"Box", 2}, {"Spead", 10}, {"BackGroundItem", 10}},
WorldRules{{"Long", 1000}, {"Box", 4}, {"Spead", 10}, {"BackGroundItem", 10}},
WorldRules{{"Long", 2000}, {"Box", 8}, {"Spead", 10}, {"BackGroundItem", 10}},
WorldRules{{"Long", 4000}, {"Box", 16}, {"Spead", 10}, {"BackGroundItem", 10}},
WorldRules{{"Long", 8000}, {"Box", 32}, {"Spead", 10}, {"BackGroundItem", 10}},
WorldRules{{"Long", 16000}, {"Box", 64}, {"Spead", 10}, {"BackGroundItem", 10}}
};

@ -1,9 +0,0 @@
#ifndef LVLS_H
#define LVLS_H
#include <QList>
#include "snakeutils.h"
extern QList<WorldRules> lvls;
#endif // LVLS_H

@ -0,0 +1,34 @@
#include "pluginloader.h"
#include <QLibrary>
#include <quasarapp.h>
typedef IWorld* (*instance)();
PluginLoader::PluginLoader() {
}
IWorld *PluginLoader::load(const QString &pluginPath) {
QLibrary lib(pluginPath);
if (!lib.load()) {
QuasarAppUtils::Params::log("Fail to load game module. Message: " + lib.errorString(),
QuasarAppUtils::Error);
return nullptr;
}
instance func = (instance)lib.resolve("instance");
if (!func) {
QuasarAppUtils::Params::log("Fail to load game module."
" Message: Failed to find a instance function in the %0 module",
QuasarAppUtils::Error);
lib.unload();
return nullptr;
}
return func();
}

@ -0,0 +1,25 @@
#ifndef PLUGINLOADER_H
#define PLUGINLOADER_H
#include <QString>
class IWorld;
/**
* @brief The PluginLoader class This class load shared objects like a plugins.
*/
class PluginLoader {
public:
PluginLoader();
/**
* @brief load This method load a plugin game module.
* @param pluginPath Path to so or dll plugin file.
* @return Snake WorldInstance;
* @note The plugin shiold be implement instance function and if you youse Windows systems marked as a DLL_EXPORT symbol.
*/
static IWorld* load(const QString& pluginPath);
};
#endif // PLUGINLOADER_H

@ -3,9 +3,7 @@
#include <quasarapp.h>
#define THEME "THEME_GUI"
#define THEME_DEFAULT 0
using Settings = QuasarAppUtils::Settings;
#endif // SNAKESETTINGS_H

Binary file not shown.

Before

(image error) Size: 32 KiB

Binary file not shown.

Before

(image error) Size: 2.4 KiB

@ -1,45 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="970.504px" height="970.503px" viewBox="0 0 970.504 970.503" style="enable-background:new 0 0 970.504 970.503;"
xml:space="preserve">
<g>
<path d="M120.027,962.802c26.6,0,53.5-8.801,75.7-27l288.1-234.7l290.899,237c22.301,18.1,49.101,27,75.7,27
c34.8,0,69.4-15.101,93.101-44.2c41.899-51.4,34.1-127-17.2-168.8l-366.7-298.8c-44.1-36-107.5-36-151.6,0l-363.8,296.5
c-51.4,41.8-59.1,117.399-17.3,168.8C50.727,947.702,85.227,962.802,120.027,962.802z"/>
<path d="M120.027,541.902c26.6,0,53.5-8.8,75.7-27l288.1-234.7l290.899,237c22.301,18.101,49.101,27,75.7,27
c34.8,0,69.4-15.1,93.101-44.2c41.899-51.399,34.1-127-17.2-168.8l-366.7-298.8c-44.1-36-107.5-36-151.6,0l-363.8,296.4
c-51.4,41.9-59.1,117.5-17.3,168.9C50.727,526.802,85.227,541.902,120.027,541.902z"/>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

Before

(image error) Size: 1.3 KiB

32
src/Empty/CMakeLists.txt Normal file

@ -0,0 +1,32 @@
#
# 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 "Empty")
add_definitions(-DSnakeProject_LIBRARY)
file(GLOB SOURCE_CPP
"*Empty/*.cpp"
"private/*.cpp"
"*.qrc"
"Empty/*.qrc"
"private/*.qrc"
)
set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(PRIVATE_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/private")
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})
set(QML_IMPORT_PATH ${QML_IMPORT_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/src" CACHE STRING "" FORCE)

38
src/Empty/Empty.qrc Normal file

@ -0,0 +1,38 @@
<RCC>
<qresource prefix="/">
<file>SnakeProjectModule/qmldir</file>
<file>SnakeProjectModule/SnakeProject.qml</file>
<file>SnakeProjectModule/GraphicItem.qml</file>
<file>SnakeProjectModule/ImageView.qml</file>
<file>SnakeProjectModule/MainMenu.qml</file>
<file>SnakeProjectModule/MainMenuButton.qml</file>
<file>SnakeProjectModule/Metrix.qml</file>
<file>SnakeProjectModule/PagePopUp.qml</file>
<file>SnakeProjectModule/PropertyView.qml</file>
<file>SnakeProjectModule/Scene.qml</file>
<file>SnakeProjectModule/SettingsView.qml</file>
<file>SnakeProjectModule/SnakeItem.qml</file>
<file>SnakeProject/IRender.qml</file>
</qresource>
<qresource prefix="/SnakeTr">
<file>languages/de.qm</file>
<file>languages/en.qm</file>
<file>languages/es.qm</file>
<file>languages/fr.qm</file>
<file>languages/ja.qm</file>
<file>languages/pl.qm</file>
<file>languages/ru.qm</file>
<file>languages/tr.qm</file>
<file>languages/zh.qm</file>
<file>languages/uk.qm</file>
</qresource>
<qresource prefix="/images">
<file>res/up.svg</file>
<file>res/logo.png</file>
<file>res/icon.ico</file>
</qresource>
<qresource prefix="/mesh">
<file>res/meshes/cube.mesh</file>
</qresource>
<qresource prefix="/hdr"/>
</RCC>

13
src/Empty/private/box.cpp Normal file

@ -0,0 +1,13 @@
#include "box.h"
#include <QColor>
Box::Box(double x, double y):
ItemWorld (x, y) {
this->setSize(10, 10);
setMash("qrc:/mesh/res/meshes/cube.mesh");
setColor(QColor(100, 100, 100).name());
}

13
src/Empty/private/box.h Normal file

@ -0,0 +1,13 @@
#ifndef BOX_H
#define BOX_H
#include "itemworld.h"
class Box: public ItemWorld
{
public:
Box(double x, double y);
};
#endif // BOX_H