mirror of
https://github.com/QuasarApp/Snake.git
synced 2025-04-26 09:44:40 +00:00
ref #97 Create a class for control position of group objects.
This commit is contained in:
parent
329beb162d
commit
ec8d499b9f
44
src/Core/Crawl/controlpos.cpp
Normal file
44
src/Core/Crawl/controlpos.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
//#
|
||||
//# 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 "controlpos.h"
|
||||
|
||||
namespace CRAWL {
|
||||
|
||||
ControlPos::ControlPos() {
|
||||
|
||||
}
|
||||
|
||||
void ControlPos::add(ClasterItem *object) {
|
||||
|
||||
GroupObject::updatePosition();
|
||||
|
||||
}
|
||||
|
||||
void ControlPos::remove(ClasterItem *object) {
|
||||
|
||||
GroupObject::updatePosition();
|
||||
|
||||
}
|
||||
|
||||
void ControlPos::changeLayout(const _Figure &fig) {
|
||||
|
||||
if (fig == CIRCLE) {
|
||||
GroupObject::updatePosition();
|
||||
}
|
||||
|
||||
if (fig == SQUARE) {
|
||||
GroupObject::updatePosition();
|
||||
}
|
||||
|
||||
if (fig == LINE) {
|
||||
GroupObject::updatePosition();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
48
src/Core/Crawl/controlpos.h
Normal file
48
src/Core/Crawl/controlpos.h
Normal file
@ -0,0 +1,48 @@
|
||||
//#
|
||||
//# 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 CONTROLPOS_H
|
||||
#define CONTROLPOS_H
|
||||
|
||||
#include <Crawl/groupobject.h>
|
||||
|
||||
|
||||
namespace CRAWL {
|
||||
|
||||
/**
|
||||
* @brief The ControlPos class
|
||||
*/
|
||||
class ControlPos: public GroupObject {
|
||||
public:
|
||||
ControlPos();
|
||||
|
||||
// Claster interface
|
||||
public:
|
||||
void add(ClasterItem *object);
|
||||
void remove(ClasterItem *object);
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief The _Figure enum
|
||||
*/
|
||||
enum _Figure {
|
||||
CIRCLE,
|
||||
SQUARE,
|
||||
LINE
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief changeLayout
|
||||
* @param fig
|
||||
*/
|
||||
void changeLayout(const _Figure &fig);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
#endif // CONTROLPOS_H
|
Loading…
x
Reference in New Issue
Block a user