mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-06 19:42:39 +08:00
add creator files
This commit is contained in:
@@ -218,6 +218,7 @@ LOCAL_MODULE_FILENAME := libcocos2d
|
||||
LOCAL_STATIC_LIBRARIES := cocostudio_static
|
||||
LOCAL_STATIC_LIBRARIES += cocosbuilder_static
|
||||
LOCAL_STATIC_LIBRARIES += spine_static
|
||||
LOCAL_STATIC_LIBRARIES += creator_static
|
||||
LOCAL_STATIC_LIBRARIES += cocos_network_static
|
||||
LOCAL_STATIC_LIBRARIES += audioengine_static
|
||||
|
||||
@@ -229,6 +230,7 @@ $(call import-module,android)
|
||||
$(call import-module,editor-support/cocostudio)
|
||||
$(call import-module,editor-support/cocosbuilder)
|
||||
$(call import-module,editor-support/spine)
|
||||
$(call import-module,editor-support/creator)
|
||||
$(call import-module,platform/android)
|
||||
$(call import-module,audio/android)
|
||||
$(call import-module,network)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := creator_static
|
||||
|
||||
LOCAL_MODULE_FILENAME := libcreator
|
||||
|
||||
LOCAL_SRC_FILES := CCScale9Sprite.cpp
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/..
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/..
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := cocos2dx_internal_static
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
File diff suppressed because it is too large
Load Diff
+168
@@ -0,0 +1,168 @@
|
||||
|
||||
/****************************************************************************
|
||||
Copyright (c) 2016 Chukong Technologies Inc.
|
||||
|
||||
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.
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#ifndef __CREATOR_CCSCALE9SPRITE_H__
|
||||
#define __CREATOR_CCSCALE9SPRITE_H__
|
||||
|
||||
#include "2d/CCNode.h"
|
||||
#include "2d/CCSpriteFrame.h"
|
||||
#include "renderer/CCTrianglesCommand.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
namespace creator {
|
||||
|
||||
class Scale9SpriteV2 : public cocos2d::Node
|
||||
{
|
||||
public:
|
||||
enum class FillType
|
||||
{
|
||||
HORIZONTAL = 0,
|
||||
VERTICAL = 1,
|
||||
RADIAL = 2,
|
||||
};
|
||||
|
||||
enum class RenderingType
|
||||
{
|
||||
SIMPLE = 0,
|
||||
SLICED = 1,
|
||||
TILED = 2,
|
||||
FILLED = 3,
|
||||
};
|
||||
|
||||
enum class State
|
||||
{
|
||||
NORMAL = 0,
|
||||
GRAY = 1,
|
||||
};
|
||||
|
||||
public:
|
||||
Scale9SpriteV2();
|
||||
virtual ~Scale9SpriteV2();
|
||||
|
||||
bool initWithTexture (cocos2d::Texture2D* texture) {
|
||||
return this->setTexture(texture);
|
||||
}
|
||||
|
||||
bool initWithTexture (const std::string& textureFile) {
|
||||
return this->setTexture(textureFile);
|
||||
}
|
||||
|
||||
bool initWithSpriteFrame (cocos2d::SpriteFrame* spriteFrame) {
|
||||
return this->setSpriteFrame(spriteFrame);
|
||||
}
|
||||
|
||||
bool initWithSpriteFrame (const std::string& sfName) {
|
||||
return this->setSpriteFrame(sfName);
|
||||
}
|
||||
|
||||
bool setTexture (const std::string& textureFile);
|
||||
bool setTexture (cocos2d::Texture2D* texture);
|
||||
bool setSpriteFrame(const std::string& sfName);
|
||||
bool setSpriteFrame(cocos2d::SpriteFrame* spriteFrame);
|
||||
|
||||
void setBlendFunc(const cocos2d::BlendFunc& blendFunc);
|
||||
void setBlendFunc(GLenum src, GLenum dst);
|
||||
const cocos2d::BlendFunc& getBlendFunc() const;
|
||||
|
||||
virtual void setContentSize(const cocos2d::Size& contentSize) override;
|
||||
|
||||
void enableTrimmedContentSize (bool isTrimmed);
|
||||
bool isTrimmedContentSizeEnabled() const { return this->_isTrimmedContentSize; }
|
||||
|
||||
void setState(State state);
|
||||
State getState() const { return this->_brightState; }
|
||||
|
||||
void setRenderingType(RenderingType type);
|
||||
RenderingType getRenderingType() const { return this->_renderingType; }
|
||||
|
||||
void setInsetLeft(float value);
|
||||
void setInsetTop(float value);
|
||||
void setInsetRight(float value);
|
||||
void setInsetBottom(float value);
|
||||
|
||||
float getInsetLeft() const { return this->_insetLeft; }
|
||||
float getInsetTop() const { return this->_insetTop; }
|
||||
float getInsetRight() const { return this->_insetRight; }
|
||||
float getInsetBottom() const { return this->_insetBottom; }
|
||||
|
||||
void setFillType(FillType value);
|
||||
void setFillCenter(const cocos2d::Vec2& center);
|
||||
void setFillCenter(float x, float y);
|
||||
void setFillStart(float value);
|
||||
void setFillRange(float value);
|
||||
|
||||
FillType getFillType() const { return this->_fillType; }
|
||||
const cocos2d::Vec2& getFillCenter() const { return this->_fillCenter; }
|
||||
float getFillStart() const { return this->_fillStart; }
|
||||
float getFillRange() const { return this->_fillRange; }
|
||||
|
||||
virtual void draw(cocos2d::Renderer *renderer, const cocos2d::Mat4 &transform, uint32_t flags) override;
|
||||
protected:
|
||||
virtual void updateColor() override;
|
||||
|
||||
private:
|
||||
void _rebuildQuads ();
|
||||
//resource data
|
||||
cocos2d::SpriteFrame* _spriteFrame;
|
||||
|
||||
//scale 9 data
|
||||
float _insetLeft;
|
||||
float _insetRight;
|
||||
float _insetTop;
|
||||
float _insetBottom;
|
||||
//blend function
|
||||
cocos2d::BlendFunc _blendFunc;
|
||||
//sliced or simple
|
||||
RenderingType _renderingType;
|
||||
//bright or not
|
||||
State _brightState;
|
||||
//rendering quads
|
||||
std::vector<cocos2d::V3F_C4B_T2F_Quad> _quads;
|
||||
bool _quadsDirty;
|
||||
cocos2d::V3F_C4B_T2F_Quad _rawQuad;
|
||||
bool _isTriangle;
|
||||
bool _isTrimmedContentSize;
|
||||
//fill type
|
||||
FillType _fillType;
|
||||
//for fill radial
|
||||
cocos2d::Vec2 _fillCenter;
|
||||
//normalized filled start and range
|
||||
float _fillStart;
|
||||
float _fillRange;
|
||||
//indicate that rendercommand need to be rebuild or not;
|
||||
bool _needRebuildRenderCommand;
|
||||
|
||||
std::vector<cocos2d::V3F_C4B_T2F> _verts;
|
||||
std::vector<unsigned short> _indices;
|
||||
cocos2d::TrianglesCommand _renderCommand;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user