PlainNode.h
1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// PlainNode.h
// SteveMaggieCpp
//
// Created by Katarzyna Kalinowska-Górska on 17.05.2017.
//
//
#ifndef PlainNode_h
#define PlainNode_h
#include "cocos2d.h"
#include "LayoutObject.h"
#include "LayoutParser.h"
class PlainNode : public cocos2d::Node, public LayoutObject
{
public:
static PlainNode* create();
static PlainNode* createWithColour(cocos2d::Color4B color);
// virtual bool init() override;
virtual void loadPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene = NULL, const std::string resFolder = "", const std::string altResFolder = "") override;
virtual void prepareSize(const rapidjson::Value& jsonValue, float& width, float& height) override;
virtual void setContentSize(const cocos2d::Size& contentSize) override {
cocos2d::Node::setContentSize(contentSize);
if(_backgroundLayer != nullptr){
_backgroundLayer->setContentSize(contentSize);
_backgroundLayer->setPosition(cocos2d::Vec2(contentSize.width/2, contentSize.height/2));
}
}
protected:
cocos2d::LayerColor* _backgroundLayer;
};
#endif /* PlainNode_h */