Merge branch 'v3.7-release' into videoplayer

This commit is contained in:
jianglong0156 2015-06-29 10:07:19 +08:00
commit b9cccc8a4d
40 changed files with 119 additions and 75 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

@ -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

@ -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,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

@ -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

@ -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

@ -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

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

@ -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

@ -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