2013-12-21 03:52:52 +08:00
|
|
|
/****************************************************************************
|
2014-01-07 11:25:07 +08:00
|
|
|
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
2013-12-21 03:52:52 +08:00
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
2013-12-10 10:50:31 +08:00
|
|
|
#ifndef __MISCNODE_CCGRID_NODE_H__
|
|
|
|
#define __MISCNODE_CCGRID_NODE_H__
|
|
|
|
|
|
|
|
#include "CCNode.h"
|
2013-12-26 18:11:23 +08:00
|
|
|
#include "renderer/CCGroupCommand.h"
|
2013-12-26 21:19:12 +08:00
|
|
|
#include "renderer/CCCustomCommand.h"
|
2013-12-10 10:50:31 +08:00
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
|
|
|
class GridBase;
|
|
|
|
|
2013-12-16 14:21:05 +08:00
|
|
|
class NodeGrid : public Node
|
2013-12-10 10:50:31 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-12-16 14:21:05 +08:00
|
|
|
static NodeGrid* create();
|
2013-12-10 10:50:31 +08:00
|
|
|
|
2013-12-16 14:21:05 +08:00
|
|
|
GridBase* getGrid() { return _nodeGrid; }
|
2013-12-10 10:50:31 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
*/
|
2013-12-16 14:21:05 +08:00
|
|
|
const GridBase* getGrid() const { return _nodeGrid; }
|
2013-12-10 10:50:31 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Changes a grid object that is used when applying effects
|
|
|
|
*
|
|
|
|
* @param grid A Grid object that is used when applying effects
|
|
|
|
*/
|
2013-12-16 14:21:05 +08:00
|
|
|
void setGrid(GridBase *grid);
|
2013-12-10 10:50:31 +08:00
|
|
|
|
2013-12-16 14:21:05 +08:00
|
|
|
void setTarget(Node *target);
|
2013-12-21 03:52:52 +08:00
|
|
|
|
|
|
|
// overrides
|
2014-04-08 21:45:54 +08:00
|
|
|
virtual void visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
|
2013-12-21 03:52:52 +08:00
|
|
|
|
2013-12-10 10:50:31 +08:00
|
|
|
protected:
|
2013-12-16 14:21:05 +08:00
|
|
|
NodeGrid();
|
|
|
|
virtual ~NodeGrid();
|
2013-12-10 10:50:31 +08:00
|
|
|
|
2013-12-18 17:19:50 +08:00
|
|
|
void onGridBeginDraw();
|
|
|
|
void onGridEndDraw();
|
|
|
|
|
2013-12-12 13:21:14 +08:00
|
|
|
Node* _gridTarget;
|
2013-12-10 10:50:31 +08:00
|
|
|
GridBase* _nodeGrid;
|
2013-12-26 18:11:23 +08:00
|
|
|
GroupCommand _groupCommand;
|
2013-12-26 21:19:12 +08:00
|
|
|
CustomCommand _gridBeginCommand;
|
|
|
|
CustomCommand _gridEndCommand;
|
2013-12-21 03:52:52 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(NodeGrid);
|
2013-12-10 10:50:31 +08:00
|
|
|
};
|
|
|
|
NS_CC_END
|
|
|
|
|
|
|
|
#endif
|