Merge pull request #12580 from andyque/v3

merge v3.7 back to v3
This commit is contained in:
子龙山人 2015-06-29 11:51:38 +08:00
commit 85af18f634
69 changed files with 478 additions and 546 deletions

View File

@ -37,4 +37,4 @@ before_install:
# whitelist
branches:
only:
- v3
- v3.7-release

View File

@ -41,7 +41,7 @@ NS_CC_BEGIN
*/
/**
* PolygonInfo is an object holding the required data to display Sprites
* PolygonInfo is an object holding the required data to display Sprites.
* It can be a simple as a triangle, or as complex as a whole 3D mesh
*/
class CC_DLL PolygonInfo

View File

@ -155,33 +155,15 @@ void Skybox::onDraw(const Mat4& transform, uint32_t flags)
{
auto camera = Camera::getVisitingCamera();
/*
At beginning, we have a regular skybox at origin point.
To render the skybox, we should keep camera at the center of skybox.
So we need a translate matrix, which can transform origin point to camera pos.
Camera's node to word transform matrix don't match our requement,
because it maybe contain the scale, rotate, reflact... effects, which isn't need.
First, we transform origin point to camera position by camera's node to world matrix.
Second, we create a translate matrix with the origin point's world position.
*/
Vec3 cameraPosInNode(0, 0, 0);
Vec3 cameraPosInWorld;
Mat4 cameraModelMat = camera->getNodeToWorldTransform();
Mat4 trans = Mat4::IDENTITY;
cameraModelMat.transformPoint(cameraPosInNode, &cameraPosInWorld);
trans.translate(cameraPosInWorld);
auto state = getGLProgramState();
state->apply(trans);
state->apply(transform);
Vec4 color(_displayedColor.r / 255.f, _displayedColor.g / 255.f, _displayedColor.b / 255.f, 1.f);
state->setUniformVec4("u_color", color);
float scalf = (camera->getFarPlane() + camera->getNearPlane()) / 2;
state->setUniformFloat("u_scalef", scalf);
GLboolean depthFlag = glIsEnabled(GL_DEPTH_TEST);
GLint depthFunc;
glGetIntegerv(GL_DEPTH_FUNC, &depthFunc);
cameraModelMat.m[12] = cameraModelMat.m[13] = cameraModelMat.m[14] = 0;
state->setUniformMat4("u_cameraRot", cameraModelMat);
glEnable(GL_DEPTH_TEST);
RenderState::StateBlock::_defaultState->setDepthTest(true);
@ -189,11 +171,6 @@ void Skybox::onDraw(const Mat4& transform, uint32_t flags)
glDepthFunc(GL_LEQUAL);
RenderState::StateBlock::_defaultState->setDepthFunction(RenderState::DEPTH_LEQUAL);
GLboolean cullFlag = glIsEnabled(GL_CULL_FACE);
GLint cullMode;
glGetIntegerv(GL_CULL_FACE_MODE, &cullMode);
glEnable(GL_CULL_FACE);
RenderState::StateBlock::_defaultState->setCullFace(true);
@ -228,14 +205,6 @@ void Skybox::onDraw(const Mat4& transform, uint32_t flags)
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 8);
glCullFace(cullMode);
if (!cullFlag)
glDisable(GL_CULL_FACE);
glDepthFunc(depthFunc);
if (!depthFlag)
glDisable(GL_DEPTH_TEST);
CHECK_GL_ERROR_DEBUG();
}

View File

@ -285,16 +285,7 @@ void AudioEngineImpl::update(float dt)
for (auto iter = _audioPlayers.begin(); iter != itend; )
{
player = &(iter->second);
if (player->_playOver)
{
if (player->_finishCallback)
player->_finishCallback(player->_audioID, *AudioEngine::_audioIDInfoMap[player->_audioID].filePath);
AudioEngine::remove(player->_audioID);
iter = _audioPlayers.erase(iter);
continue;
}
else if (player->_delayTimeToRemove > 0.f)
if (player->_delayTimeToRemove > 0.f)
{
player->_delayTimeToRemove -= dt;
if (player->_delayTimeToRemove < 0.f)
@ -303,6 +294,15 @@ void AudioEngineImpl::update(float dt)
continue;
}
}
else if (player->_playOver)
{
if (player->_finishCallback)
player->_finishCallback(player->_audioID, *AudioEngine::_audioIDInfoMap[player->_audioID].filePath);
AudioEngine::remove(player->_audioID);
iter = _audioPlayers.erase(iter);
continue;
}
++iter;
}

View File

