mirror of https://github.com/axmolengine/axmol.git
Merge remote-tracking branch 'upstream/develop' into develop
Conflicts: cocos/scripting/auto-generated plugin samples/Javascript/Shared tools/bindings-generator
This commit is contained in:
commit
271e58d562
|
@ -2,7 +2,8 @@ language: cpp
|
|||
env:
|
||||
matrix:
|
||||
- GEN_JSB=YES
|
||||
- PLATFORM=linux DEBUG=1
|
||||
- PLATFORM=linux DEBUG=1 CC_COMPILER=gcc CXX_COMPILER=g++
|
||||
- PLATFORM=linux DEBUG=1 CC_COMPILER=clang CXX_COMPILER=clang++
|
||||
# Since switching to C++11 only the ARM version of the nactive client
|
||||
# port currently builds. TODO(sbc): Re-enable all architectures.
|
||||
# Disabled travis-ci build for native client port since it doesn't support std::thread, std::mutex.
|
||||
|
@ -23,6 +24,8 @@ env:
|
|||
9lV+vgJQDRcFe7dKwtC86vk10EU7Ym2bhVmhMxi/AlmJXgavjmPVdizRT7rh
|
||||
X2Ry/Nb6hGRkH3WS0T3D/KG1+e7lP/TMB9bvo6/locLJ2A6Z1YI=
|
||||
script:
|
||||
- export CC=$CC_COMPILER
|
||||
- export CXX=$CXX_COMPILER
|
||||
- tools/travis-scripts/run-script.sh
|
||||
before_install:
|
||||
- tools/travis-scripts/before-install.sh
|
||||
|
|
30
AUTHORS
30
AUTHORS
|
@ -356,6 +356,7 @@ Developers:
|
|||
|
||||
ThePickleMan
|
||||
Adding 'rotationIsDir' property to ParticleSystem.
|
||||
DrawNode supports to draw triangle, quad bezier, cubic bezier.
|
||||
|
||||
Jianghua (jxhgzs)
|
||||
Adding an additional transform for CCNode.
|
||||
|
@ -402,6 +403,7 @@ Developers:
|
|||
Zecken (gelldur)
|
||||
Fixing a profiling compilation error in CCParticleBatchNode.
|
||||
Fixing linking errors for TestCPP with libcurl on linux.
|
||||
Fixing a bug that crash was triggered if there is not `textureFileName`section in particle plist file.
|
||||
|
||||
flamingo (flaming0)
|
||||
Null pointer check in order to prevent crashes.
|
||||
|
@ -518,6 +520,7 @@ Developers:
|
|||
Correcting the type detecting order for Lua CCBProxy::getNodeTypeName.
|
||||
Casting variables to their own type, and print warning info if no corresponding lua callback function instead of crash.
|
||||
fix of WebSocket url parse error for 'ws://domain.com/websocket' pattern.
|
||||
Fixed a bug that Websocket doesn't support send/receive data which larger than 4096 bytes.
|
||||
|
||||
musikov
|
||||
Fixing a bug that missing precision when getting strokeColor and fontFillColor
|
||||
|
@ -656,6 +659,7 @@ Developers:
|
|||
|
||||
xhcnb
|
||||
Device::setAccelerometerEnabled needs to be invoked before adding ACC listener.
|
||||
Fixed a bug that it will get wrong custom properties when use different count custom properties in CocosBuilder.
|
||||
|
||||
bopohaa
|
||||
Fixed a bug that Webp test crashes.
|
||||
|
@ -668,6 +672,7 @@ Developers:
|
|||
|
||||
zhiqiangxu
|
||||
Fixed a logic error in ControlUtils::RectUnion.
|
||||
Fixed an issue that there is an useless conversion in ScrollView::onTouchBegan.
|
||||
|
||||
yinkaile (2youyouo2)
|
||||
Maintainer of Armature Bone Animation.
|
||||
|
@ -688,6 +693,31 @@ Developers:
|
|||
SBKarr
|
||||
AngelCode binary file format support for LabelBMFont.
|
||||
|
||||
zarelaky
|
||||
OpenAL context isn't destroyed correctly on mac and ios.
|
||||
|
||||
kicktheken (Kenneth Chan)
|
||||
Fixed a bug that the setBlendFunc method of some classes wasn't exposed to LUA.
|
||||
|
||||
andyque
|
||||
Fixed a bug that missing to check self assignment of Vector<T>, Map<K,V>, Value and String.
|
||||
Fixed a bug that move assignment operator doesn't clear previous content bug.
|
||||
Fixed the compile error of Map's getRandomObject.
|
||||
|
||||
daltomi
|
||||
Fixed a typo in Director class.
|
||||
Removed an unnecessary boolean flag in CCFontAtlasCache.cpp.
|
||||
|
||||
v1ctor
|
||||
ControlSlider supports to set selected thumb sprite.
|
||||
ControlButton supports to set scale ratio of touchdown state
|
||||
|
||||
akof1314
|
||||
TestCpp works by using CMake and mingw on Windows.
|
||||
|
||||
Pisces000221
|
||||
Corrected a few mistakes in the README file of project-creator.
|
||||
|
||||
Retired Core Developers:
|
||||
WenSheng Yang
|
||||
Author of windows port, CCTextField,
|
||||
|
|
57
CHANGELOG
57
CHANGELOG
|
@ -1,14 +1,32 @@
|
|||
cocos2d-x-3.0beta0 ?? 2013
|
||||
cocos2d-x-3.0final ?.? ?
|
||||
[All]
|
||||
[FIX] Crash was triggered if there is not `textureFileName`section in particle plist file.
|
||||
[FIX] ControlSlider doesn't support to set selected thumb sprite.
|
||||
[FIX] ControlButton doesn't support to set scale ratio of touchdown state.
|
||||
[FIX] Websocket doesn't support send/receive data which larger than 4096 bytes.
|
||||
[NEW] DrawNode supports to draw triangle, quad bezier, cubic bezier.
|
||||
[FIX] TestCpp works by using CMake on Windows.
|
||||
cocos2d-x-3.0beta Jan.7 2014
|
||||
[All]
|
||||
[NEW] New label: shadow, outline, glow support
|
||||
[NEW] AngelCode binary file format support for LabelBMFont
|
||||
[NEW] New spine runtime support
|
||||
[NEW] Add templated containers, such as `cocos2d::Map<>` and `cocos2d::Vector<>`
|
||||
[NEW] TextureCache::addImageAsync() uses std::function<> as call back
|
||||
[NEW] Namespace changed: network -> cocos2d::network, gui -> cocos2d::gui
|
||||
[NEW] Added more CocoStudioSceneTest samples.
|
||||
[NEW] Added UnitTest for Vector<T>, Map<K, V>, Value.
|
||||
[NEW] AngelCode binary file format support for LabelBMFont.
|
||||
[NEW] New renderer: Scene graph and Renderer are decoupled now.
|
||||
[NEW] Upgrated Box2D to 2.3.0
|
||||
[NEW] SChedule::performFunctionInCocosThread()
|
||||
[NEW] Added tga format support again.
|
||||
[NEW] Adds UnitTest for Template container and Value class
|
||||
[FIX] A Logic error in ControlUtils::RectUnion.
|
||||
[FIX] Bug fixes for Armature, use Vector<T>, Map<K, V> instead of Array, Dictionary.
|
||||
[FIX] Used c++11 range loop(highest performance) instead of other types of loop.
|
||||
[FIX] Removed most hungarian notations.
|
||||
[FIX] Merged NodeRGBA to Node.
|
||||
[NEW] New renderer support.
|
||||
[FIX] Potential hash collision fix.
|
||||
[FIX] Updates spine runtime to the latest version.
|
||||
[FIX] Uses `const std::string&` instead of `const char*`.
|
||||
|
@ -18,19 +36,48 @@ cocos2d-x-3.0beta0 ?? 2013
|
|||
[FIX] String itself is also modified in `String::componentsSeparatedByString`.
|
||||
[FIX] Sprites with PhysicsBody move to a wrong position when game resume from background.
|
||||
[FIX] Crash if connection breaks during download using AssetManager.
|
||||
[NEW] AngelCode binary file format support for LabelBMFont.
|
||||
[FIX] OpenAL context isn't destroyed correctly on mac and ios.
|
||||
[FIX] Useless conversion in ScrollView::onTouchBegan.
|
||||
[FIX] Two memory leak fixes in EventDispatcher::removeEventListener(s).
|
||||
[FIX] CCTMXMap doesn't support TMX files reference external TSX files
|
||||
[FIX] Logical error in `CallFuncN::clone()`
|
||||
[FIX] Child's opacity will not be changed when its parent's cascadeOpacityEnabled was set to true and opacity was changed
|
||||
[FIX] Disallow copy and assign for Scene Graph + Actions objects
|
||||
[FIX] XMLHttpRequest receives wrong binary array
|
||||
[FIX] XMLHttpRequest.status needs to be assigned even when connection fails
|
||||
[FIX] TextureCache::addImageAsync may load a image even it is loaded in GL thread
|
||||
[FIX] EventCustom shouldn't use std::hash to generate unique ID, because the result is not unique
|
||||
[FIX] CC_USE_PHYSICS is actually impossible to turn it off
|
||||
[FIX] Crash if connection breaks during download using AssetManager
|
||||
[FIX] Project_creator supports creating project at any folder and supports UI
|
||||
[Android]
|
||||
[NEW] build/android-build.sh: add supporting to generate .apk file
|
||||
[FIX] XMLHttpRequest receives wrong binary array.
|
||||
[NEW] Bindings-generator supports to bind 'unsigned long'.
|
||||
[FIX] XMLHttpRequest receives wrong binary array.
|
||||
[FIX] 'Test Frame Event' of TestJavascript/CocoStudioArmatureTest Crashes.
|
||||
[FIX] UserDefault::getDoubleForKey() doesn't pass default value to Java.
|
||||
[iOS]
|
||||
[FIX] Infinite loop in UserDefault's destructor
|
||||
[Windows]
|
||||
[NEW] CMake support for windows.
|
||||
[Bindings]
|
||||
[FIX] Don't bind override functions for JSB and LuaBining since they aren't needed at all.
|
||||
[NEW] Support CocoStudio v1.2
|
||||
[NEW] Adds spine JS binding support.
|
||||
[FIX] Don't bind override functions for JSB and LuaBining since they aren't needed at all.
|
||||
[FIX] The order of onEnter and onExit is wrong.
|
||||
[FIX] The setBlendFunc method of some classes wasn't exposed to LUA.
|
||||
[FIX] Bindings-generator doesn't support 'unsigned long'
|
||||
[FIX] Potential hash collision by using typeid(T).hash_code() in JSB and LuaBinding
|
||||
[Lua binding]
|
||||
[NEW] New label support
|
||||
[NEW] Physcis integrated support
|
||||
[NEW] EventDispatcher support
|
||||
[FIX] CallFuncND + auto remove lua test case have no effect
|
||||
[FIX] Lua gc will cause correcsponding c++ object been released
|
||||
[FIX] Some lua manual binding functions don't remove unneeded element in the lua stack
|
||||
[FIX] The setBlendFunc method of some classes wasn't exposed to LUA
|
||||
[Javascript binding]
|
||||
[FIX] `onEnter` event is triggered after children's `onEnter` event
|
||||
|
||||
cocos2d-x-3.0alpha1 Nov.19 2013
|
||||
[all platforms]
|
||||
|
|
|
@ -38,15 +38,15 @@ option(USE_CHIPMUNK "Use chipmunk for physics library" ON)
|
|||
option(USE_BOX2D "Use box2d for physics library" OFF)
|
||||
option(DEBUG_MODE "Debug or release?" ON)
|
||||
option(BUILD_LIBS_LUA "Build lua libraries" OFF)
|
||||
option(BUILD_GUI "Build GUI library" OFF)
|
||||
option(BUILD_NETWORK "Build network library" OFF)
|
||||
option(BUILD_EXTENSIONS "Build extension library" OFF)
|
||||
option(BUILD_EDITOR_SPINE "Build editor support for spine" OFF)
|
||||
option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" OFF)
|
||||
option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" OFF)
|
||||
option(BUILD_GUI "Build GUI library" ON)
|
||||
option(BUILD_NETWORK "Build network library" ON)
|
||||
option(BUILD_EXTENSIONS "Build extension library" ON)
|
||||
option(BUILD_EDITOR_SPINE "Build editor support for spine" ON)
|
||||
option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON)
|
||||
option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" ON)
|
||||
|
||||
option(BUILD_HelloCpp "Only build HelloCpp sample" ON)
|
||||
option(BUILD_TestCpp "Only build TestCpp sample" OFF)
|
||||
option(BUILD_TestCpp "Only build TestCpp sample" ON)
|
||||
option(BUILD_HelloLua "Only build HelloLua sample" OFF)
|
||||
option(BUILD_TestLua "Only build TestLua sample" OFF)
|
||||
|
||||
|
@ -284,4 +284,19 @@ add_subdirectory(cocos/scripting)
|
|||
endif(BUILD_LIBS_LUA)
|
||||
|
||||
# build samples
|
||||
add_subdirectory(samples)
|
||||
if(BUILD_HelloCpp)
|
||||
add_subdirectory(samples/Cpp/HelloCpp)
|
||||
endif(BUILD_HelloCpp)
|
||||
|
||||
if(BUILD_TestCpp)
|
||||
add_subdirectory(samples/Cpp/TestCpp)
|
||||
endif(BUILD_TestCpp)
|
||||
|
||||
if(BUILD_HelloLua)
|
||||
add_subdirectory(samples/Lua/HelloLua)
|
||||
endif(BUILD_HelloLua)
|
||||
|
||||
if(BUILD_TestLua)
|
||||
add_subdirectory(samples/Lua/TestLua)
|
||||
endif(BUILD_TestLua)
|
||||
|
||||
|
|
51
README.md
51
README.md
|
@ -24,14 +24,47 @@ How to start a new game
|
|||
|
||||
1. Download the code from [cocos2d download site][4]
|
||||
2. Enter `tools/project-creator`
|
||||
|
||||
2. Run the `create-projects.py` script
|
||||
3. Run the `create-projects.py` script
|
||||
|
||||
Example:
|
||||
|
||||
$ cd cocos2d-x/tools/project-creator
|
||||
$ ./create-multi-platform-projects.py -p mygame -k com.your_company.mygame -l cpp
|
||||
$ cd ../../projects/mygame
|
||||
$ ./project-creator.py -n mygame -k com.your_company.mygame -l cpp -p /home/mygame
|
||||
$ cd /home/mygame
|
||||
|
||||
### Build new project for android ###
|
||||
|
||||
$ cd proj.android
|
||||
$ ./build_native.py
|
||||
|
||||
### Build new project for ios & osx ###
|
||||
|
||||
* Enter *proj.ios_mac* folder, open *mygame.xcodeproj*
|
||||
* Select ios or osx targets in scheme toolbar
|
||||
|
||||
### Build new project for linux ###
|
||||
|
||||
if you never run cocos2d-x on linux, you need to install all dependences by the
|
||||
script in **cocos2d/build/install-deps-linux.sh**
|
||||
|
||||
$ cd cocos2d/build
|
||||
$ ./install-deps-linux.sh
|
||||
$ ../..
|
||||
|
||||
Then
|
||||
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake ..
|
||||
$ make -j4
|
||||
|
||||
Run
|
||||
|
||||
$ bin/mygame
|
||||
|
||||
### Build new project for win32 ###
|
||||
|
||||
* Enter *proj.win32*, open *mygame.sln* by vs2012
|
||||
|
||||
|
||||
Main features
|
||||
|
@ -101,10 +134,18 @@ $ cd cocos2d-x/build
|
|||
$ ./install-deps-linux.sh
|
||||
$ cmake ..
|
||||
$ make
|
||||
```
|
||||
|
||||
Run Samples
|
||||
|
||||
```
|
||||
$ bin/hellocpp/hellocpp
|
||||
or
|
||||
$ bin/testlua/testlua
|
||||
```
|
||||
|
||||
You may meet building errors when building libGLFW.so. It is because libGL.so directs to an error target,
|
||||
you should make it to direct to a correct one. `install-deps-linux.sh` only has to be run onece.
|
||||
you should make it to direct to a correct one. `install-deps-linux.sh` only has to be run once.
|
||||
|
||||
* For Windows
|
||||
|
||||
|
|
|
@ -65,6 +65,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBindingForLocalStorage
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBindingForGui", "..\cocos\scripting\javascript\bindings\gui\libJSBindingForGui.vcxproj", "{9A844C88-97E8-4E2D-B09A-E138C67D338B}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBindingForSpine", "..\cocos\scripting\javascript\bindings\spine\libJSBindingForSpine.vcxproj", "{E78CDC6B-F37D-48D2-AD91-1DB549497E32}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
|
@ -195,6 +197,10 @@ Global
|
|||
{9A844C88-97E8-4E2D-B09A-E138C67D338B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{9A844C88-97E8-4E2D-B09A-E138C67D338B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{9A844C88-97E8-4E2D-B09A-E138C67D338B}.Release|Win32.Build.0 = Release|Win32
|
||||
{E78CDC6B-F37D-48D2-AD91-1DB549497E32}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E78CDC6B-F37D-48D2-AD91-1DB549497E32}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E78CDC6B-F37D-48D2-AD91-1DB549497E32}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E78CDC6B-F37D-48D2-AD91-1DB549497E32}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -208,6 +214,7 @@ Global
|
|||
{21070E58-EEC6-4E16-8B4F-6D083DF55790} = {10F98A57-B9A1-47DA-9FBA-12D328E72ED1}
|
||||
{68F5F371-BD7B-4C30-AE5B-0B08F22E0CDE} = {10F98A57-B9A1-47DA-9FBA-12D328E72ED1}
|
||||
{9A844C88-97E8-4E2D-B09A-E138C67D338B} = {10F98A57-B9A1-47DA-9FBA-12D328E72ED1}
|
||||
{E78CDC6B-F37D-48D2-AD91-1DB549497E32} = {10F98A57-B9A1-47DA-9FBA-12D328E72ED1}
|
||||
EndGlobalSection
|
||||
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
|
||||
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
|
||||
|
|
|
@ -1 +1 @@
|
|||
812ab716d10a52b752f0d15b2393b2b0a7c8e969
|
||||
3d6ada05d55194dd8e4c10ed8316add7c0d8705c
|
|
@ -1 +1 @@
|
|||
b83c3a0fd60d6b1b1a032495615afd77fccd5050
|
||||
2efefc01ff97bda1498d1d4a850ea1881f751f7c
|
|
@ -205,7 +205,6 @@ LOCAL_EXPORT_LDLIBS := -lGLESv2 \
|
|||
LOCAL_WHOLE_STATIC_LIBRARIES := cocos_freetype2_static
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dxandroid_static
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += spine_static
|
||||
|
||||
# define the macro to compile through support/zip_support/ioapi.c
|
||||
LOCAL_CFLAGS := -Wno-psabi -DUSE_FILE32API
|
||||
|
@ -218,4 +217,3 @@ include $(BUILD_STATIC_LIBRARY)
|
|||
$(call import-module,freetype2/prebuilt/android)
|
||||
$(call import-module,chipmunk)
|
||||
$(call import-module,2d/platform/android)
|
||||
$(call import-module,editor-support/spine)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2013 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
@ -32,6 +33,12 @@ NS_CC_BEGIN
|
|||
//
|
||||
// CameraAction
|
||||
//
|
||||
ActionCamera::ActionCamera()
|
||||
{
|
||||
kmVec3Fill(&_center, 0, 0, 0);
|
||||
kmVec3Fill(&_eye, 0, 0, FLT_EPSILON);
|
||||
kmVec3Fill(&_up, 0, 1, 0);
|
||||
}
|
||||
void ActionCamera::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(target);
|
||||
|
@ -53,53 +60,39 @@ ActionCamera * ActionCamera::reverse() const
|
|||
|
||||
void ActionCamera::restore()
|
||||
{
|
||||
_eyeX = _eyeY = 0.0f;
|
||||
_eyeZ = FLT_EPSILON;
|
||||
kmVec3Fill(&_center, 0, 0, 0);
|
||||
kmVec3Fill(&_eye, 0, 0, FLT_EPSILON);
|
||||
kmVec3Fill(&_up, 0, 1, 0);
|
||||
}
|
||||
|
||||
_centerX = _centerY = _centerZ = 0.0f;
|
||||
|
||||
_upX = 0.0f;
|
||||
_upY = 1.0f;
|
||||
_upZ = 0.0f;
|
||||
void ActionCamera::setEye(const kmVec3& eye)
|
||||
{
|
||||
_eye = eye;
|
||||
updateTransform();
|
||||
}
|
||||
|
||||
void ActionCamera::setEye(float x, float y, float z)
|
||||
{
|
||||
_eyeX = x;
|
||||
_eyeY = y;
|
||||
_eyeZ = z;
|
||||
|
||||
kmVec3Fill(&_eye, x, y, z);
|
||||
updateTransform();
|
||||
}
|
||||
|
||||
void ActionCamera::setCenter(float centerX, float centerY, float centerZ)
|
||||
void ActionCamera::setCenter(const kmVec3& center)
|
||||
{
|
||||
_centerX = centerX;
|
||||
_centerY = centerY;
|
||||
_centerZ = centerZ;
|
||||
|
||||
_center = center;
|
||||
updateTransform();
|
||||
}
|
||||
|
||||
void ActionCamera::setUp(float upX, float upY, float upZ)
|
||||
void ActionCamera::setUp(const kmVec3& up)
|
||||
{
|
||||
_upX = upX;
|
||||
_upY = upY;
|
||||
_upZ = upZ;
|
||||
|
||||
_up = up;
|
||||
updateTransform();
|
||||
}
|
||||
|
||||
void ActionCamera::updateTransform()
|
||||
{
|
||||
kmVec3 eye, center, up;
|
||||
|
||||
kmVec3Fill(&eye, _eyeX, _eyeY , _eyeZ);
|
||||
kmVec3Fill(¢er, _centerX, _centerY, _centerZ);
|
||||
kmVec3Fill(&up, _upX, _upY, _upZ);
|
||||
|
||||
kmMat4 lookupMatrix;
|
||||
kmMat4LookAt(&lookupMatrix, &eye, ¢er, &up);
|
||||
kmMat4LookAt(&lookupMatrix, &_eye, &_center, &_up);
|
||||
|
||||
Point anchorPoint = _target->getAnchorPointInPoints();
|
||||
|
||||
|
@ -198,9 +191,9 @@ void OrbitCamera::update(float dt)
|
|||
float za = _radZ + _radDeltaZ * dt;
|
||||
float xa = _radX + _radDeltaX * dt;
|
||||
|
||||
float i = sinf(za) * cosf(xa) * r + _centerX;
|
||||
float j = sinf(za) * sinf(xa) * r + _centerY;
|
||||
float k = cosf(za) * r + _centerZ;
|
||||
float i = sinf(za) * cosf(xa) * r + _center.x;
|
||||
float j = sinf(za) * sinf(xa) * r + _center.y;
|
||||
float k = cosf(za) * r + _center.z;
|
||||
|
||||
setEye(i,j,k);
|
||||
}
|
||||
|
@ -210,9 +203,9 @@ void OrbitCamera::sphericalRadius(float *newRadius, float *zenith, float *azimut
|
|||
float r; // radius
|
||||
float s;
|
||||
|
||||
float x = _eyeX - _centerX;
|
||||
float y = _eyeY - _centerY;
|
||||
float z = _eyeZ - _centerZ;
|
||||
float x = _eye.x - _center.x;
|
||||
float y = _eye.y - _center.y;
|
||||
float z = _eye.z - _center.z;
|
||||
|
||||
r = sqrtf( powf(x,2) + powf(y,2) + powf(z,2));
|
||||
s = sqrtf( powf(x,2) + powf(y,2));
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
@ -48,17 +50,7 @@ public:
|
|||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ActionCamera()
|
||||
:_centerX(0)
|
||||
,_centerY(0)
|
||||
,_centerZ(0)
|
||||
,_eyeX(0)
|
||||
,_eyeY(0)
|
||||
,_eyeZ(FLT_EPSILON)
|
||||
,_upX(0)
|
||||
,_upY(1)
|
||||
,_upZ(0)
|
||||
{}
|
||||
ActionCamera();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
|
@ -70,23 +62,28 @@ public:
|
|||
virtual ActionCamera * reverse() const override;
|
||||
virtual ActionCamera *clone() const override;
|
||||
|
||||
/* sets the Eye value of the Camera */
|
||||
void setEye(const kmVec3 &eye);
|
||||
void setEye(float x, float y, float z);
|
||||
/* returns the Eye value of the Camera */
|
||||
const kmVec3& getEye() const { return _eye; }
|
||||
/* sets the Center value of the Camera */
|
||||
void setCenter(const kmVec3 ¢er);
|
||||
/* returns the Center value of the Camera */
|
||||
const kmVec3& getCenter() const { return _center; }
|
||||
/* sets the Up value of the Camera */
|
||||
void setUp(const kmVec3 &up);
|
||||
/* Returns the Up value of the Camera */
|
||||
const kmVec3& getUp() const { return _up; }
|
||||
|
||||
protected:
|
||||
|
||||
void restore();
|
||||
void setEye(float x, float y, float z);
|
||||
void setCenter(float x, float y, float z);
|
||||
void setUp(float x, float y, float z);
|
||||
void updateTransform();
|
||||
|
||||
float _centerX;
|
||||
float _centerY;
|
||||
float _centerZ;
|
||||
float _eyeX;
|
||||
float _eyeY;
|
||||
float _eyeZ;
|
||||
float _upX;
|
||||
float _upY;
|
||||
float _upZ;
|
||||
kmVec3 _center;
|
||||
kmVec3 _eye;
|
||||
kmVec3 _up;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2012 cocos2d-x.org
|
||||
* cocos2d for iPhone: http://www.cocos2d-iphone.org
|
||||
*
|
||||
* Copyright (c) 2008 Radu Gruian
|
||||
*
|
||||
* Copyright (c) 2011 Vit Valentin
|
||||
*
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -134,7 +131,7 @@ void PointArray::insertControlPoint(Point &controlPoint, ssize_t index)
|
|||
|
||||
Point PointArray::getControlPointAtIndex(ssize_t index)
|
||||
{
|
||||
index = static_cast<int>(MIN(_controlPoints->size()-1, MAX(index, 0)));
|
||||
index = MIN(_controlPoints->size()-1, MAX(index, 0));
|
||||
return *(_controlPoints->at(index));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
/*
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* cocos2d for iPhone: http://www.cocos2d-iphone.org
|
||||
*
|
||||
* Copyright (c) 2008 Radu Gruian
|
||||
*
|
||||
* Copyright (c) 2011 Vit Valentin
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2009 Jason Booth
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
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
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2009 Jason Booth
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2009 On-Core
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2009 On-Core
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2009 On-Core
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2009 On-Core
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2011 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2009 Valentin Milea
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
CopyRight (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2009 Valentin Milea
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
CopyRight (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2009 Sindesso Pty Ltd http://www.sindesso.com/
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
CopyRight (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2009 Sindesso Pty Ltd http://www.sindesso.com/
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
CopyRight (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (C) 2010 Lam Pham
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
CopyRight (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (C) 2010 Lam Pham
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
CopyRight (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010£2011 cocos2d-x.org
|
||||
Copyright (c) 2009 On-Core
|
||||
Copyright (c) 2009 On-Core
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
CopyRight (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2009 On-Core
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
CopyRight (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2009 lhunath (Maarten Billemont)
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright 2009 lhunath (Maarten Billemont)
|
||||
CopyRight (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2009 lhunath (Maarten Billemont)
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright 2009 lhunath (Maarten Billemont)
|
||||
CopyRight (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
CopyRight (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
CopyRight (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2010 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
CopyRight (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
@ -187,7 +188,7 @@ void AnimationCache::parseVersion2(const ValueMap& animations)
|
|||
}
|
||||
}
|
||||
|
||||
void AnimationCache::addAnimationsWithDictionary(const ValueMap& dictionary)
|
||||
void AnimationCache::addAnimationsWithDictionary(const ValueMap& dictionary,const std::string& plist)
|
||||
{
|
||||
if ( dictionary.find("animations") == dictionary.end() )
|
||||
{
|
||||
|
@ -205,7 +206,8 @@ void AnimationCache::addAnimationsWithDictionary(const ValueMap& dictionary)
|
|||
const ValueVector& spritesheets = properties.at("spritesheets").asValueVector();
|
||||
|
||||
for(const auto &value : spritesheets) {
|
||||
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(value.asString());
|
||||
std::string path = FileUtils::getInstance()->fullPathFromRelativeFile(value.asString(),plist);
|
||||
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -231,7 +233,7 @@ void AnimationCache::addAnimationsWithFile(const std::string& plist)
|
|||
|
||||
CCASSERT( !dict.empty(), "CCAnimationCache: File could not be found");
|
||||
|
||||
addAnimationsWithDictionary(dict);
|
||||
addAnimationsWithDictionary(dict,plist);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2010 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
CopyRight (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
@ -102,9 +103,10 @@ public:
|
|||
|
||||
/** Adds an animation from an NSDictionary
|
||||
Make sure that the frames were previously loaded in the SpriteFrameCache.
|
||||
@param plist The path of the relative file,it use to find the plist path for load SpriteFrames.
|
||||
@since v1.1
|
||||
*/
|
||||
void addAnimationsWithDictionary(const ValueMap& dictionary);
|
||||
void addAnimationsWithDictionary(const ValueMap& dictionary,const std::string& plist);
|
||||
|
||||
/** Adds an animation from a plist file.
|
||||
Make sure that the frames were previously loaded in the SpriteFrameCache.
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
CopyRight (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
CopyRight (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*
|
||||
* cocos2d for iPhone: http://www.cocos2d-iphone.org
|
||||
* cocos2d-x: http://www.cocos2d-x.org
|
||||
* Copyright (c) 2012 Pierre-David Bélanger
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
*
|
||||
* Copyright (c) 2012 Pierre-David Bélanger
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* cocos2d-x: 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
|
||||
|
@ -217,7 +217,24 @@ void ClippingNode::visit()
|
|||
_beforeVisitCmd.init(0,_vertexZ);
|
||||
_beforeVisitCmd.func = CC_CALLBACK_0(ClippingNode::onBeforeVisit, this);
|
||||
renderer->addCommand(&_beforeVisitCmd);
|
||||
if (_alphaThreshold < 1)
|
||||
{
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WINDOWS || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
|
||||
#else
|
||||
// since glAlphaTest do not exists in OES, use a shader that writes
|
||||
// pixel only if greater than an alpha threshold
|
||||
GLProgram *program = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST);
|
||||
GLint alphaValueLocation = glGetUniformLocation(program->getProgram(), GLProgram::UNIFORM_NAME_ALPHA_TEST_VALUE);
|
||||
// set our alphaThreshold
|
||||
program->use();
|
||||
program->setUniformLocationWith1f(alphaValueLocation, _alphaThreshold);
|
||||
// we need to recursively apply this shader to all the nodes in the stencil node
|
||||
// XXX: we should have a way to apply shader to all nodes without having to do this
|
||||
setProgram(_stencil, program);
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
_stencil->visit();
|
||||
|
||||
_afterDrawStencilCmd.init(0,_vertexZ);
|
||||
|
@ -380,16 +397,6 @@ void ClippingNode::onBeforeVisit()
|
|||
// pixel will be drawn only if greater than an alpha threshold
|
||||
glAlphaFunc(GL_GREATER, _alphaThreshold);
|
||||
#else
|
||||
// since glAlphaTest do not exists in OES, use a shader that writes
|
||||
// pixel only if greater than an alpha threshold
|
||||
GLProgram *program = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST);
|
||||
GLint alphaValueLocation = glGetUniformLocation(program->getProgram(), GLProgram::UNIFORM_NAME_ALPHA_TEST_VALUE);
|
||||
// set our alphaThreshold
|
||||
program->use();
|
||||
program->setUniformLocationWith1f(alphaValueLocation, _alphaThreshold);
|
||||
// we need to recursively apply this shader to all the nodes in the stencil node
|
||||
// XXX: we should have a way to apply shader to all nodes without having to do this
|
||||
setProgram(_stencil, program);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*
|
||||
* cocos2d for iPhone: http://www.cocos2d-iphone.org
|
||||
* cocos2d-x: http://www.cocos2d-x.org
|
||||
* Copyright (c) 2012 Pierre-David Bélanger
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
*
|
||||
* Copyright (c) 2012 Pierre-David Bélanger
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
@ -54,8 +54,9 @@ void Component::update(float delta)
|
|||
{
|
||||
}
|
||||
|
||||
void Component::serialize(void *ar)
|
||||
bool Component::serialize(void *ar)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Component* Component::create(void)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
@ -55,7 +55,7 @@ public:
|
|||
*/
|
||||
virtual void onExit();
|
||||
virtual void update(float delta);
|
||||
virtual void serialize(void* r);
|
||||
virtual bool serialize(void* r);
|
||||
virtual bool isEnabled() const;
|
||||
virtual void setEnabled(bool b);
|
||||
static Component* create(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
@ -545,7 +546,8 @@ CC_DEPRECATED_ATTRIBUTE typedef IMEDelegate CCIMEDelegate;
|
|||
CC_DEPRECATED_ATTRIBUTE typedef IMEKeyboardNotificationInfo CCIMEKeyboardNotificationInfo;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef TextFieldDelegate CCTextFieldDelegate;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef TextFieldTTF CCTextFieldTTF;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef NotificationCenter CCNotificationCenter;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef __NotificationCenter CCNotificationCenter;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef __NotificationCenter NotificationCenter;
|
||||
//CC_DEPRECATED_ATTRIBUTE typedef TargetedTouchDelegate CCTargetedTouchDelegate;
|
||||
//CC_DEPRECATED_ATTRIBUTE typedef StandardTouchDelegate CCStandardTouchDelegate;
|
||||
//CC_DEPRECATED_ATTRIBUTE typedef TouchDelegate CCTouchDelegate;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2013 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2013 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
@ -37,7 +38,6 @@ THE SOFTWARE.
|
|||
#include "CCArray.h"
|
||||
#include "CCScheduler.h"
|
||||
#include "ccMacros.h"
|
||||
#include "CCNotificationCenter.h"
|
||||
#include "CCTransition.h"
|
||||
#include "CCTextureCache.h"
|
||||
#include "CCSpriteFrameCache.h"
|
||||
|
@ -61,6 +61,7 @@ THE SOFTWARE.
|
|||
#include "CCEventCustom.h"
|
||||
#include "CCFontFreeType.h"
|
||||
#include "CCRenderer.h"
|
||||
#include "CCConsole.h"
|
||||
#include "renderer/CCFrustum.h"
|
||||
/**
|
||||
Position of the FPS
|
||||
|
@ -116,9 +117,6 @@ bool Director::init(void)
|
|||
|
||||
_scenesStack.reserve(15);
|
||||
|
||||
// projection delegate if "Custom" projection is used
|
||||
_projectionDelegate = nullptr;
|
||||
|
||||
// FPS
|
||||
_accumDt = 0.0f;
|
||||
_frameRate = 0.0f;
|
||||
|
@ -133,7 +131,7 @@ bool Director::init(void)
|
|||
_paused = false;
|
||||
|
||||
// purge ?
|
||||
_purgeDirecotorInNextLoop = false;
|
||||
_purgeDirectorInNextLoop = false;
|
||||
|
||||
_winSizeInPoints = Size::ZERO;
|
||||
|
||||
|
@ -163,8 +161,8 @@ bool Director::init(void)
|
|||
//init TextureCache
|
||||
initTextureCache();
|
||||
|
||||
// Renderer
|
||||
_renderer = new Renderer;
|
||||
_console = new Console;
|
||||
|
||||
// create autorelease pool
|
||||
PoolManager::sharedPoolManager()->push();
|
||||
|
@ -192,6 +190,7 @@ Director::~Director(void)
|
|||
delete _eventProjectionChanged;
|
||||
|
||||
delete _renderer;
|
||||
delete _console;
|
||||
|
||||
// pop the autorelease pool
|
||||
PoolManager::sharedPoolManager()->pop();
|
||||
|
@ -483,9 +482,8 @@ void Director::setProjection(Projection projection)
|
|||
}
|
||||
|
||||
case Projection::CUSTOM:
|
||||
if (_projectionDelegate)
|
||||
_projectionDelegate->updateProjection();
|
||||
|
||||
// Projection Delegate is no longer needed
|
||||
// since the event "PROJECTION CHANGED" is emitted
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -719,7 +717,7 @@ void Director::popToSceneStackLevel(int level)
|
|||
|
||||
void Director::end()
|
||||
{
|
||||
_purgeDirecotorInNextLoop = true;
|
||||
_purgeDirectorInNextLoop = true;
|
||||
}
|
||||
|
||||
void Director::purgeDirector()
|
||||
|
@ -768,7 +766,6 @@ void Director::purgeDirector()
|
|||
|
||||
// cocos2d-x specific data structures
|
||||
UserDefault::destroyInstance();
|
||||
NotificationCenter::destroyInstance();
|
||||
|
||||
GL::invalidateStateCache();
|
||||
|
||||
|
@ -949,17 +946,20 @@ void Director::createStatsLabel()
|
|||
*/
|
||||
float factor = EGLView::getInstance()->getDesignResolutionSize().height / 320.0f;
|
||||
|
||||
_FPSLabel = new LabelAtlas;
|
||||
_FPSLabel = LabelAtlas::create();
|
||||
_FPSLabel->retain();
|
||||
_FPSLabel->setIgnoreContentScaleFactor(true);
|
||||
_FPSLabel->initWithString("00.0", texture, 12, 32 , '.');
|
||||
_FPSLabel->setScale(factor);
|
||||
|
||||
_SPFLabel = new LabelAtlas;
|
||||
_SPFLabel = LabelAtlas::create();
|
||||
_SPFLabel->retain();
|
||||
_SPFLabel->setIgnoreContentScaleFactor(true);
|
||||
_SPFLabel->initWithString("0.000", texture, 12, 32, '.');
|
||||
_SPFLabel->setScale(factor);
|
||||
|
||||
_drawsLabel = new LabelAtlas;
|
||||
_drawsLabel = LabelAtlas::create();
|
||||
_drawsLabel->retain();
|
||||
_drawsLabel->setIgnoreContentScaleFactor(true);
|
||||
_drawsLabel->initWithString("000", texture, 12, 32, '.');
|
||||
_drawsLabel->setScale(factor);
|
||||
|
@ -971,11 +971,6 @@ void Director::createStatsLabel()
|
|||
_FPSLabel->setPosition(CC_DIRECTOR_STATS_POSITION);
|
||||
}
|
||||
|
||||
float Director::getContentScaleFactor() const
|
||||
{
|
||||
return _contentScaleFactor;
|
||||
}
|
||||
|
||||
void Director::setContentScaleFactor(float scaleFactor)
|
||||
{
|
||||
if (scaleFactor != _contentScaleFactor)
|
||||
|
@ -985,11 +980,6 @@ void Director::setContentScaleFactor(float scaleFactor)
|
|||
}
|
||||
}
|
||||
|
||||
Node* Director::getNotificationNode()
|
||||
{
|
||||
return _notificationNode;
|
||||
}
|
||||
|
||||
void Director::setNotificationNode(Node *node)
|
||||
{
|
||||
CC_SAFE_RELEASE(_notificationNode);
|
||||
|
@ -997,16 +987,6 @@ void Director::setNotificationNode(Node *node)
|
|||
CC_SAFE_RETAIN(_notificationNode);
|
||||
}
|
||||
|
||||
DirectorDelegate* Director::getDelegate() const
|
||||
{
|
||||
return _projectionDelegate;
|
||||
}
|
||||
|
||||
void Director::setDelegate(DirectorDelegate* delegate)
|
||||
{
|
||||
_projectionDelegate = delegate;
|
||||
}
|
||||
|
||||
void Director::setScheduler(Scheduler* scheduler)
|
||||
{
|
||||
if (_scheduler != scheduler)
|
||||
|
@ -1017,11 +997,6 @@ void Director::setScheduler(Scheduler* scheduler)
|
|||
}
|
||||
}
|
||||
|
||||
Scheduler* Director::getScheduler() const
|
||||
{
|
||||
return _scheduler;
|
||||
}
|
||||
|
||||
void Director::setActionManager(ActionManager* actionManager)
|
||||
{
|
||||
if (_actionManager != actionManager)
|
||||
|
@ -1032,16 +1007,6 @@ void Director::setActionManager(ActionManager* actionManager)
|
|||
}
|
||||
}
|
||||
|
||||
ActionManager* Director::getActionManager() const
|
||||
{
|
||||
return _actionManager;
|
||||
}
|
||||
|
||||
EventDispatcher* Director::getEventDispatcher() const
|
||||
{
|
||||
return _eventDispatcher;
|
||||
}
|
||||
|
||||
void Director::setEventDispatcher(EventDispatcher* dispatcher)
|
||||
{
|
||||
if (_eventDispatcher != dispatcher)
|
||||
|
@ -1052,12 +1017,6 @@ void Director::setEventDispatcher(EventDispatcher* dispatcher)
|
|||
}
|
||||
}
|
||||
|
||||
Renderer* Director::getRenderer() const
|
||||
{
|
||||
return _renderer;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************
|
||||
* implementation of DisplayLinkDirector
|
||||
**************************************************/
|
||||
|
@ -1079,9 +1038,9 @@ void DisplayLinkDirector::startAnimation()
|
|||
|
||||
void DisplayLinkDirector::mainLoop()
|
||||
{
|
||||
if (_purgeDirecotorInNextLoop)
|
||||
if (_purgeDirectorInNextLoop)
|
||||
{
|
||||
_purgeDirecotorInNextLoop = false;
|
||||
_purgeDirectorInNextLoop = false;
|
||||
purgeDirector();
|
||||
}
|
||||
else if (! _invalid)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2013 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
@ -59,6 +60,7 @@ class EventListenerCustom;
|
|||
class TextureCache;
|
||||
class Frustum;
|
||||
class Renderer;
|
||||
class Console;
|
||||
|
||||
/**
|
||||
@brief Class that creates and handles the main Window and manages how
|
||||
|
@ -185,21 +187,9 @@ public:
|
|||
Useful to hook a notification object, like Notifications (http://github.com/manucorporat/CCNotifications)
|
||||
@since v0.99.5
|
||||
*/
|
||||
Node* getNotificationNode();
|
||||
Node* getNotificationNode() const { return _notificationNode; }
|
||||
void setNotificationNode(Node *node);
|
||||
|
||||
/** Director delegate. It shall implement the DirectorDelegate protocol
|
||||
@since v0.99.5
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
DirectorDelegate* getDelegate() const;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
void setDelegate(DirectorDelegate* delegate);
|
||||
|
||||
// window size
|
||||
|
||||
/** returns the size of the OpenGL view in points.
|
||||
|
@ -339,7 +329,7 @@ public:
|
|||
@since v0.99.4
|
||||
*/
|
||||
void setContentScaleFactor(float scaleFactor);
|
||||
float getContentScaleFactor() const;
|
||||
float getContentScaleFactor() const { return _contentScaleFactor; }
|
||||
|
||||
/**
|
||||
Get the Culling Frustum
|
||||
|
@ -350,7 +340,7 @@ public:
|
|||
/** Gets the Scheduler associated with this director
|
||||
@since v2.0
|
||||
*/
|
||||
Scheduler* getScheduler() const;
|
||||
Scheduler* getScheduler() const { return _scheduler; }
|
||||
|
||||
/** Sets the Scheduler associated with this director
|
||||
@since v2.0
|
||||
|
@ -360,7 +350,7 @@ public:
|
|||
/** Gets the ActionManager associated with this director
|
||||
@since v2.0
|
||||
*/
|
||||
ActionManager* getActionManager() const;
|
||||
ActionManager* getActionManager() const { return _actionManager; }
|
||||
|
||||
/** Sets the ActionManager associated with this director
|
||||
@since v2.0
|
||||
|
@ -370,7 +360,7 @@ public:
|
|||
/** Gets the EventDispatcher associated with this director
|
||||
@since v3.0
|
||||
*/
|
||||
EventDispatcher* getEventDispatcher() const;
|
||||
EventDispatcher* getEventDispatcher() const { return _eventDispatcher; }
|
||||
|
||||
/** Sets the EventDispatcher associated with this director
|
||||
@since v3.0
|
||||
|
@ -380,7 +370,12 @@ public:
|
|||
/** Returns the Renderer
|
||||
@since v3.0
|
||||
*/
|
||||
Renderer* getRenderer() const;
|
||||
Renderer* getRenderer() const { return _renderer; }
|
||||
|
||||
/** Returns the Console
|
||||
@since v3.0
|
||||
*/
|
||||
Console* getConsole() const { return _console; }
|
||||
|
||||
/* Gets delta time since last tick to main loop */
|
||||
float getDeltaTime() const;
|
||||
|
@ -392,7 +387,7 @@ public:
|
|||
|
||||
protected:
|
||||
void purgeDirector();
|
||||
bool _purgeDirecotorInNextLoop; // this flag will be set to true in end()
|
||||
bool _purgeDirectorInNextLoop; // this flag will be set to true in end()
|
||||
|
||||
void setNextScene();
|
||||
|
||||
|
@ -491,11 +486,12 @@ protected:
|
|||
/* This object will be visited after the scene. Useful to hook a notification node */
|
||||
Node *_notificationNode;
|
||||
|
||||
/* Projection protocol delegate */
|
||||
DirectorDelegate *_projectionDelegate;
|
||||
|
||||
/* Renderer for the Director */
|
||||
Renderer *_renderer;
|
||||
|
||||
/* Console for the director */
|
||||
Console *_console;
|
||||
|
||||
// EGLViewProtocol will recreate stats labels to fit visible rect
|
||||
friend class EGLViewProtocol;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Copyright (c) 2012 Scott Lembcke and Howling Moon Software
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -23,12 +24,13 @@
|
|||
#include "CCDrawNode.h"
|
||||
#include "CCShaderCache.h"
|
||||
#include "CCGL.h"
|
||||
#include "CCNotificationCenter.h"
|
||||
#include "CCEventType.h"
|
||||
#include "CCConfiguration.h"
|
||||
#include "CCCustomCommand.h"
|
||||
#include "CCDirector.h"
|
||||
#include "CCRenderer.h"
|
||||
#include "CCEventListenerCustom.h"
|
||||
#include "CCEventDispatcher.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -124,10 +126,6 @@ DrawNode::~DrawNode()
|
|||
GL::bindVAO(0);
|
||||
_vao = 0;
|
||||
}
|
||||
|
||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||
NotificationCenter::getInstance()->removeObserver(this, EVNET_COME_TO_FOREGROUND);
|
||||
#endif
|
||||
}
|
||||
|
||||
DrawNode* DrawNode::create()
|
||||
|
@ -196,10 +194,12 @@ bool DrawNode::init()
|
|||
|
||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||
// Need to listen the event only when not use batchnode, because it will use VBO
|
||||
NotificationCenter::getInstance()->addObserver(this,
|
||||
callfuncO_selector(DrawNode::listenBackToForeground),
|
||||
EVNET_COME_TO_FOREGROUND,
|
||||
nullptr);
|
||||
auto listener = EventListenerCustom::create(EVENT_COME_TO_FOREGROUND, [this](EventCustom* event){
|
||||
/** listen the event that coming to foreground on Android */
|
||||
this->init();
|
||||
});
|
||||
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
@ -456,6 +456,86 @@ void DrawNode::drawPolygon(Point *verts, int count, const Color4F &fillColor, fl
|
|||
free(extrude);
|
||||
}
|
||||
|
||||
void DrawNode::drawTriangle(const Point &p1, const Point &p2, const Point &p3, const Color4F &color)
|
||||
{
|
||||
unsigned int vertex_count = 2*3;
|
||||
ensureCapacity(vertex_count);
|
||||
|
||||
Color4B col = Color4B(color);
|
||||
V2F_C4B_T2F a = {Vertex2F(p1.x, p1.y), col, Tex2F(0.0, 0.0) };
|
||||
V2F_C4B_T2F b = {Vertex2F(p2.x, p2.y), col, Tex2F(0.0, 0.0) };
|
||||
V2F_C4B_T2F c = {Vertex2F(p3.x, p3.y), col, Tex2F(0.0, 0.0) };
|
||||
|
||||
V2F_C4B_T2F_Triangle *triangles = (V2F_C4B_T2F_Triangle *)(_buffer + _bufferCount);
|
||||
V2F_C4B_T2F_Triangle triangle = {a, b, c};
|
||||
triangles[0] = triangle;
|
||||
|
||||
_bufferCount += vertex_count;
|
||||
_dirty = true;
|
||||
}
|
||||
|
||||
void DrawNode::drawCubicBezier(const Point& from, const Point& control1, const Point& control2, const Point& to, unsigned int segments, const Color4F &color)
|
||||
{
|
||||
unsigned int vertex_count = (segments + 1) * 3;
|
||||
ensureCapacity(vertex_count);
|
||||
|
||||
Tex2F texCoord = Tex2F(0.0, 0.0);
|
||||
Color4B col = Color4B(color);
|
||||
Vertex2F vertex;
|
||||
Vertex2F firstVertex = Vertex2F(from.x, from.y);
|
||||
Vertex2F lastVertex = Vertex2F(to.x, to.y);
|
||||
|
||||
float t = 0;
|
||||
for(unsigned int i = segments + 1; i > 0; i--)
|
||||
{
|
||||
float x = powf(1 - t, 3) * from.x + 3.0f * powf(1 - t, 2) * t * control1.x + 3.0f * (1 - t) * t * t * control2.x + t * t * t * to.x;
|
||||
float y = powf(1 - t, 3) * from.y + 3.0f * powf(1 - t, 2) * t * control1.y + 3.0f * (1 - t) * t * t * control2.y + t * t * t * to.y;
|
||||
vertex = Vertex2F(x, y);
|
||||
|
||||
V2F_C4B_T2F a = {firstVertex, col, texCoord };
|
||||
V2F_C4B_T2F b = {lastVertex, col, texCoord };
|
||||
V2F_C4B_T2F c = {vertex, col, texCoord };
|
||||
V2F_C4B_T2F_Triangle triangle = {a, b, c};
|
||||
((V2F_C4B_T2F_Triangle *)(_buffer + _bufferCount))[0] = triangle;
|
||||
|
||||
lastVertex = vertex;
|
||||
t += 1.0f / segments;
|
||||
_bufferCount += 3;
|
||||
}
|
||||
_dirty = true;
|
||||
}
|
||||
|
||||
void DrawNode::drawQuadraticBezier(const Point& from, const Point& control, const Point& to, unsigned int segments, const Color4F &color)
|
||||
{
|
||||
unsigned int vertex_count = (segments + 1) * 3;
|
||||
ensureCapacity(vertex_count);
|
||||
|
||||
Tex2F texCoord = Tex2F(0.0, 0.0);
|
||||
Color4B col = Color4B(color);
|
||||
Vertex2F vertex;
|
||||
Vertex2F firstVertex = Vertex2F(from.x, from.y);
|
||||
Vertex2F lastVertex = Vertex2F(to.x, to.y);
|
||||
|
||||
float t = 0;
|
||||
for(unsigned int i = segments + 1; i > 0; i--)
|
||||
{
|
||||
float x = powf(1 - t, 2) * from.x + 2.0f * (1 - t) * t * control.x + t * t * to.x;
|
||||
float y = powf(1 - t, 2) * from.y + 2.0f * (1 - t) * t * control.y + t * t * to.y;
|
||||
vertex = Vertex2F(x, y);
|
||||
|
||||
V2F_C4B_T2F a = {firstVertex, col, texCoord };
|
||||
V2F_C4B_T2F b = {lastVertex, col, texCoord };
|
||||
V2F_C4B_T2F c = {vertex, col, texCoord };
|
||||
V2F_C4B_T2F_Triangle triangle = {a, b, c};
|
||||
((V2F_C4B_T2F_Triangle *)(_buffer + _bufferCount))[0] = triangle;
|
||||
|
||||
lastVertex = vertex;
|
||||
t += 1.0f / segments;
|
||||
_bufferCount += 3;
|
||||
}
|
||||
_dirty = true;
|
||||
}
|
||||
|
||||
void DrawNode::clear()
|
||||
{
|
||||
_bufferCount = 0;
|
||||
|
@ -472,11 +552,4 @@ void DrawNode::setBlendFunc(const BlendFunc &blendFunc)
|
|||
_blendFunc = blendFunc;
|
||||
}
|
||||
|
||||
/** listen the event that coming to foreground on Android
|
||||
*/
|
||||
void DrawNode::listenBackToForeground(Object *obj)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Copyright (c) 2012 Scott Lembcke and Howling Moon Software
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -63,6 +64,15 @@ public:
|
|||
*/
|
||||
void drawPolygon(Point *verts, int count, const Color4F &fillColor, float borderWidth, const Color4F &borderColor);
|
||||
|
||||
/** draw a triangle with color */
|
||||
void drawTriangle(const Point &p1, const Point &p2, const Point &p3, const Color4F &color);
|
||||
|
||||
/** draw a cubic bezier curve with color and number of segments */
|
||||
void drawCubicBezier(const Point& from, const Point& control1, const Point& control2, const Point& to, unsigned int segments, const Color4F &color);
|
||||
|
||||
/** draw a quadratic bezier curve with color and number of segments */
|
||||
void drawQuadraticBezier(const Point& from, const Point& control, const Point& to, unsigned int segments, const Color4F &color);
|
||||
|
||||
/** Clear the geometry in the node's buffer. */
|
||||
void clear();
|
||||
/**
|
||||
|
@ -79,12 +89,6 @@ public:
|
|||
*/
|
||||
void setBlendFunc(const BlendFunc &blendFunc);
|
||||
|
||||
/** listen the event that coming to foreground on Android
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
void listenBackToForeground(Object *obj);
|
||||
|
||||
void onDraw();
|
||||
|
||||
// Overrides
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2013 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2013 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
@ -279,11 +279,10 @@ void EventDispatcher::associateNodeAndEventListener(Node* node, EventListener* l
|
|||
else
|
||||
{
|
||||
listeners = new std::vector<EventListener*>();
|
||||
_nodeListenersMap.insert(std::make_pair(node, listeners));
|
||||
}
|
||||
|
||||
listeners->push_back(listener);
|
||||
|
||||
_nodeListenersMap.insert(std::make_pair(node, listeners));
|
||||
}
|
||||
|
||||
void EventDispatcher::dissociateNodeAndEventListener(Node* node, EventListener* listener)
|
||||
|
@ -311,29 +310,7 @@ void EventDispatcher::addEventListener(EventListener* listener)
|
|||
{
|
||||
if (_inDispatch == 0)
|
||||
{
|
||||
EventListenerVector* listenerList = nullptr;
|
||||
|
||||
auto iter = _listeners.find(listener->getListenerID());
|
||||
if (iter == _listeners.end())
|
||||
{
|
||||
listenerList = new EventListenerVector();
|
||||
_listeners.insert(std::make_pair(listener->getListenerID(), listenerList));
|
||||
}
|
||||
else
|
||||
{
|
||||
listenerList = iter->second;
|
||||
}
|
||||
|
||||
listenerList->push_back(listener);
|
||||
|
||||
if (listener->getFixedPriority() == 0)
|
||||
{
|
||||
setDirty(listener->getListenerID(), DirtyFlag::SCENE_GRAPH_PRIORITY);
|
||||
}
|
||||
else
|
||||
{
|
||||
setDirty(listener->getListenerID(), DirtyFlag::FIXED_PRITORY);
|
||||
}
|
||||
forceAddEventListener(listener);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -343,6 +320,44 @@ void EventDispatcher::addEventListener(EventListener* listener)
|
|||
listener->retain();
|
||||
}
|
||||
|
||||
void EventDispatcher::forceAddEventListener(EventListener* listener)
|
||||
{
|
||||
EventListenerVector* listeners = nullptr;
|
||||
EventListener::ListenerID listenerID = listener->getListenerID();
|
||||
auto itr = _listeners.find(listenerID);
|
||||
if (itr == _listeners.end())
|
||||
{
|
||||
|
||||
listeners = new EventListenerVector();
|
||||
_listeners.insert(std::make_pair(listenerID, listeners));
|
||||
}
|
||||
else
|
||||
{
|
||||
listeners = itr->second;
|
||||
}
|
||||
|
||||
listeners->push_back(listener);
|
||||
|
||||
if (listener->getFixedPriority() == 0)
|
||||
{
|
||||
setDirty(listenerID, DirtyFlag::SCENE_GRAPH_PRIORITY);
|
||||
|
||||
auto node = listener->getSceneGraphPriority();
|
||||
CCASSERT(node != nullptr, "Invalid scene graph priority!");
|
||||
|
||||
associateNodeAndEventListener(node, listener);
|
||||
|
||||
if (node->isRunning())
|
||||
{
|
||||
resumeTarget(node);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setDirty(listenerID, DirtyFlag::FIXED_PRITORY);
|
||||
}
|
||||
}
|
||||
|
||||
void EventDispatcher::addEventListenerWithSceneGraphPriority(EventListener* listener, Node* node)
|
||||
{
|
||||
CCASSERT(listener && node, "Invalid parameters.");
|
||||
|
@ -356,13 +371,6 @@ void EventDispatcher::addEventListenerWithSceneGraphPriority(EventListener* list
|
|||
listener->setRegistered(true);
|
||||
|
||||
addEventListener(listener);
|
||||
|
||||
associateNodeAndEventListener(node, listener);
|
||||
|
||||
if (node->isRunning())
|
||||
{
|
||||
resumeTarget(node);
|
||||
}
|
||||
}
|
||||
|
||||
void EventDispatcher::addEventListenerWithFixedPriority(EventListener* listener, int fixedPriority)
|
||||
|
@ -462,6 +470,7 @@ void EventDispatcher::removeEventListener(EventListener* listener)
|
|||
{
|
||||
if (*iter == listener)
|
||||
{
|
||||
listener->release();
|
||||
_toAddedListeners.erase(iter);
|
||||
break;
|
||||
}
|
||||
|
@ -872,33 +881,9 @@ void EventDispatcher::updateListeners(Event* event)
|
|||
|
||||
if (!_toAddedListeners.empty())
|
||||
{
|
||||
EventListenerVector* listeners = nullptr;
|
||||
|
||||
for (auto& listener : _toAddedListeners)
|
||||
{
|
||||
EventListener::ListenerID listenerID = listener->getListenerID();
|
||||
auto itr = _listeners.find(listenerID);
|
||||
if (itr == _listeners.end())
|
||||
{
|
||||
|
||||
listeners = new EventListenerVector();
|
||||
_listeners.insert(std::make_pair(listenerID, listeners));
|
||||
}
|
||||
else
|
||||
{
|
||||
listeners = itr->second;
|
||||
}
|
||||
|
||||
listeners->push_back(listener);
|
||||
|
||||
if (listener->getFixedPriority() == 0)
|
||||
{
|
||||
setDirty(listenerID, DirtyFlag::SCENE_GRAPH_PRIORITY);
|
||||
}
|
||||
else
|
||||
{
|
||||
setDirty(listenerID, DirtyFlag::FIXED_PRITORY);
|
||||
}
|
||||
forceAddEventListener(listener);
|
||||
}
|
||||
_toAddedListeners.clear();
|
||||
}
|
||||
|
@ -1070,10 +1055,11 @@ void EventDispatcher::removeEventListenersForListenerID(const EventListener::Lis
|
|||
}
|
||||
}
|
||||
|
||||
for(auto iter = _toAddedListeners.begin(); iter != _toAddedListeners.end();)
|
||||
for (auto iter = _toAddedListeners.begin(); iter != _toAddedListeners.end();)
|
||||
{
|
||||
if ((*iter)->getListenerID() == listenerID)
|
||||
{
|
||||
(*iter)->release();
|
||||
iter = _toAddedListeners.erase(iter);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
@ -155,9 +155,18 @@ protected:
|
|||
ssize_t _gt0Index;
|
||||
};
|
||||
|
||||
/** Adds event listener with item */
|
||||
/** Adds an event listener with item
|
||||
* @note if it is dispatching event, the added operation will be delayed to the end of current dispatch
|
||||
* @see forceAddEventListener
|
||||
*/
|
||||
void addEventListener(EventListener* listener);
|
||||
|
||||
/** Force adding an event listener
|
||||
* @note force add an event listener which will ignore whether it's in dispatching.
|
||||
* @see addEventListener
|
||||
*/
|
||||
void forceAddEventListener(EventListener* listener);
|
||||
|
||||
/** Gets event the listener list for the event listener type. */
|
||||
EventListenerVector* getListeners(const EventListener::ListenerID& listenerID);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,3 +1,26 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013-2014 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 __CCEVENT_TYPE_H__
|
||||
#define __CCEVENT_TYPE_H__
|
||||
|
@ -9,7 +32,7 @@
|
|||
// The application will come to foreground.
|
||||
// This message is used for reloading resources before come to foreground on Android.
|
||||
// This message is posted in main.cpp.
|
||||
#define EVNET_COME_TO_FOREGROUND "event_come_to_foreground"
|
||||
#define EVENT_COME_TO_FOREGROUND "event_come_to_foreground"
|
||||
|
||||
// The application will come to background.
|
||||
// This message is used for doing something before coming to background, such as save RenderTexture.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
@ -103,20 +104,18 @@ std::string FontAtlasCache::generateFontName(const std::string& fontFileName, in
|
|||
|
||||
bool FontAtlasCache::releaseFontAtlas(FontAtlas *atlas)
|
||||
{
|
||||
if (atlas)
|
||||
if (nullptr != atlas)
|
||||
{
|
||||
for( auto &item: _atlasMap )
|
||||
{
|
||||
if ( item.second == atlas )
|
||||
{
|
||||
bool removeFromList = false;
|
||||
if(item.second->isSingleReference())
|
||||
removeFromList = true;
|
||||
if( atlas->isSingleReference() )
|
||||
{
|
||||
_atlasMap.erase(item.first);
|
||||
}
|
||||
|
||||
item.second->release();
|
||||
|
||||
if (removeFromList)
|
||||
_atlasMap.erase(item.first);
|
||||
atlas->release();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue