add creator files

This commit is contained in:
2youyouo2
2016-04-13 15:35:27 +08:00
parent a4d8f0ba8c
commit ce4f78f312
8 changed files with 1374 additions and 3 deletions
@@ -686,6 +686,10 @@
4D76BE3B1A4AAF0A00102962 /* CCActionTimelineNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4D76BE381A4AAF0A00102962 /* CCActionTimelineNode.cpp */; };
4D76BE3C1A4AAF0A00102962 /* CCActionTimelineNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D76BE391A4AAF0A00102962 /* CCActionTimelineNode.h */; };
4D76BE3D1A4AAF0A00102962 /* CCActionTimelineNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D76BE391A4AAF0A00102962 /* CCActionTimelineNode.h */; };
4DFA4C171CBCE34100E3B736 /* CCScale9Sprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DFA4C151CBCE34100E3B736 /* CCScale9Sprite.cpp */; };
4DFA4C181CBCE34100E3B736 /* CCScale9Sprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DFA4C151CBCE34100E3B736 /* CCScale9Sprite.cpp */; };
4DFA4C191CBCE34100E3B736 /* CCScale9Sprite.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DFA4C161CBCE34100E3B736 /* CCScale9Sprite.h */; };
4DFA4C1A1CBCE34100E3B736 /* CCScale9Sprite.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DFA4C161CBCE34100E3B736 /* CCScale9Sprite.h */; };
5012168E1AC47380009A4BEA /* CCRenderState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5012168C1AC47380009A4BEA /* CCRenderState.cpp */; };
5012168F1AC47380009A4BEA /* CCRenderState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5012168C1AC47380009A4BEA /* CCRenderState.cpp */; };
501216901AC47380009A4BEA /* CCRenderState.h in Headers */ = {isa = PBXBuildFile; fileRef = 5012168D1AC47380009A4BEA /* CCRenderState.h */; };
@@ -1807,6 +1811,8 @@
46A168651807AF4E005B8026 /* CCTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CCTableViewCell.h; sourceTree = "<group>"; };
4D76BE381A4AAF0A00102962 /* CCActionTimelineNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCActionTimelineNode.cpp; sourceTree = "<group>"; };
4D76BE391A4AAF0A00102962 /* CCActionTimelineNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCActionTimelineNode.h; sourceTree = "<group>"; };
4DFA4C151CBCE34100E3B736 /* CCScale9Sprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCScale9Sprite.cpp; path = creator/CCScale9Sprite.cpp; sourceTree = "<group>"; };
4DFA4C161CBCE34100E3B736 /* CCScale9Sprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCScale9Sprite.h; path = creator/CCScale9Sprite.h; sourceTree = "<group>"; };
5012168C1AC47380009A4BEA /* CCRenderState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCRenderState.cpp; sourceTree = "<group>"; };
5012168D1AC47380009A4BEA /* CCRenderState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCRenderState.h; sourceTree = "<group>"; };
50272538190BF1B900AAF4ED /* cocos2d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cocos2d.h; path = ../cocos/cocos2d.h; sourceTree = "<group>"; };
@@ -2773,6 +2779,7 @@
1AD71CF7180E26E600808F54 /* editor-support */ = {
isa = PBXGroup;
children = (
4DFA4C141CBCE32800E3B736 /* creator */,
1AD71CF8180E26E600808F54 /* cocosbuilder */,
1A8C5946180E930E00EF57C3 /* cocostudio */,
1AD71D7C180E26E600808F54 /* spine */,
@@ -3233,6 +3240,15 @@
path = ../cocos/math;
sourceTree = "<group>";
};
4DFA4C141CBCE32800E3B736 /* creator */ = {
isa = PBXGroup;
children = (
4DFA4C151CBCE34100E3B736 /* CCScale9Sprite.cpp */,
4DFA4C161CBCE34100E3B736 /* CCScale9Sprite.h */,
);
name = creator;
sourceTree = "<group>";
};
500DC89819105D41007B91BF /* renderer */ = {
isa = PBXGroup;
children = (
@@ -3671,6 +3687,7 @@
1A57007F180BC5A10088DEC7 /* CCActionInterval.h in Headers */,
15AE188719AAD33D00C27E9E /* CCBSequenceProperty.h in Headers */,
1A570083180BC5A10088DEC7 /* CCActionManager.h in Headers */,
4DFA4C191CBCE34100E3B736 /* CCScale9Sprite.h in Headers */,
1A570087180BC5A10088DEC7 /* CCActionPageTurn3D.h in Headers */,
50ABBD911925AB4100A911A9 /* CCGLProgramCache.h in Headers */,
50ED2BDA19BE76D300A0AB90 /* UIVideoPlayer.h in Headers */,
@@ -4064,6 +4081,7 @@
B29A7E2419EE1B7700872B35 /* IkConstraint.h in Headers */,
50CB247E19D9C5A100687767 /* AudioPlayer.h in Headers */,
1A57007C180BC5A10088DEC7 /* CCActionInstant.h in Headers */,
4DFA4C1A1CBCE34100E3B736 /* CCScale9Sprite.h in Headers */,
15AE18CD19AAD33D00C27E9E /* CCNode+CCBRelativePositioning.h in Headers */,
50ABBE781925AB6F00A911A9 /* CCEventListenerTouch.h in Headers */,
15AE1BC019AADFF000C27E9E /* WebSocket.h in Headers */,
@@ -4472,6 +4490,7 @@
50ABBD501925AB0000A911A9 /* Quaternion.cpp in Sources */,
15AE190119AAD35000C27E9E /* CCComController.cpp in Sources */,
15AE1BE619AAE01E00C27E9E /* CCTableViewCell.cpp in Sources */,
4DFA4C171CBCE34100E3B736 /* CCScale9Sprite.cpp in Sources */,
50ABBEBB1925AB6F00A911A9 /* ccUtils.cpp in Sources */,
A679D0F71C74BA3600620A6C /* CCArmatureAnimation.cpp in Sources */,
15AE186A19AAD31D00C27E9E /* CocosDenshion.m in Sources */,
@@ -4806,6 +4825,7 @@
50ABBD941925AB4100A911A9 /* CCGLProgramState.cpp in Sources */,
ED30578B1BEC774D0083C3ED /* ioapi_mem.cpp in Sources */,
B257B44F1989D5E800D9A687 /* CCPrimitive.cpp in Sources */,
4DFA4C181CBCE34100E3B736 /* CCScale9Sprite.cpp in Sources */,
50ABBE281925AB6F00A911A9 /* CCAutoreleasePool.cpp in Sources */,
A60A9D641C200DE70070800A /* CCPhysicsSprite.cpp in Sources */,
15AE18D519AAD33D00C27E9E /* CCScale9SpriteLoader.cpp in Sources */,
@@ -5255,7 +5275,7 @@
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
HEADER_SEARCH_PATHS = "";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../external/ios/libs\"";
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-llibsql3";
@@ -5281,7 +5301,7 @@
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
HEADER_SEARCH_PATHS = "";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../external/ios/libs\"";
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = "";
+2
View File
@@ -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
View File
@@ -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
+5
View File
@@ -495,6 +495,9 @@
"cocos/editor-support/spine/spine-cocos2dx.cpp",
"cocos/editor-support/spine/spine-cocos2dx.h",
"cocos/editor-support/spine/spine.h",
"cocos/editor-support/creator/CCScale9Sprite.h",
"cocos/editor-support/creator/CCScale9Sprite.cpp",
"cocos/editor-support/creator/Android.mk",
"cocos/math/CCAffineTransform.cpp",
"cocos/math/CCAffineTransform.h",
"cocos/math/CCGeometry.cpp",
@@ -2722,6 +2725,8 @@
"cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.hpp",
"cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp",
"cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp",
"cocos/scripting/js-bindings/auto/jsb_creator_auto.cpp",
"cocos/scripting/js-bindings/auto/jsb_creator_auto.hpp",
"cocos/scripting/js-bindings/manual/ScriptingCore.cpp",
"cocos/scripting/js-bindings/manual/ScriptingCore.h",
"cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_auto_classes.cpp",
+64
View File
@@ -0,0 +1,64 @@
[creator]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = creator
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = cc
# the native namespace in which this module locates, this parameter is used for avoid conflict of the same class name in different modules, as "cocos2d::Label" <-> "cocos2d::ui::Label".
cpp_namespace = creator
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/include
android_flags = -D_SIZE_T_DEFINED_
clang_headers = -I%(clangllvmdir)s/lib/clang/%(clang_version)s/include
clang_flags = -nostdinc -x c++ -std=c++11 -U __SSE__
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/editor-support -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(creatordir)s/CCScale9Sprite.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = Scale9SpriteV2
classes_need_extend = Scale9SpriteV2
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = *::[^visit$ ^draw$ copyWith.* onEnter.* onExit.* ^description$]
rename_functions =
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents = Helper
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip = Ref
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes = Helper LayoutManager AbstractCheckButton
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
script_control_cpp = yes
+4 -1
View File
@@ -98,6 +98,7 @@ def main():
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
cocos_root = os.path.abspath(project_root)
creator_root = os.path.abspath(os.path.join(cocos_root, 'cocos/editor-support/creator'))
jsb_root = os.path.abspath(os.path.join(project_root, 'cocos/scripting/js-bindings'))
cxx_generator_root = os.path.abspath(os.path.join(project_root, 'tools/bindings-generator'))
@@ -105,6 +106,7 @@ def main():
config = ConfigParser.ConfigParser()
config.set('DEFAULT', 'androidndkdir', ndk_root)
config.set('DEFAULT', 'clangllvmdir', llvm_path)
config.set('DEFAULT', 'creatordir', creator_root)
config.set('DEFAULT', 'cocosdir', cocos_root)
config.set('DEFAULT', 'jsbdir', jsb_root)
config.set('DEFAULT', 'cxxgeneratordir', cxx_generator_root)
@@ -147,7 +149,8 @@ def main():
'cocos2dx_studio.ini' : ('cocos2dx_studio', 'jsb_cocos2dx_studio_auto'), \
'cocos2dx_spine.ini' : ('cocos2dx_spine', 'jsb_cocos2dx_spine_auto'), \
'cocos2dx_experimental_webView.ini' : ('cocos2dx_experimental_webView', 'jsb_cocos2dx_experimental_webView_auto'), \
'cocos2dx_experimental_video.ini' : ('cocos2dx_experimental_video', 'jsb_cocos2dx_experimental_video_auto'),
'cocos2dx_experimental_video.ini' : ('cocos2dx_experimental_video', 'jsb_cocos2dx_experimental_video_auto'), \
'creator.ini': ('creator', 'jsb_creator_auto'),
}
target = 'spidermonkey'
generator_py = '%s/generator.py' % cxx_generator_root