@ -366,9 +366,9 @@ void AndroidJavaEngine::setEffectsVolume(float volume)
if (_effectVolume != volume)
{
_effectVolume = volume;
for (auto& it : _soundIDs)
for (auto it : _soundIDs)
{
AudioEngine::setVolume(it.first, volume);
AudioEngine::setVolume(it, volume);
}
}
}
@ -386,10 +386,10 @@ unsigned int AndroidJavaEngine::playEffect(const char* filePath, bool loop,
auto soundID = AudioEngine::play2d(filePath, loop, _effectVolume);
if (soundID != AudioEngine::INVALID_AUDIO_ID)
{
_soundIDs[soundID] = soundID;
_soundIDs.push_back(soundID);
AudioEngine::setFinishCallback(soundID, [this](int id, const std::string& filePath){
_soundIDs.erase(id);
_soundIDs.remove(id);
});
}
@ -430,7 +430,7 @@ void AndroidJavaEngine::stopEffect(unsigned int soundID)
if (_implementBaseOnAudioEngine)
{
AudioEngine::stop(soundID);
_soundIDs.erase(soundID);
_soundIDs.remove(soundID);
}
else
{
@ -442,9 +442,9 @@ void AndroidJavaEngine::pauseAllEffects()
{
if (_implementBaseOnAudioEngine)
{
for (auto& it : _soundIDs)
for (auto it : _soundIDs)
{
AudioEngine::pause(it.first);
AudioEngine::pause(it);
}
}
else
@ -457,9 +457,9 @@ void AndroidJavaEngine::resumeAllEffects()
{
if (_implementBaseOnAudioEngine)
{
for (auto& it : _soundIDs)
for (auto it : _soundIDs)
{
AudioEngine::resume(it.first);
AudioEngine::resume(it);
}
}
else
@ -472,9 +472,9 @@ void AndroidJavaEngine::stopAllEffects()
{
if (_implementBaseOnAudioEngine)
{
for (auto& it : _soundIDs)
for (auto it : _soundIDs)
{
AudioEngine::stop(it.first);
AudioEngine::stop(it);
}
_soundIDs.clear();
}

View File

@ -27,7 +27,7 @@ THE SOFTWARE.
#include "SimpleAudioEngine.h"
#include "platform/android/jni/JniHelper.h"
#include <unordered_map>
#include <list>
namespace CocosDenshion {
namespace android {
@ -62,7 +62,7 @@ namespace CocosDenshion {
private :
bool _implementBaseOnAudioEngine;
float _effectVolume;
std::unordered_map<int, int> _soundIDs;
std::list<int> _soundIDs;
};
}
}

View File

@ -46,7 +46,10 @@ SimpleAudioEngine* SimpleAudioEngine::getInstance() {
}
void SimpleAudioEngine::end() {
if(oAudioPlayer)
{
oAudioPlayer->close();
}
}
//////////////////////////////////////////////////////////////////////////

View File

@ -332,6 +332,9 @@ bool AudioPlayer::play2d(AudioCache* cache)
_duration = getDuration();
ret = _play();
}
else {
error();
}
}
return ret;
@ -342,6 +345,7 @@ void AudioPlayer::init()
do {
memset(&_xaBuffer, 0, sizeof(_xaBuffer));
if (FAILED(XAudio2Create(_xaEngine.ReleaseAndGetAddressOf()))) {
error();
break;
}
@ -354,8 +358,10 @@ void AudioPlayer::init()
_xaEngine->RegisterForCallbacks(this);
if (FAILED(_xaEngine->CreateMasteringVoice(&_xaMasterVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, nullptr, nullptr, AudioCategory_GameMedia))) {
error();
break;
}
_ready = true;
_state = AudioPlayerState::READY;
} while (false);
@ -363,10 +369,12 @@ void AudioPlayer::init()
void AudioPlayer::free()
{
_ready = false;
_stop();
memset(&_xaBuffer, 0, sizeof(_xaBuffer));
if (_xaEngine) {
_xaEngine->UnregisterForCallbacks(this);
_xaEngine->StopEngine();
}
@ -430,6 +438,7 @@ void AudioPlayer::error()
_criticalError = true;
_ready = false;
_state = AudioPlayerState::ERRORED;
CCLOG("Audio system encountered error.");
}
void AudioPlayer::popBuffer()
@ -537,13 +546,15 @@ void AudioPlayer::OnProcessingPassEnd()
void AudioPlayer::OnCriticalError(HRESULT err)
{
UNREFERENCED_PARAMETER(err);
if (_ready) {
error();
}
}
// IXAudio2VoiceCallback
void AudioPlayer::OnVoiceProcessingPassStart(UINT32 uBytesRequired)
{
if (uBytesRequired && _isStreaming){
if (_ready && uBytesRequired && _isStreaming){
submitBuffers();
}
}
@ -554,7 +565,9 @@ void AudioPlayer::OnVoiceProcessingPassEnd()
void AudioPlayer::OnStreamEnd()
{
if (_ready) {
onBufferRunOut();
}
}
void AudioPlayer::OnBufferStart(void* pBufferContext)
@ -565,14 +578,16 @@ void AudioPlayer::OnBufferStart(void* pBufferContext)
void AudioPlayer::OnBufferEnd(void* pBufferContext)
{
UNREFERENCED_PARAMETER(pBufferContext);
if (_ready) {
updateState();
}
}
void AudioPlayer::OnLoopEnd(void* pBufferContext)
{
UNREFERENCED_PARAMETER(pBufferContext);
if (!_loop) {
if (_ready && !_loop) {
_stop();
}
}
@ -581,7 +596,9 @@ void AudioPlayer::OnVoiceError(void* pBufferContext, HRESULT err)
{
UNREFERENCED_PARAMETER(pBufferContext);
UNREFERENCED_PARAMETER(err);
if (_ready) {
error();
}
}
#endif

View File

@ -1412,7 +1412,7 @@ Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* cocoLoader, st
}
else
{
if (dynamic_cast<Layout*>(widget))
if (nullptr == dynamic_cast<Layout*>(widget))
{
if (child->getPositionType() == ui::Widget::PositionType::PERCENT)
{
@ -1504,7 +1504,7 @@ Widget* WidgetPropertiesReader0300::widgetFromJsonDictionary(const rapidjson::Va
}
else
{
if (dynamic_cast<Layout*>(widget))
if (nullptr == dynamic_cast<Layout*>(widget))
{
if (child->getPositionType() == ui::Widget::PositionType::PERCENT)
{

View File

@ -1,12 +1,13 @@
const char* cc3D_Skybox_vert = STRINGIFY(
uniform float u_scalef;
uniform mat4 u_cameraRot;
attribute vec3 a_position;
varying vec3 v_reflect;
void main(void)
{
v_reflect = a_position;
gl_Position = CC_MVPMatrix * vec4(u_scalef * a_position, 1.0);
vec4 reflect = u_cameraRot * vec4(a_position, 1.0);
v_reflect = reflect.xyz;
gl_Position = vec4(a_position.xy, 1.0 , 1.0);
}
);

View File

@ -5,6 +5,10 @@ LOCAL_MODULE := cocos_ui_static
LOCAL_MODULE_FILENAME := libui
ifeq ($(USE_ARM_MODE),1)
LOCAL_ARM_MODE := arm
endif
LOCAL_SRC_FILES := \
UIWidget.cpp \
UILayout.cpp \

View File

@ -23,13 +23,24 @@ THE SOFTWARE.
****************************************************************************/
#include "ui/UIScrollView.h"
#include "platform/CCDevice.h"
#include "base/CCDirector.h"
NS_CC_BEGIN
namespace ui {
#define MOVE_INCH 7.0f/160.0f
static const float AUTOSCROLLMAXSPEED = 1000.0f;
static float convertDistanceFromPointToInch(Vec2 dis)
{
auto glview = Director::getInstance()->getOpenGLView();
int dpi = Device::getDPI();
float distance = Vec2(dis.x * glview->getScaleX() / dpi, dis.y * glview->getScaleY() / dpi).getLength();
return distance;
}
const Vec2 SCROLLDIR_UP(0.0f, 1.0f);
const Vec2 SCROLLDIR_DOWN(0.0f, -1.0f);
const Vec2 SCROLLDIR_LEFT(-1.0f, 0.0f);
@ -56,7 +67,7 @@ _isAutoScrollSpeedAttenuated(false),
_needCheckAutoScrollDestination(false),
_bePressed(false),
_slidTime(0.0f),
_childFocusCancelOffset(5.0f),
_childFocusCancelOffsetInInch(MOVE_INCH),
_leftBounceNeeded(false),
_topBounceNeeded(false),
_rightBounceNeeded(false),
@ -1576,9 +1587,24 @@ void ScrollView::interceptTouchEvent(Widget::TouchEventType event, Widget *sende
break;
case TouchEventType::MOVED:
{
float offset = (sender->getTouchBeganPosition() - touchPoint).getLength();
_touchMovePosition = touch->getLocation();
if (offset > _childFocusCancelOffset)
// calculates move offset in points
float offsetInInch = 0;
switch (_direction)
{
case Direction::HORIZONTAL:
offsetInInch = convertDistanceFromPointToInch(Vec2(fabs(sender->getTouchBeganPosition().x - touchPoint.x), 0));
break;
case Direction::VERTICAL:
offsetInInch = convertDistanceFromPointToInch(Vec2(0, fabs(sender->getTouchBeganPosition().y - touchPoint.y)));
break;
case Direction::BOTH:
offsetInInch = convertDistanceFromPointToInch(sender->getTouchBeganPosition() - touchPoint);
break;
default:
break;
}
if (offsetInInch > _childFocusCancelOffsetInInch)
{
sender->setHighlighted(false);
handleMoveLogic(touch);

View File

@ -491,7 +491,7 @@ protected:
bool _bePressed;
float _slidTime;
Vec2 _moveChildPoint;
float _childFocusCancelOffset;
float _childFocusCancelOffsetInInch;
bool _leftBounceNeeded;
bool _topBounceNeeded;

View File

@ -5,6 +5,10 @@ LOCAL_MODULE := cocos_extension_static
LOCAL_MODULE_FILENAME := libextension
ifeq ($(USE_ARM_MODE),1)
LOCAL_ARM_MODE := arm
endif
LOCAL_SRC_FILES := \
assets-manager/AssetsManager.cpp \
assets-manager/Downloader.cpp \

View File

@ -1,5 +1,5 @@
{
"version":"v3-deps-66",
"version":"v3-deps-67",
"zip_file_size":"131253061",
"repo_name":"cocos2d-x-3rd-party-libs-bin",
"repo_parent":"https://github.com/cocos2d/",

View File

@ -3041,6 +3041,8 @@
"external/tiff/include/android/tiffio.h",
"external/tiff/include/android/tiffvers.h",
"external/tiff/include/ios/tiff.h",
"external/tiff/include/ios/tiffconf-32.h",
"external/tiff/include/ios/tiffconf-64.h",
"external/tiff/include/ios/tiffconf.h",
"external/tiff/include/ios/tiffio.h",
"external/tiff/include/ios/tiffvers.h",
@ -5284,10 +5286,6 @@
"tools/framework-compile/bin-templates/lua-template-runtime/src/app/MyApp.lua",
"tools/framework-compile/bin-templates/lua-template-runtime/src/app/views/MainScene.lua",
"tools/framework-compile/bin-templates/lua-template-runtime/src/config.lua",
"tools/framework-compile/x-modified/cocos/audio/android/prebuilt-mk/Android.mk",
"tools/framework-compile/x-modified/cocos/prebuilt-mk/Android.mk",
"tools/framework-compile/x-modified/cocos/scripting/js-bindings/proj.android/prebuilt-mk/Android.mk",
"tools/framework-compile/x-modified/cocos/scripting/lua-bindings/proj.android/prebuilt-mk/Android.mk",
"tools/gen-prebuilt/README.md",
"tools/gen-prebuilt/build_config.json",
"tools/gen-prebuilt/excopy.py",

View File

@ -1,7 +1,6 @@
#ifndef _ACTION_MANAGER_TEST_H_
#define _ACTION_MANAGER_TEST_H_
#include "../testBasic.h"
#include "../BaseTest.h"
DEFINE_TEST_SUITE(ActionManagerTests);

View File

@ -26,8 +26,6 @@
#ifndef _ACTIONS__EASE_TEST_H_
#define _ACTIONS__EASE_TEST_H_
////----#include "cocos2d.h"
#include "../testBasic.h"
#include "../BaseTest.h"
DEFINE_TEST_SUITE(ActionsEaseTests);

View File

@ -26,7 +26,6 @@
#ifndef _ACTIONS__PROGRESS_TEST_H_
#define _ACTIONS__PROGRESS_TEST_H_
#include "../testBasic.h"
#include "../BaseTest.h"
DEFINE_TEST_SUITE(ActionsProgressTests);

View File

@ -26,7 +26,6 @@
#ifndef _ActionsTest_H_
#define _ActionsTest_H_
#include "../testBasic.h"
#include "../BaseTest.h"
DEFINE_TEST_SUITE(ActionsTests);

View File

@ -25,7 +25,6 @@
THE SOFTWARE.
****************************************************************************/
#include "../testBasic.h"
#include "../BaseTest.h"
#include "base/allocator/CCAllocatorStrategyPool.h"

View File

@ -350,6 +350,7 @@ TestCase::TestCase()
, _runTime(0.0f)
{
Director::getInstance()->getTextureCache()->removeUnusedTextures();
SpriteFrameCache::getInstance()->removeUnusedSpriteFrames();
this->schedule([&](float dt){
_runTime += dt;

View File

@ -74,7 +74,7 @@ BillBoardRotationTest::BillBoardRotationTest()
root->runAction(rp);
auto jump = JumpBy::create(1, Vec2(0, 0), 30, 1);
auto scale = ScaleBy::create(2, 2, 2, 0.1);
auto scale = ScaleBy::create(2.f, 2.f, 2.f, 0.1f);
auto seq = Sequence::create(jump,scale, NULL);
auto rot = RotateBy::create(2, Vec3(-90, 0, 0));

View File

@ -25,7 +25,6 @@
#ifndef _BILLBOARD_TEST_H_
#define _BILLBOARD_TEST_H_
#include "../testBasic.h"
#include "../BaseTest.h"
#include <string>

View File

@ -25,7 +25,6 @@
#ifndef _COCOSSTUDIO3D_TEST_H_
#define _COCOSSTUDIO3D_TEST_H_
#include "../testBasic.h"
#include "../BaseTest.h"
#include <string>

View File

@ -1,7 +1,6 @@
#ifndef __CONFIGURATIONTEST_H__
#define __CONFIGURATIONTEST_H__
#include "../testBasic.h"
#include "../BaseTest.h"
DEFINE_TEST_SUITE(ConfigurationTests);

View File

@ -220,22 +220,22 @@ void Material_AutoBindings::onEnter()
Material *mat1 = Material::createWithProperties(properties);
auto spriteBlur = Sprite::create("Images/grossini.png");
spriteBlur->setNormalizedPosition(Vec2(0.2, 0.5));
spriteBlur->setNormalizedPosition(Vec2(0.2f, 0.5f));
this->addChild(spriteBlur);
spriteBlur->setGLProgramState(mat1->getTechniqueByName("blur")->getPassByIndex(0)->getGLProgramState());
auto spriteOutline = Sprite::create("Images/grossini.png");
spriteOutline->setNormalizedPosition(Vec2(0.4, 0.5));
spriteOutline->setNormalizedPosition(Vec2(0.4f, 0.5f));
this->addChild(spriteOutline);
spriteOutline->setGLProgramState(mat1->getTechniqueByName("outline")->getPassByIndex(0)->getGLProgramState());
auto spriteNoise = Sprite::create("Images/grossini.png");
spriteNoise->setNormalizedPosition(Vec2(0.6, 0.5));
spriteNoise->setNormalizedPosition(Vec2(0.6f, 0.5f));
this->addChild(spriteNoise);
spriteNoise->setGLProgramState(mat1->getTechniqueByName("noise")->getPassByIndex(0)->getGLProgramState());
auto spriteEdgeDetect = Sprite::create("Images/grossini.png");
spriteEdgeDetect->setNormalizedPosition(Vec2(0.8, 0.5));
spriteEdgeDetect->setNormalizedPosition(Vec2(0.8f, 0.5f));
this->addChild(spriteEdgeDetect);
spriteEdgeDetect->setGLProgramState(mat1->getTechniqueByName("edge_detect")->getPassByIndex(0)->getGLProgramState());
@ -396,7 +396,7 @@ void Material_invalidate::onEnter()
sprite->setScale(5);
sprite->setRotation3D(Vec3(0,180,0));
addChild(sprite);
sprite->setNormalizedPosition(Vec2(0.3,0.3));
sprite->setNormalizedPosition(Vec2(0.3f,0.3f));
auto rotate = RotateBy::create(5, Vec3(0,360,0));
auto repeat = RepeatForever::create(rotate);
@ -408,7 +408,7 @@ void Material_invalidate::onEnter()
skeletonNode->setSkin("goblin");
skeletonNode->setScale(0.25);
skeletonNode->setNormalizedPosition(Vec2(0.6,0.3));
skeletonNode->setNormalizedPosition(Vec2(0.6f,0.3f));
this->addChild(skeletonNode);
}
@ -465,7 +465,7 @@ void Material_renderState::onEnter()
sprite->setScale(5);
sprite->setRotation3D(Vec3(0,180,0));
addChild(sprite);
sprite->setNormalizedPosition(Vec2(0.3,0.3));
sprite->setNormalizedPosition(Vec2(0.3f,0.3f));
auto rotate = RotateBy::create(5, Vec3(0,360,0));
auto repeat = RepeatForever::create(rotate);
@ -477,7 +477,7 @@ void Material_renderState::onEnter()
skeletonNode->setSkin("goblin");
skeletonNode->setScale(0.25);
skeletonNode->setNormalizedPosition(Vec2(0.6,0.3));
skeletonNode->setNormalizedPosition(Vec2(0.6f,0.3f));
this->addChild(skeletonNode);
_stateBlock.setDepthTest(false);

View File

@ -24,7 +24,6 @@
#pragma once
#include "../testBasic.h"
#include "../BaseTest.h"
DEFINE_TEST_SUITE(MaterialSystemTest);

View File

@ -25,7 +25,6 @@
#ifndef _NAVMESH_TEST_H_
#define _NAVMESH_TEST_H_
#include "../testBasic.h"
#include "../BaseTest.h"
#include "navmesh/CCNavMesh.h"
#include <string>

View File

@ -25,7 +25,6 @@
#ifndef _PHYSICS3D_TEST_H_
#define _PHYSICS3D_TEST_H_
#include "../testBasic.h"
#include "../BaseTest.h"
#include <string>

View File

@ -1,5 +1,4 @@
#include "RenderTextureTest.h"
#include "../testBasic.h"
USING_NS_CC;
using namespace cocos2d::ui;

View File

@ -3,7 +3,6 @@
#include "ui/CocosGUI.h"
#include "../testBasic.h"
#include "extensions/cocos-ext.h"
#include "../BaseTest.h"

View File

@ -1,6 +1,6 @@
#ifndef _SHADER_TEST2_H_
#define _SHADER_TEST2_H_
#include "../testBasic.h"
#include "extensions/cocos-ext.h"
#include "../BaseTest.h"

View File

@ -2469,8 +2469,6 @@ void Sprite3DCubeMapTest::addNewSpriteWithCoords(Vec2 p)
_skyBox->setTexture(_textureCube);
addChild(_skyBox);
_skyBox->setScale(700.f);
}
addChild(_camera);

View File

@ -1,6 +1,5 @@
#ifndef __cocos2d_tests__SpritePolygonTest__
#include "../testBasic.h"
#include "../BaseTest.h"
#include "ui/CocosGUI.h"

View File

@ -1,5 +1,5 @@
#ifndef TERRAIN_TESH_H
#include "../testBasic.h"
#include "../BaseTest.h"
#include "3d/CCSprite3D.h"

View File

@ -1,7 +1,6 @@
#ifndef __TEXT_INPUT_TEST_H__
#define __TEXT_INPUT_TEST_H__
#include "../testBasic.h"
#include "../BaseTest.h"
class KeyboardNotificationLayer;

View File

@ -30,4 +30,6 @@ CocostudioParserTests::CocostudioParserTests()
addTestCase("cocostudio 1.3", [](){ return CocostudioParserJsonScene::create("cocosui/UIEditorTest/cocostudio1_3/CocostudioV1_3_1.ExportJson"); });
addTestCase("cocostudio 1.4", [](){ return CocostudioParserJsonScene::create("cocosui/UIEditorTest/cocostudio1_4/Cocostudio1_4_1.ExportJson"); });
addTestCase("cocostudio 1.5", [](){ return CocostudioParserJsonScene::create("cocosui/UIEditorTest/cocostudio1_5/Cocostudio1_5_1.ExportJson"); });
addTestCase("cocostudio 1.6", [](){ return CocostudioParserJsonScene::create("cocosui/UIEditorTest/cocostudio1_6/CocoStudio1.6Demo_1.ExportJson"); });
}

@ -1 +1 @@
Subproject commit 65f45cef163bea7f25d20fe9ba77f6af871656c0
Subproject commit dc719c167623d343cd5fdaaba867e9e1a26a24d3

View File

@ -202,7 +202,8 @@ LOCAL_SRC_FILES := main.cpp \
../../../Classes/VisibleRect.cpp \
../../../Classes/ZwoptexTest/ZwoptexTest.cpp \
../../../Classes/controller.cpp \
../../../Classes/testBasic.cpp
../../../Classes/testBasic.cpp \
../../../Classes/NavMeshTest/NavMeshTest.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes \
$(LOCAL_PATH)/../../../../..

View File

@ -10,7 +10,7 @@
},
{
"from": "../../../../cocos/scripting/lua-bindings/script",
"to": ""
"to": "src/cocos"
},
{
"from": "../../../../external/lua/luasocket",

View File

@ -14,7 +14,7 @@
},
{
"from": "../../../../cocos/scripting/lua-bindings/script",
"to": ""
"to": "src/cocos"
},
{
"from": "../../../../external/lua/luasocket",

View File

@ -1242,15 +1242,9 @@ function LabelCharMapTest.create()
local label2 = cc.Label:createWithCharMap("fonts/tuffy_bold_italic-charmap.plist")
layer:addChild(label2, 0, kTagSprite2)
label2:setAnchorPoint(cc.p(0, 0))
label2:setPosition( cc.p(10,160) )
label2:setPosition( cc.p(10,200) )
label2:setOpacity( 32 )
local label3 = cc.Label:createWithCharMap("fonts/tuffy_bold_italic-charmap.plist")--32 means Space key
label3:setString("123 Test")
layer:addChild(label3, 0, kTagSprite3)
label3:setAnchorPoint(cc.p(0, 0))
label3:setPosition(cc.p(10,220))
local function step(dt)
time = time + dt
local info = string.format("%2.2f Test", time)

View File

@ -103,7 +103,7 @@ function SpritePolygonTest1:ctor()
spp:setPosition(cc.p(s.width / 2 + offset.x, s.height / 2 + offset.y))
sp = cc.Sprite:create(filename)
local sp = cc.Sprite:create(filename)
self:addChild(sp)
sp:setPosition(cc.p(s.width/2 - offset.x, s.height/2 - offset.y))
@ -119,7 +119,7 @@ function SpritePolygonTest1:ctor()
temp = "SpritePolygon:\nPixels drawn: "
local vertCount = "\nverts:" .. info:getVertCount()
local sppArea = cc.Label:createWithTTF(ttfConfig, temp .. info:getArea() .. vertCount)
local sppArea = cc.Label:createWithTTF(ttfConfig, temp .. math.floor(info:getArea()) .. vertCount)
spp:addChild(sppArea)
sppArea:setAnchorPoint(cc.p(0, 1))
@ -212,7 +212,7 @@ function SpritePolygonTest2:make2Sprites()
temp = "SpritePolygon:\nPixels drawn: "
local vertCount = "\nverts:" .. info:getVertCount()
local sppArea = cc.Label:createWithTTF(ttfConfig, temp .. info:getArea() .. vertCount)
local sppArea = cc.Label:createWithTTF(ttfConfig, temp .. math.floor(info:getArea()) .. vertCount)
self.spp:addChild(sppArea)
sppArea:setAnchorPoint(cc.p(0, 1))
end

View File

@ -113,6 +113,7 @@ local function MainMenuCallback()
local scene = cc.Scene:create()
scene:addChild(CreateTestMenu())
Helper.usePhysics = false
cc.Director:getInstance():setDepthTest(false)
cc.Director:getInstance():replaceScene(scene)
end

@ -1 +1 @@
Subproject commit 79d220cb052372cde4868b6d0cc332a89e4fbc03
Subproject commit 2ef9289c0f9e365d4c0aa11989508607f7dada17

View File

@ -4,9 +4,19 @@
USING_NS_CC;
#pragma comment(lib,"libcocos2d.lib")
#pragma comment(lib,"libbox2d.lib")
#pragma comment(lib,"libSpine.lib")
#if _MSC_VER > 1800
#pragma comment(lib,"libcocos2d_2015.lib")
#pragma comment(lib,"libbox2d_2015.lib")
#pragma comment(lib,"libSpine_2015.lib")
#pragma comment(lib,"libbullet_2015.lib")
#pragma comment(lib,"librecast_2015.lib")
#else
#pragma comment(lib,"libcocos2d_2013.lib")
#pragma comment(lib,"libbox2d_2013.lib")
#pragma comment(lib,"libSpine_2013.lib")
#pragma comment(lib,"libbullet_2013.lib")
#pragma comment(lib,"librecast_2013.lib")
#endif
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,

View File

@ -2,11 +2,23 @@
#include "SimulatorWin.h"
#include <shellapi.h>
#pragma comment(lib,"libcocos2d.lib")
#pragma comment(lib,"libjscocos2d.lib")
#pragma comment(lib,"libbox2d.lib")
#pragma comment(lib,"libSpine.lib")
#pragma comment(lib,"libsimulator.lib")
#if _MSC_VER > 1800
#pragma comment(lib,"libcocos2d_2015.lib")
#pragma comment(lib,"libbox2d_2015.lib")
#pragma comment(lib,"libSpine_2015.lib")
#pragma comment(lib,"libbullet_2015.lib")
#pragma comment(lib,"librecast_2015.lib")
#pragma comment(lib,"libjscocos2d_2015.lib")
#pragma comment(lib,"libsimulator_2015.lib")
#else
#pragma comment(lib,"libcocos2d_2013.lib")
#pragma comment(lib,"libbox2d_2013.lib")
#pragma comment(lib,"libSpine_2013.lib")
#pragma comment(lib,"libbullet_2013.lib")
#pragma comment(lib,"librecast_2013.lib")
#pragma comment(lib,"libjscocos2d_2013.lib")
#pragma comment(lib,"libsimulator_2013.lib")
#endif
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,

View File

@ -2,12 +2,23 @@
#include "SimulatorWin.h"
#include <shellapi.h>
#pragma comment(lib,"libcocos2d.lib")
#pragma comment(lib,"libluacocos2d.lib")
#pragma comment(lib,"libbox2d.lib")
#pragma comment(lib,"libSpine.lib")
#pragma comment(lib,"libsimulator.lib")
#if _MSC_VER > 1800
#pragma comment(lib,"libcocos2d_2015.lib")
#pragma comment(lib,"libbox2d_2015.lib")
#pragma comment(lib,"libSpine_2015.lib")
#pragma comment(lib,"libbullet_2015.lib")
#pragma comment(lib,"librecast_2015.lib")
#pragma comment(lib,"libluacocos2d_2015.lib")
#pragma comment(lib,"libsimulator_2015.lib")
#else
#pragma comment(lib,"libcocos2d_2013.lib")
#pragma comment(lib,"libbox2d_2013.lib")
#pragma comment(lib,"libSpine_2013.lib")
#pragma comment(lib,"libbullet_2013.lib")
#pragma comment(lib,"librecast_2013.lib")
#pragma comment(lib,"libluacocos2d_2013.lib")
#pragma comment(lib,"libsimulator_2013.lib")
#endif
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,

View File

@ -76,19 +76,6 @@ class CocosBinTemplateGenerator(object):
tmp_obj = gen_prebuilt_mk.MKGenerator(mk_file_path, android_libs, dst_file_path)
tmp_obj.do_generate()
def process_file(sour, dest):
f = open(sour)
file_content = f.read()
f.close()
file_content = file_content.replace("__LIBS_DIR__", self.lib_dir)
f = open(os.path.join(dest, os.path.basename(sour)), "w")
f.write(file_content)
f.close()
utils_cocos.copy_files_with_cb(os.path.join(self.cur_dir, os.path.pardir, "x-modified"), self.repo_x, process_file)
def getConfigJson(self):
cfg_json_path = os.path.join(self.cur_dir, "template_binary_config.json")
f = open(cfg_json_path)
@ -130,6 +117,14 @@ class CocosBinTemplateGenerator(object):
self.modify_android_build_cfg(lua_build_cfg, "lua")
self.modify_android_build_cfg(js_build_cfg, "js")
# modify the project.properties for templates
cpp_prop_file = os.path.join(dst_dir, "cpp-template-binary/proj.android/project.properties")
lua_prop_file = os.path.join(dst_dir, "lua-template-binary/frameworks/runtime-src/proj.android/project.properties")
js_prop_file = os.path.join(dst_dir, "js-template-binary/frameworks/runtime-src/proj.android/project.properties")
self.modify_project_properties(cpp_prop_file)
self.modify_project_properties(lua_prop_file)
self.modify_project_properties(js_prop_file)
self.modify_version_json(os.path.join(dst_dir, "lua-template-binary/.settings/version.json"))
self.modify_version_json(os.path.join(dst_dir, "js-template-binary/.settings/version.json"))
@ -190,6 +185,22 @@ class CocosBinTemplateGenerator(object):
json.dump(cfg_info, f, sort_keys=True, indent=4)
f.close()
def modify_project_properties(self, cfg_path):
f = open(cfg_path)
lines = f.readlines()
f.close()
new_lines = []
pattern = r'android\.library\.reference.*'
for line in lines:
temp_str = line.strip()
if not re.match(pattern, temp_str):
new_lines.append(line)
f = open(cfg_path, 'w')
f.writelines(new_lines)
f.close()
def modify_android_build_cfg(self, cfg_path, language):
f = open(cfg_path)
content = f.read()
@ -203,7 +214,9 @@ class CocosBinTemplateGenerator(object):
replace_str = "../../cocos2d-x"
if replace_str is not None:
content = content.replace(replace_str, self.repo_x)
framework_version = self.version.strip()
framework_version = framework_version.replace(' ', '-')
content = content.replace(replace_str, "${COCOS_FRAMEWORKS}/%s" % framework_version)
f = open(cfg_path, "w")
f.write(content)

View File

@ -87,8 +87,8 @@ class CocosLibsCompiler(object):
if self.build_mac:
self.compile_mac_ios()
if self.build_android:
self.compile_android("lua")
self.compile_android("js")
self.compile_android("lua")
def build_win32_proj(self, cmd_path, sln_path, proj_name, mode):
@ -126,10 +126,36 @@ class CocosLibsCompiler(object):
if len(vs_cmd_info) == 0:
raise CustomError('Not found available VS.', CustomError.ERROR_TOOLS_NOT_FOUND)
cocos2d_proj_file = os.path.join(self.repo_x, 'cocos/2d/libcocos2d.vcxproj')
# get the VS projects info
win32_proj_info = self.cfg_info[CocosLibsCompiler.KEY_VS_PROJS_INFO]
for vs_version in vs_cmd_info.keys():
for vs_version in compile_vs_versions:
if not vs_version in vs_cmd_info.keys():
continue
# rename the cocos2d project out dll name
f = open(cocos2d_proj_file, 'r')
old_file_content = f.read()
f.close()
new_file_content = old_file_content.replace('$(OutDir)$(ProjectName).dll', '$(OutDir)$(ProjectName)_%d.dll' % vs_version)
f = open(cocos2d_proj_file, 'w')
f.write(new_file_content)
f.close()
try:
vs_command = vs_cmd_info[vs_version]
for key in win32_proj_info.keys():
# clean solutions
proj_path = os.path.join(self.repo_x, key)
clean_cmd = " ".join([
"\"%s\"" % vs_command,
"\"%s\"" % proj_path,
"/clean \"Release|Win32\""
])
utils_cocos.execute_command(clean_cmd)
for key in win32_proj_info.keys():
output_dir = os.path.join(self.lib_dir, "win32")
proj_path = os.path.join(self.repo_x, key)
@ -140,14 +166,6 @@ class CocosLibsCompiler(object):
if not os.path.exists(win32_output_dir):
os.makedirs(win32_output_dir)
# clean solution
# clean_cmd = " ".join([
# "\"%s\"" % vs_command,
# "\"%s\"" % proj_path,
# "/clean \"Release|Win32\""
# ])
# utils_cocos.execute_command(clean_cmd)
# build project
if self.use_incredibuild:
# use incredibuild, build whole sln
@ -189,6 +207,13 @@ class CocosLibsCompiler(object):
if os.path.exists(dst_name):
os.remove(dst_name)
os.rename(src_name, dst_name)
except Exception as e:
raise e
finally:
f = open(cocos2d_proj_file, 'w')
f.write(old_file_content)
f.close()
print("Win32 build succeeded.")
@ -266,7 +291,7 @@ class CocosLibsCompiler(object):
cmd_path = os.path.join(console_dir, "cocos")
proj_name = "My%sGame" % language
proj_dir = os.path.join(self.cur_dir, "temp")
proj_dir = engine_dir
proj_path = os.path.join(proj_dir, proj_name)
utils_cocos.rmdir(proj_path)
@ -354,7 +379,7 @@ if __name__ == "__main__":
parser.add_argument('--mac', dest='mac', action="store_true", help='compile mac platform')
parser.add_argument('--android', dest='android', action="store_true",help='complile android platform')
parser.add_argument('--dis-strip', "--disable-strip", dest='disable_strip', action="store_true", help='Disable the strip of the generated libs.')
parser.add_argument('--vs', dest='vs_version', type=int, help='visual studio version, such as 2013.', default=2013)
parser.add_argument('--vs', dest='vs_version', type=int, help='visual studio version, such as 2013.', default=None)
parser.add_argument("--app-abi", dest="app_abi",
help="Set the APP_ABI of ndk-build.Can be multi value separated with ':'. Sample : --app-aib armeabi:x86:mips. Default value is 'armeabi'.")

View File

@ -15,30 +15,16 @@
}
},
"vs_projs_info" : {
"build/cocos2d-win32.sln" : {
"build_targets" : [
"libluacocos2d"
],
"rename_targets" : [
"libcocos2d", "libluacocos2d", "libSpine", "libbox2d"
]
},
"build/cocos2d-js-win32.sln" : {
"build_targets" : [
"libjscocos2d"
],
"rename_targets" : [
"libjscocos2d"
]
},
"tools/simulator/frameworks/runtime-src/proj.win32/simulator.sln" : {
"build_targets" : [
"libsimulator"
"simulator"
],
"rename_targets" : [
"libSpine", "libbox2d", "libbullet", "librecast",
"libcocos2d", "libluacocos2d", "libjscocos2d",
"libsimulator"
]
}
},
"support_vs_versions" : [ 2013, 2015 ]
"support_vs_versions" : [ 2015, 2013 ]
}

View File

@ -27,6 +27,10 @@ class MKGenerator(object):
EXPORT_INCLUDE_PATTERN = r"^LOCAL_EXPORT_C_INCLUDES[ \t]+[\:\+]=[ \t]+(.+)"
INCLUDE_MODULE_PATTERN = r"^\$\(call[ \t]*import-module,[ \t]*(.*)\)"
KEY_IS_MODULE = 'is_module'
KEY_MODULE_LINES = 'lines'
def __init__(self, src_mk_path, lib_file_path, dst_mk_path=None):
if os.path.isabs(src_mk_path):
self.src_mk_path = src_mk_path
@ -53,11 +57,10 @@ class MKGenerator(object):
from utils_cocos import win2unix
win2unix(self.src_mk_path)
def get_lib_file_name(self):
src_mk_obj = open(self.src_mk_path)
def get_lib_file_name(self, lines):
module_file_name = None
module_name = None
for line in src_mk_obj.readlines():
for line in lines:
trim_line = line.lstrip(" ")
trim_line = trim_line.rstrip(" ")
match1 = re.match(MKGenerator.LIB_MODULE_FILENAME_PATTERN, trim_line)
@ -74,8 +77,6 @@ class MKGenerator(object):
elif module_name is not None:
ret = "lib%s.a" % module_name
src_mk_obj.close()
return ret
def modidy_src_file(self, lines, new_src_file):
@ -83,9 +84,11 @@ class MKGenerator(object):
src_file_begin_flag = False
added = False
found_src_file_cfg = False
for line in lines:
trim_line = line.lstrip(" ")
if re.match(MKGenerator.SRC_FILE_CFG_PATTERN, trim_line):
found_src_file_cfg = True
if not added:
new_lines.append("LOCAL_SRC_FILES := %s\n" % new_src_file)
added = True
@ -97,7 +100,16 @@ class MKGenerator(object):
else:
new_lines.append(line)
return new_lines
if not found_src_file_cfg:
ret_lines = []
for line in new_lines:
ret_lines.append(line)
if re.match(MKGenerator.LIB_MODULE_FILENAME_PATTERN, line):
ret_lines.append("LOCAL_SRC_FILES := %s\n" % new_src_file)
else:
ret_lines = new_lines
return ret_lines
def remove_config(self, lines, cfg_key):
new_lines = []
@ -160,6 +172,7 @@ class MKGenerator(object):
new_path = "$(LOCAL_PATH)/%s/%s" % (rel_path, include_path)
new_include_paths.append(new_path)
if len(new_include_paths) > 0:
new_path_str = "LOCAL_EXPORT_C_INCLUDES := "
new_path_str += " \\\n".join(new_include_paths)
new_path_str += "\n"
@ -217,13 +230,76 @@ class MKGenerator(object):
new_line = line.replace("LOCAL_STATIC_LIBRARIES", "LOCAL_WHOLE_STATIC_LIBRARIES")
new_lines.append(new_line)
return new_lines
ret_lines = []
is_first_time = True
pattern = r'LOCAL_WHOLE_STATIC_LIBRARIES[ \t]*:=.*'
for line in new_lines:
ret_line = line
if re.match(pattern, line):
if is_first_time:
is_first_time = False
else:
ret_line = line.replace(":=", "+=")
ret_lines.append(ret_line)
return ret_lines
def split_modules(self, origin_lines):
ret = []
cur_module = {}
cur_module[MKGenerator.KEY_MODULE_LINES] = []
cur_module[MKGenerator.KEY_IS_MODULE] = False
pattern_begin = r'include[ \t]+\$\(CLEAR_VARS\)'
pattern_end = r'include[ \t]+\$\(BUILD_STATIC_LIBRARY\)'
for line in origin_lines:
if re.match(pattern_begin, line):
if len(cur_module[MKGenerator.KEY_MODULE_LINES]) > 0:
ret.append(cur_module)
cur_module = {}
cur_module[MKGenerator.KEY_MODULE_LINES] = []
cur_module[MKGenerator.KEY_IS_MODULE] = True
cur_module[MKGenerator.KEY_MODULE_LINES].append(line)
if re.match(pattern_end, line):
if len(cur_module[MKGenerator.KEY_MODULE_LINES]) > 0:
ret.append(cur_module)
cur_module = {}
cur_module[MKGenerator.KEY_MODULE_LINES] = []
cur_module[MKGenerator.KEY_IS_MODULE] = False
if len(cur_module[MKGenerator.KEY_MODULE_LINES]) > 0:
ret.append(cur_module)
return ret
def handle_module(self, module_lines, relative_path):
# modify the LOCAL_SRC_FILES
lib_file_name = self.get_lib_file_name(module_lines)
if lib_file_name is None:
raise Exception("The mk file %s not specify module name." % self.src_mk_path)
relative_path = "%s/$(TARGET_ARCH_ABI)/%s" % (relative_path, lib_file_name)
dst_lines = self.modidy_src_file(module_lines, relative_path)
# remove the LOCAL_C_INCLUDES & LOCAL_LDLIBS
dst_lines = self.remove_config(dst_lines, "LOCAL_C_INCLUDES")
dst_lines = self.remove_config(dst_lines, "LOCAL_LDLIBS")
# modify the LOCAL_EXPORT_C_INCLUDES
dst_lines = self.modify_export_c_include(dst_lines)
# modify the line $(include BUILD_STATIC_LIBRARY)
dst_lines = self.modify_include_cfg(dst_lines)
# use whole libs
dst_lines = self.use_whole_lib(dst_lines)
return dst_lines
def do_generate(self):
lib_file_name = self.get_lib_file_name()
if lib_file_name is None:
raise Exception("The mk file %s not specify module name.")
src_mk_obj = open(self.src_mk_path)
# open the dst file
@ -236,30 +312,24 @@ class MKGenerator(object):
dst_mk_obj = open(self.dst_mk_path, "w")
relative_path = os.path.relpath(self.lib_file_path, os.path.dirname(self.dst_mk_path))
relative_path = "%s/$(TARGET_ARCH_ABI)/%s" % (relative_path, lib_file_name)
# read the src file
src_lines = src_mk_obj.readlines()
# modify the LOCAL_SRC_FILES
dst_lines = self.modidy_src_file(src_lines, relative_path)
modules = self.split_modules(src_lines)
dst_lines = []
for module in modules:
if module[MKGenerator.KEY_IS_MODULE]:
ret_lines = self.handle_module(module[MKGenerator.KEY_MODULE_LINES], relative_path)
else:
ret_lines = module[MKGenerator.KEY_MODULE_LINES]
# remove the LOCAL_C_INCLUDES & LOCAL_LDLIBS
dst_lines = self.remove_config(dst_lines, "LOCAL_C_INCLUDES")
dst_lines = self.remove_config(dst_lines, "LOCAL_LDLIBS")
# modify the LOCAL_EXPORT_C_INCLUDES
dst_lines = self.modify_export_c_include(dst_lines)
# modify the line $(include BUILD_STATIC_LIBRARY)
dst_lines = self.modify_include_cfg(dst_lines)
for l in ret_lines:
dst_lines.append(l)
# modify the import-module
dst_lines = self.modify_import_module(dst_lines)
# use whole libs
dst_lines = self.use_whole_lib(dst_lines)
dst_mk_obj.writelines(dst_lines)
#close files

View File

@ -150,20 +150,21 @@ class TemplateModifier(object):
install_path = self.engine_path
if self.is_for_package:
install_path = "$(COCOS_FRAMEWORKS)\\%s" % self.version
install_path = "$(COCOS_FRAMEWORKS)\\%s\\" % self.version
custom_step_event = vcx_proj.get_event_command('CustomBuildStep')
copy_libs_cmd = "if not exist \"$(OutDir)\" mkdir \"$(OutDir)\"\n" \
"xcopy /Y /Q \"$(EngineRoot)\\prebuilt\\win32\\*.*\" \"$(OutDir)\"\n"
custom_step_event = copy_libs_cmd + custom_step_event
vcx_proj.set_event_command('PreLinkEvent', copy_libs_cmd, 'debug')
vcx_proj.set_event_command('PreLinkEvent', copy_libs_cmd, 'release')
if language == "js":
vcx_proj.set_event_command('PreLinkEvent', '', create_new=False)
custom_step_event = vcx_proj.get_event_command('CustomBuildStep')
custom_step_event.replace("$(ProjectDir)..\\..\\cocos2d-x\\cocos\\scripting\\js-bindings\\script",
"$(ProjectDir)..\\..\\..\\script")
vcx_proj.set_event_command("CustomBuildStep", custom_step_event, create_new=False)
vcx_proj.remove_predefine_macro("_DEBUG", 'debug')
#
# copy_libs_cmd = "if not exist \"$(OutDir)\" mkdir \"$(OutDir)\"\n" \
# "xcopy /Y /Q \"$(EngineRoot)tools\\framework-compile\\libs\\windows\\*.*\" \"$(OutDir)\"\n"
@ -179,9 +180,6 @@ class TemplateModifier(object):
# link_cmd = "libcmt.lib;%(IgnoreSpecificDefaultLibraries)"
# vcx_proj.set_item("Link", "IgnoreSpecificDefaultLibraries", link_cmd)
#
# vcx_proj.remove_predefine_macro("_DEBUG")
#
#
# debug_prebuild = vcx_proj.get_event_command("PreBuildEvent", "debug")
# debug_prebuild = debug_prebuild.replace("$(ProjectDir)..\\..\\cocos2d-x\\cocos\\scripting\\js-bindings\\script",
# "$(ProjectDir)..\\..\\..\\script")
@ -234,6 +232,8 @@ class TemplateModifier(object):
file_content = file_content.replace("MultiThreadedDebugDLL", "MultiThreadedDLL")
for str in replace_strs:
file_content = file_content.replace(str, install_path)
file_content = file_content.replace('%s\\' % install_path, install_path)
f = open(proj_file_path, "w")
f.write(file_content)
f.close()

View File

@ -147,6 +147,9 @@ class VCXProject(object):
cfg_nodes = self.root_node.getElementsByTagName("ItemDefinitionGroup")
for cfg_node in cfg_nodes:
if config is not None:
if 'Condition' not in cfg_node.attributes.keys():
continue
cond_attr = cfg_node.attributes["Condition"].value
if cond_attr.lower().find("debug") >= 0:
cur_mode = "Debug"
@ -161,6 +164,12 @@ class VCXProject(object):
continue
cmd_node = self.get_or_create_node(event_node, "Command")
if cmd_node.firstChild is None:
impl = minidom.getDOMImplementation()
dom = impl.createDocument(None, 'catalog', None)
nodeValue = dom.createTextNode(command)
cmd_node.appendChild(nodeValue)
else:
cmd_node.firstChild.nodeValue = command
def get_node_if(self, parent, name):
@ -210,13 +219,17 @@ class VCXProject(object):
def remove_predefine_macro(self, macro, config=None):
cfg_nodes = self.root_node.getElementsByTagName("ItemDefinitionGroup")
for cfg_node in cfg_nodes:
if config is not None:
if 'Condition' not in cfg_node.attributes.keys():
continue
cond_attr = cfg_node.attributes["Condition"].value
if cond_attr.lower().find("debug") >= 0:
cur_mode = "Debug"
else:
cur_mode = "Release"
if (config is not None) and (cur_mode.lower() != config.lower()):
if (cur_mode.lower() != config.lower()):
continue
compile_node = self.get_or_create_node(cfg_node, "ClCompile")

View File

@ -4,6 +4,8 @@
"from": "templates/cpp-template-default",
"to": "cpp-template-binary",
"exclude": [
"*android-studio",
"*win10",
"*wp8",
"*win8.1-universal",
"*linux",
@ -25,6 +27,8 @@
"from": "templates/lua-template-default/frameworks",
"to": "lua-template-binary/frameworks",
"exclude": [
"*android-studio",
"*win10",
"*wp8",
"*win8.1-universal",
"*linux",
@ -42,6 +46,8 @@
"from": "templates/js-template-runtime",
"to": "js-template-binary",
"exclude": [
"*android-studio",
"*win10",
"*wp8",
"*win8.1-universal",
"*linux",
@ -52,10 +58,7 @@
},
{
"from": "web",
"to": "js-template-binary/frameworks/cocos2d-html5",
"exclude": [
".*"
]
"to": "js-template-binary/frameworks/cocos2d-html5"
},
{
"from": "tools/simulator/frameworks/runtime-src/Classes/ide-support",
@ -64,6 +67,13 @@
"RuntimeJsImpl.*"
]
},
{
"from": "tools/simulator/frameworks/runtime-src/Classes",
"to": "lua-template-binary/frameworks/runtime-src/Classes",
"include": [
"lua_module_register.h"
]
},
{
"from": "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios",
"to": "lua-template-binary/frameworks/runtime-src/proj.ios_mac/ios",
@ -136,24 +146,15 @@
},
{
"from": "cocos/platform/android/java/src",
"to": "cpp-template-binary/proj.android/src",
"include": [
"*.java"
]
"to": "cpp-template-binary/proj.android/src"
},
{
"from": "cocos/platform/android/java/src",
"to": "lua-template-binary/frameworks/runtime-src/proj.android/src",
"include": [
"*.java"
]
"to": "lua-template-binary/frameworks/runtime-src/proj.android/src"
},
{
"from": "cocos/platform/android/java/src",
"to": "js-template-binary/frameworks/runtime-src/proj.android/src",
"include": [
"*.java"
]
"to": "js-template-binary/frameworks/runtime-src/proj.android/src"
}
],
"modify_config": [
@ -169,7 +170,13 @@
}
],
"android_mks" : [
"cocos/Android.mk",
"cocos/audio/android/Android.mk",
"cocos/scripting/js-bindings/proj.android/Android.mk",
"cocos/scripting/lua-bindings/proj.android/Android.mk",
"cocos/storage/local-storage/Android.mk",
"external/bullet/Android.mk",
"external/recast/Android.mk",
"external/flatbuffers/Android.mk",
"external/Box2D/Android.mk",
"cocos/editor-support/cocosbuilder/Android.mk",

View File

@ -120,7 +120,7 @@ def get_vs_cmd_path(vs_version):
def rmdir(folder):
if os.path.exists(folder):
if sys.platform == 'win32':
execute_command("rd /s/q %s" % folder)
execute_command("rd /s/q \"%s\"" % folder)
else:
shutil.rmtree(folder)

View File

@ -1,28 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := cocosdenshion_static
LOCAL_MODULE_FILENAME := libcocosdenshion
LOCAL_SRC_FILES := __LIBS_DIR__/android/$(TARGET_ARCH_ABI)/libcocosdenshion.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../include
include $(PREBUILT_STATIC_LIBRARY)
#new audio engine
include $(CLEAR_VARS)
LOCAL_MODULE := audioengine_static
LOCAL_MODULE_FILENAME := libaudioengine
LOCAL_SRC_FILES := __LIBS_DIR__/android/$(TARGET_ARCH_ABI)/libaudioengine.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../include
LOCAL_EXPORT_LDLIBS := -lOpenSLES
include $(PREBUILT_STATIC_LIBRARY)

View File

@ -1,86 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := cocos2dx_internal_static
LOCAL_MODULE_FILENAME := libcocos2dxinternal
LOCAL_SRC_FILES := __LIBS_DIR__/android/$(TARGET_ARCH_ABI)/libcocos2dxinternal.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/.. \
$(LOCAL_PATH)/../. \
$(LOCAL_PATH)/../platform \
$(LOCAL_PATH)/../base \
$(LOCAL_PATH)/../../external \
$(LOCAL_PATH)/../../external/tinyxml2 \
$(LOCAL_PATH)/../../external/unzip \
$(LOCAL_PATH)/../../external/chipmunk/include/chipmunk \
$(LOCAL_PATH)/../../external/xxhash \
$(LOCAL_PATH)/../../external/nslog
LOCAL_EXPORT_LDLIBS := -lGLESv2 \
-llog \
-landroid
LOCAL_WHOLE_STATIC_LIBRARIES := cocos_freetype2_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_png_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_jpeg_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_tiff_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_webp_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_chipmunk_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_zlib_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dxandroid_static
# define the macro to compile through support/zip_support/ioapi.c
LOCAL_CFLAGS := -DUSE_FILE32API
LOCAL_CPPFLAGS := -Wno-deprecated-declarations -Wno-extern-c-compat
LOCAL_EXPORT_CFLAGS := -DUSE_FILE32API
LOCAL_EXPORT_CPPFLAGS := -Wno-deprecated-declarations -Wno-extern-c-compat
include $(PREBUILT_STATIC_LIBRARY)
#==============================================================
include $(CLEAR_VARS)
LOCAL_MODULE := cocos2dx_static
LOCAL_MODULE_FILENAME := libcocos2d
LOCAL_SRC_FILES := __LIBS_DIR__/android/$(TARGET_ARCH_ABI)/libcocos2d.a
LOCAL_WHOLE_STATIC_LIBRARIES := cocostudio_static
LOCAL_WHOLE_STATIC_LIBRARIES += audioengine_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos3d_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosbuilder_static
LOCAL_WHOLE_STATIC_LIBRARIES += spine_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_network_static
include $(PREBUILT_STATIC_LIBRARY)
#==============================================================
$(call import-module,freetype2/prebuilt/android)
$(call import-module, platform/android/prebuilt-mk)
$(call import-module,png/prebuilt/android)
$(call import-module,jpeg/prebuilt/android)
$(call import-module,tiff/prebuilt/android)
$(call import-module,webp/prebuilt/android)
$(call import-module,chipmunk/prebuilt/android)
$(call import-module, 3d/prebuilt-mk)
$(call import-module, audio/android/prebuilt-mk)
$(call import-module, editor-support/cocosbuilder/prebuilt-mk)
$(call import-module, editor-support/cocostudio/prebuilt-mk)
$(call import-module, editor-support/spine/prebuilt-mk)
$(call import-module, network/prebuilt-mk)
$(call import-module, ui/prebuilt-mk)
$(call import-module, extensions/prebuilt-mk)
$(call import-module, Box2D/prebuilt-mk)
$(call import-module,curl/prebuilt/android)
$(call import-module,websockets/prebuilt/android)
$(call import-module, flatbuffers/prebuilt-mk)
$(call import-module, zlib/prebuilt/android)

View File

@ -1,66 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := cocos2d_js_android_static
LOCAL_MODULE_FILENAME := libjscocos2dandroid
LOCAL_SRC_FILES := __LIBS_DIR__/android/$(TARGET_ARCH_ABI)/libjscocos2dandroid.a
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../.. \
$(LOCAL_PATH)/../manual \
$(LOCAL_PATH)/../manual/platform/android \
$(LOCAL_PATH)/../../../base \
$(LOCAL_PATH)/../../../../external/chipmunk/include/chipmunk
LOCAL_EXPORT_LDLIBS := -lGLESv2 \
-llog \
-landroid
LOCAL_STATIC_LIBRARIES := spidermonkey_static
include $(PREBUILT_STATIC_LIBRARY)
#==============================================================
include $(CLEAR_VARS)
LOCAL_MODULE := cocos2d_js_static
LOCAL_MODULE_FILENAME := libjscocos2d
LOCAL_SRC_FILES := __LIBS_DIR__/prebuilt/android/$(TARGET_ARCH_ABI)/libjscocos2d.a
LOCAL_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../manual \
$(LOCAL_PATH)/../auto \
$(LOCAL_PATH)/../../../2d \
$(LOCAL_PATH)/../../../base \
$(LOCAL_PATH)/../../../ui \
$(LOCAL_PATH)/../../../audio/include \
$(LOCAL_PATH)/../../../storage \
$(LOCAL_PATH)/../../../../extensions \
$(LOCAL_PATH)/../../../editor-support/spine \
$(LOCAL_PATH)/../../../editor-support/cocosbuilder \
$(LOCAL_PATH)/../../../editor-support/cocostudio
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../manual \
$(LOCAL_PATH)/../../auto \
$(LOCAL_PATH)/../../../../audio/include
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2d_js_android_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_localstorage_static
include $(PREBUILT_STATIC_LIBRARY)
$(call import-module,./prebuilt-mk)
$(call import-module,external/spidermonkey/prebuilt/android)
$(call import-module,storage/local-storage/prebuilt-mk)

View File

@ -1,54 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := cocos2d_lua_android_static
LOCAL_MODULE_FILENAME := libluacocos2dandroid
LOCAL_SRC_FILES := __LIBS_DIR__/prebuilt/android/$(TARGET_ARCH_ABI)/libluacocos2dandroid.a
LOCAL_EXPORT_LDLIBS := -lGLESv2 \
-llog \
-landroid
LOCAL_WHOLE_STATIC_LIBRARIES := luajit_static
include $(PREBUILT_STATIC_LIBRARY)
#==============================================================
include $(CLEAR_VARS)
LOCAL_MODULE := cocos2d_lua_static
LOCAL_MODULE_FILENAME := libluacocos2d
LOCAL_SRC_FILES := __LIBS_DIR__/prebuilt/android/$(TARGET_ARCH_ABI)/libluacocos2d.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../../../external/lua/tolua \
$(LOCAL_PATH)/../../../../../external/lua/luajit/include \
$(LOCAL_PATH)/../../auto \
$(LOCAL_PATH)/../../manual \
$(LOCAL_PATH)/../../manual/cocos2d \
$(LOCAL_PATH)/../../manual/3d \
$(LOCAL_PATH)/../../manual/cocosdenshion \
$(LOCAL_PATH)/../../manual/audioengine \
$(LOCAL_PATH)/../../manual/network \
$(LOCAL_PATH)/../../manual/cocosbuilder \
$(LOCAL_PATH)/../../manual/cocostudio \
$(LOCAL_PATH)/../../manual/spine \
$(LOCAL_PATH)/../../manual/extension \
$(LOCAL_PATH)/../../manual/ui \
$(LOCAL_PATH)/../../../../../external/lua/quick \
$(LOCAL_PATH)/../../../../..
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2d_lua_android_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static
include $(PREBUILT_STATIC_LIBRARY)
$(call import-module,lua/luajit/prebuilt/android)
$(call import-module, ./prebuilt-mk)

View File

@ -11,9 +11,5 @@
"zip_file_path": "../cocos2d-console",
"extract_to_zip_path": "tools/cocos2d-console"
}
],
"extra_dirs":
[
"tools/fbx-conv"
]
}

View File

@ -238,11 +238,22 @@ class GitArchiver(object):
extra_folder_path = os.path.join(self.main_repo_abspath, extra_folder_name)
extra_folders.append(extra_folder_path)
extra_file_paths = self.unpack_zipfile(zip_file_path, self.main_repo_abspath)
key_move_dirs = "move_dirs"
for file_path in extra_file_paths:
if file_path.find(extra_folder_path) == -1:
raise Exception("Couldn't find extra folder path (%s) in (%s)!" % (extra_folder_path, file_path))
path_in_zip = extra_to_zip_file + file_path[(len(extra_folder_path)):]
if key_move_dirs in zip_config:
move_dirs = zip_config[key_move_dirs]
related_path = os.path.relpath(file_path, extra_folder_path)
temp_rel_path = related_path.replace('\\', '/')
for move_dir in move_dirs:
if temp_rel_path.startswith(move_dir):
move_to_dir = move_dirs[move_dir]
path_in_zip = os.path.join(move_to_dir, related_path)
break
try:
add(file_path, path_in_zip)
@ -250,8 +261,9 @@ class GitArchiver(object):
print('add %s failed.' % file_path)
pass
outfile_name, outfile_ext = path.splitext(output_path)
for extra_dir in config_data["extra_dirs"]:
key_extra_dirs = "extra_dirs"
if key_extra_dirs in config_data:
for extra_dir in config_data[key_extra_dirs]:
dir_path = path.join(self.main_repo_abspath, extra_dir)
list_dirs = os.walk(dir_path)
for root,dirs,files in list_dirs:

View File

@ -22,6 +22,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjscocos2d", "..\..\..\..
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbullet", "..\..\..\..\..\external\bullet\proj.win32\libbullet.vcxproj", "{012DFF48-A13F-4F52-B07B-F8B9D21CE95B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "librecast", "..\..\..\..\..\external\recast\proj.win32\librecast.vcxproj", "{41E34993-647E-4282-8384-4AB1AE31A452}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -60,6 +62,10 @@ Global
{012DFF48-A13F-4F52-B07B-F8B9D21CE95B}.Debug|Win32.Build.0 = Debug|Win32
{012DFF48-A13F-4F52-B07B-F8B9D21CE95B}.Release|Win32.ActiveCfg = Release|Win32
{012DFF48-A13F-4F52-B07B-F8B9D21CE95B}.Release|Win32.Build.0 = Release|Win32
{41E34993-647E-4282-8384-4AB1AE31A452}.Debug|Win32.ActiveCfg = Debug|Win32
{41E34993-647E-4282-8384-4AB1AE31A452}.Debug|Win32.Build.0 = Debug|Win32
{41E34993-647E-4282-8384-4AB1AE31A452}.Release|Win32.ActiveCfg = Release|Win32
{41E34993-647E-4282-8384-4AB1AE31A452}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -91,6 +91,7 @@
<AdditionalDependencies>libcurl_imp.lib;websockets.lib;mozjs-33.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ProgramDatabaseFile>$(ProjectDir)../../../runtime/win32/$(TargetName).pdb</ProgramDatabaseFile>
<OutputFile>$(ProjectDir)../../../runtime/win32/$(TargetName)$(TargetExt)</OutputFile>
<IgnoreSpecificDefaultLibraries>libcmt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
</Link>
<ResourceCompile>
<Culture>0x0409</Culture>
@ -156,6 +157,7 @@ xcopy /Y /Q "$(OutDir)lang" "$(ProjectDir)..\..\..\runtime\win32"
<AdditionalDependencies>libcurl_imp.lib;websockets.lib;mozjs-33.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>false</GenerateDebugInformation>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<IgnoreSpecificDefaultLibraries>libcmt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
</Link>
<ResourceCompile>
<Culture>0x0409</Culture>

View File

@ -25,7 +25,7 @@ ELAPSEDSECS=`date +%s`
COCOS_BRANCH="update_lua_bindings_$ELAPSEDSECS"
COCOS_ROBOT_REMOTE="https://${GH_USER}:${GH_PASSWORD}@github.com/${GH_USER}/cocos2d-x.git"
PULL_REQUEST_REPO="https://api.github.com/repos/cocos2d/cocos2d-x/pulls"
FETCH_REMOTE_BRANCH="v3"
FETCH_REMOTE_BRANCH="v3.7-release"
LUA_COMMIT_PATH="cocos/scripting/lua-bindings/auto"
JS_COMMIT_PATH="cocos/scripting/js-bindings/auto"

View File

@ -6,7 +6,7 @@ PROJECT_ROOT="$DIR"/../..
COMMITTAG="[AUTO][ci skip]: updating cocos2dx_files.json"
PUSH_REPO="https://api.github.com/repos/cocos2d/cocos2d-x/pulls"
OUTPUT_FILE_PATH="${PROJECT_ROOT}/templates/cocos2dx_files.json"
FETCH_REMOTE_BRANCH="v3"
FETCH_REMOTE_BRANCH="v3.7-release"
COMMIT_PATH="templates/cocos2dx_files.json"
# Exit on error

View File

@ -16,4 +16,4 @@ notifications:
# whitelist
branches:
only:
- v3
- v3.7-release

2
web

@ -1 +1 @@
Subproject commit 7b76c2bc701f87818c90192d8988cf4f898d3943
Subproject commit fec945a7000ff31a7c206ca2ca7fd13707a2570a