4
1
mirror of https://github.com/QuasarApp/Snake.git synced 2025-05-07 23:19:43 +00:00

fix test scane

This commit is contained in:
Andrei Yankovich 2021-06-16 15:46:21 +03:00
parent a80e17111f
commit 0880b1e891
7 changed files with 37 additions and 34 deletions

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

@ -92,8 +92,6 @@ bool IWorld::init() {
return false;
}
setCameraReleativePosition(initCameraPosition());
if (!_worldRules->size()) {
deinit();
return false;
@ -188,14 +186,15 @@ int IWorld::removeAnyItemFromGroup(const QString &group) {
return anyObjectId;
}
bool IWorld::takeTap() {
bool result = _tap;
_tap = false;
return result;
const QQuaternion &IWorld::cameraRatation() const {
return _cameraRatation;
}
void IWorld::setTap(bool newTap) {
_tap = newTap;
void IWorld::setCameraRatation(const QQuaternion &newCameraRatation) {
if (_cameraRatation == newCameraRatation)
return;
_cameraRatation = newCameraRatation;
emit cameraRatationChanged();
}
IAI *IWorld::backgroundAI() const {
@ -218,10 +217,6 @@ void IWorld::setCameraReleativePosition(const QVector3D &newCameraReleativePosit
emit cameraReleativePositionChanged();
}
void IWorld::handleTap() {
_tap = true;
}
void IWorld::handleStop() {
stop();
}

@ -7,6 +7,7 @@
#include <QMap>
#include <QMultiHash>
#include <QObject>
#include <QQuaternion>
#include <QString>
#include "irender.h"
#include "diff.h"
@ -42,7 +43,8 @@ struct WorldObjectWraper {
class SNAKEPROJECT_EXPORT IWorld : public QObject, public IRender
{
Q_OBJECT
Q_PROPERTY(QVector3D cameraReleativePosition READ cameraReleativePosition WRITE setCameraReleativePosition NOTIFY cameraReleativePositionChanged)
Q_PROPERTY(QVector3D cameraReleativePosition READ cameraReleativePosition NOTIFY cameraReleativePositionChanged)
Q_PROPERTY(QQuaternion cameraRatation READ cameraRatation NOTIFY cameraRatationChanged)
Q_PROPERTY(int worldStatus READ wordlStatus WRITE setWorldStatus NOTIFY worldStatusChanged)
@ -119,12 +121,6 @@ public:
*/
virtual void render(unsigned int tbfMsec) override;
/**
* @brief cameraPosition This method should be return relative position of camera. position should be relative of player object.
* @return camera releative position
*/
virtual QVector3D initCameraPosition() = 0;
/**
* @brief initPlayerControl This method should be configure all connections of @a control object.
* @brief control This is control object
@ -202,6 +198,12 @@ public:
*/
IAI *backgroundAI() const;
/**
* @brief cameraRatation This method return curent camera ratation.
* @return Quaternion of camera ratation
*/
const QQuaternion &cameraRatation() const;
signals:
/**
* @brief sigGameFinished This signal emit when game are finished
@ -230,7 +232,13 @@ signals:
*/
void worldStatusChanged();
/**
* @brief cameraRatationChanged This method emited when ratation of the camera cahnged
*/
void cameraRatationChanged();
protected:
/**
* @brief generate This method shold be generate object from the @a objectType.
* Override this method for add support yourown objects.
@ -246,13 +254,12 @@ protected:
void setCameraReleativePosition(const QVector3D &newCameraReleativePosition);
/**
* @brief takeTap This method return true if user the tap on screen.
* @return true if user tap on screen.
* @brief setCameraRatation This method sets new ratation of the camera.
* @param newCameraRatation new ratation of the camera.
*/
bool takeTap();
void setCameraRatation(const QQuaternion &newCameraRatation);
private slots:
void handleTap();
void handleStop();
private:
@ -284,11 +291,10 @@ private:
*/
int removeAnyItemFromGroup(const QString &group);
void setTap(bool newTap);
QHash<int, WorldObjectWraper> _items;
QMultiHash<QString, int> _itemsGroup;
QVector3D _cameraReleativePosition;
QQuaternion _cameraRatation;
QString _hdrMap;
WorldRule *_worldRules = nullptr;
@ -298,7 +304,6 @@ private:
friend class Engine;
int _worldStatus = 0;
bool _tap = false;
};
#endif // IWORLD_H

@ -1,5 +1,8 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
Item {
GridLayout {
property var model: null
anchors.fill: parent
}

@ -50,9 +50,9 @@ View3D {
gameMenu.model = gameMenuModel;
} else if (component.status === Component.Error) {
} else if (comp.status === Component.Error) {
// Error Handling
console.log("Error loading component:", component.errorString());
console.log("Error loading component: " + gameMenuModel.view, comp.errorString());
}
}
@ -70,7 +70,7 @@ View3D {
:
Qt.vector3d(0,0,0)
eulerRotation.z: -90
rotation: (world)? world.cameraRatation: Qt.quaternion(0,0,0,0)
}

@ -1,3 +1,3 @@
module QuasarAppCreditsModule
module SnakeProjectModule
SnakeProject 1.0 SnakeProject.qml
DefaultMenu 1.0 DefaultMenu.qml

@ -1 +1 @@
Subproject commit fd1ec0371698b23a0ad5635471b45e6b35f009f7
Subproject commit 5c3ac9efe9ef94f2b3f64a92c4bce0116292a823