This commit is contained in:
honghui 2014-09-17 18:07:06 +08:00
commit f009de11c3
44 changed files with 506 additions and 340 deletions

View File

@ -1004,6 +1004,9 @@ Developers:
joewan
Fixed memory leak when use menu_selector
zhongfq
Optimize decompress jpg data
Retired Core Developers:
WenSheng Yang
Author of windows port, CCTextField,

View File

@ -12,14 +12,16 @@ cocos2d-x-3.3?? ??
[FIX] C++: CMake works for Mac builds
[FIX] C++: Reorganized cocos2d/platform folder. Easier to add new platforms
[FIX] EditBox: moved to ui:EditBox
[FIX] External: ScrollView: scroll view hidden picks up the touch events
[FIX] FastTileMap: change indices to short because not all devices support int indices
[FIX] HttpClient: condition variable sleep on unrelated mutex
[FIX] Image: optimize decompress jpg data
[FIX] Label: outline effect may be wrong if outline width is big and font size is big too
[FIX] MenuItem: memory leak if using menu_selector
[FIX] MeshCommand: generate wrong meterial id which will cause problem that only first mesh is drawn
[FIX] Node: create unneeded temple `Vec2` object in `setPosition(int, int)`, `setPositionX()` and `setPositionY()`
[FIX] Node: skew effect is wrong
[FIX] Node: setNormalizedPosition can not take effect if parent position is not changed
[FIX] External: ScrollView: scroll view hidden picks up the touch events
[FIX] TextureAtlas: may crash if only drawing part of it
[FIX] UI: Button: a button can not be touched if it only contains title
[FIX] UI: Button: title can not be scaled if a button is scaled

View File

@ -209,7 +209,6 @@ void ClippingNode::drawFullScreenQuadClearStencil()
};
auto glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_U_COLOR);
glProgram->retain();
int colorLocation = glProgram->getUniformLocation("u_color");
CHECK_GL_ERROR_DEBUG();
@ -221,15 +220,8 @@ void ClippingNode::drawFullScreenQuadClearStencil()
glProgram->setUniformLocationWith4fv(colorLocation, (GLfloat*) &color.r, 1);
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );
GLuint vbo;
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vec2)*4, vertices, GL_STREAM_DRAW);
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glBindBuffer(GL_ARRAY_BUFFER, 0);
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 4);

View File

@ -264,7 +264,7 @@ bool DrawNode::init()
glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD);
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, texCoords));
glBindBuffer(GL_ARRAY_BUFFER, 0);
if (Configuration::getInstance()->supportsShareableVAO())
{
GL::bindVAO(0);

View File

@ -300,7 +300,7 @@ void TMXLayer::updateIndexBuffer()
{
if(nullptr == _indexBuffer)
{
_indexBuffer = IndexBuffer::create(IndexBuffer::IndexType::INDEX_TYPE_UINT_32, (int)_indices.size());
_indexBuffer = IndexBuffer::create(IndexBuffer::IndexType::INDEX_TYPE_SHORT_16, (int)_indices.size());
CC_SAFE_RETAIN(_indexBuffer);
}
_indexBuffer->updateIndices(&_indices[0], (int)_indices.size(), 0);

View File

@ -241,7 +241,7 @@ protected:
bool _quadsDirty;
std::vector<int> _tileToQuadIndex;
std::vector<V3F_C4B_T2F_Quad> _totalQuads;
std::vector<int> _indices;
std::vector<GLushort> _indices;
std::map<int/*vertexZ*/, int/*offset to _indices by quads*/> _indicesVertexZOffsets;
std::unordered_map<int/*vertexZ*/, int/*number to quads*/> _indicesVertexZNumber;
std::vector<PrimitiveCommand> _renderCommands;

View File

@ -36,6 +36,7 @@
#define TIME_DELAY_PRECISION 0.0001
using namespace cocos2d;
using namespace cocos2d::experimental;
const int AudioEngine::INVAILD_AUDIO_ID = -1;
const float AudioEngine::TIME_UNKNOWN = -1.0f;

View File

@ -39,6 +39,7 @@
#include <jni.h>
using namespace cocos2d;
using namespace cocos2d::experimental;
void PlayOverEvent(SLPlayItf caller, void* context, SLuint32 playEvent)
{

View File

@ -37,7 +37,7 @@
#define ERRORLOG(msg) log("fun:%s,line:%d,msg:%s",__func__,__LINE__,#msg)
NS_CC_BEGIN
namespace experimental{
class AudioEngineImpl;
class AudioPlayer
@ -102,7 +102,7 @@ private:
};
#endif // __AUDIO_ENGINE_INL_H_
}
NS_CC_END
#endif

View File

@ -36,6 +36,7 @@
#endif // ERROR
NS_CC_BEGIN
namespace experimental{
class EXPORT_DLL AudioProfile
{
@ -265,6 +266,7 @@ protected:
friend class AudioEngineImpl;
};
}
NS_CC_END
#endif // __AUDIO_ENGINE_H_

View File

@ -39,6 +39,7 @@
#define QUEUEBUFFER_TIME_STEP 0.1
NS_CC_BEGIN
namespace experimental{
class AudioEngineImpl;
class AudioPlayer;
@ -91,6 +92,7 @@ private:
friend class AudioPlayer;
} ;
}
NS_CC_END
#endif // __AUDIO_CACHE_H_

View File

@ -44,6 +44,7 @@ static ALvoid alBufferDataStaticProc(const ALint bid, ALenum format, ALvoid* da
return;
}
using namespace cocos2d;
using namespace cocos2d::experimental;
AudioCache::AudioCache()
: _pcmData(nullptr)

View File

@ -33,7 +33,7 @@
#include "AudioPlayer.h"
NS_CC_BEGIN
namespace experimental{
#define MAX_AUDIOINSTANCES 32
class AudioEngineThreadPool;
@ -88,6 +88,7 @@ private:
int _currentAudioID;
};
}
NS_CC_END
#endif // __AUDIO_ENGINE_INL_H_
#endif

View File

@ -31,6 +31,7 @@
#include "base/ccUtils.h"
using namespace cocos2d;
using namespace cocos2d::experimental;
static ALCdevice *s_ALDevice = nullptr;
static ALCcontext *s_ALContext = nullptr;
@ -47,88 +48,90 @@ static void AudioInterrupionListenerCallback(void* user_data, UInt32 interruptio
}
namespace cocos2d {
class AudioEngineThreadPool
{
public:
AudioEngineThreadPool()
: _running(true)
, _numThread(6)
namespace experimental {
class AudioEngineThreadPool
{
_threads.reserve(_numThread);
_tasks.reserve(_numThread);
public:
AudioEngineThreadPool()
: _running(true)
, _numThread(6)
{
_threads.reserve(_numThread);
_tasks.reserve(_numThread);
for (int index = 0; index < _numThread; ++index) {
_tasks.push_back(nullptr);
_threads.push_back( std::thread( std::bind(&AudioEngineThreadPool::threadFunc,this,index) ) );
}
}
void addTask(const std::function<void()> &task){
_taskMutex.lock();
int targetIndex = -1;
for (int index = 0; index < _numThread; ++index) {
if (_tasks[index] == nullptr) {
targetIndex = index;
_tasks[index] = task;
break;
for (int index = 0; index < _numThread; ++index) {
_tasks.push_back(nullptr);
_threads.push_back( std::thread( std::bind(&AudioEngineThreadPool::threadFunc,this,index) ) );
}
}
if (targetIndex == -1) {
_tasks.push_back(task);
_threads.push_back( std::thread( std::bind(&AudioEngineThreadPool::threadFunc,this,_numThread) ) );
_numThread++;
}
_taskMutex.unlock();
_sleepCondition.notify_all();
}
void destroy()
{
_running = false;
_sleepCondition.notify_all();
for (int index = 0; index < _numThread; ++index) {
_threads[index].join();
}
}
private:
bool _running;
std::vector<std::thread> _threads;
std::vector< std::function<void ()> > _tasks;
void threadFunc(int index)
{
while (_running) {
std::function<void ()> task = nullptr;
void addTask(const std::function<void()> &task){
_taskMutex.lock();
task = _tasks[index];
_taskMutex.unlock();
if (nullptr == task)
{
std::unique_lock<std::mutex> lk(_sleepMutex);
_sleepCondition.wait(lk);
continue;
int targetIndex = -1;
for (int index = 0; index < _numThread; ++index) {
if (_tasks[index] == nullptr) {
targetIndex = index;
_tasks[index] = task;
break;
}
}
if (targetIndex == -1) {
_tasks.push_back(task);
_threads.push_back( std::thread( std::bind(&AudioEngineThreadPool::threadFunc,this,_numThread) ) );
task();
_taskMutex.lock();
_tasks[index] = nullptr;
_numThread++;
}
_taskMutex.unlock();
_sleepCondition.notify_all();
}
}
int _numThread;
void destroy()
{
_running = false;
_sleepCondition.notify_all();
std::mutex _taskMutex;
std::mutex _sleepMutex;
std::condition_variable _sleepCondition;
for (int index = 0; index < _numThread; ++index) {
_threads[index].join();
}
}
};
private:
bool _running;
std::vector<std::thread> _threads;
std::vector< std::function<void ()> > _tasks;
void threadFunc(int index)
{
while (_running) {
std::function<void ()> task = nullptr;
_taskMutex.lock();
task = _tasks[index];
_taskMutex.unlock();
if (nullptr == task)
{
std::unique_lock<std::mutex> lk(_sleepMutex);
_sleepCondition.wait(lk);
continue;
}
task();
_taskMutex.lock();
_tasks[index] = nullptr;
_taskMutex.unlock();
}
}
int _numThread;
std::mutex _taskMutex;
std::mutex _sleepMutex;
std::condition_variable _sleepCondition;
};
}
}
AudioEngineImpl::AudioEngineImpl()

View File

@ -32,6 +32,8 @@
#include "CCPlatformMacros.h"
NS_CC_BEGIN
namespace experimental{
class AudioCache;
class AudioEngineImpl;
@ -70,6 +72,8 @@ private:
friend class AudioEngineImpl;
};
}
NS_CC_END
#endif // __AUDIO_PLAYER_H_
#endif

View File

@ -27,6 +27,7 @@
#import <AudioToolbox/ExtendedAudioFile.h>
using namespace cocos2d;
using namespace cocos2d::experimental;
AudioPlayer::AudioPlayer()
: _exitThread(false)

View File

@ -835,7 +835,6 @@ bool Image::initWithJpgData(const unsigned char * data, ssize_t dataLen)
/* libjpeg data structure for storing one row, that is, scanline of an image */
JSAMPROW row_pointer[1] = {0};
unsigned long location = 0;
unsigned int i = 0;
bool ret = false;
do
@ -885,8 +884,6 @@ bool Image::initWithJpgData(const unsigned char * data, ssize_t dataLen)
_width = cinfo.output_width;
_height = cinfo.output_height;
_hasPremultipliedAlpha = false;
row_pointer[0] = static_cast<unsigned char*>(malloc(cinfo.output_width*cinfo.output_components * sizeof(unsigned char)));
CC_BREAK_IF(! row_pointer[0]);
_dataLen = cinfo.output_width*cinfo.output_height*cinfo.output_components;
_data = static_cast<unsigned char*>(malloc(_dataLen * sizeof(unsigned char)));
@ -896,28 +893,22 @@ bool Image::initWithJpgData(const unsigned char * data, ssize_t dataLen)
/* read one scan line at a time */
while (cinfo.output_scanline < cinfo.output_height)
{
jpeg_read_scanlines( &cinfo, row_pointer, 1 );
for (i=0; i<cinfo.output_width*cinfo.output_components; i++)
{
_data[location++] = row_pointer[0][i];
}
row_pointer[0] = _data + location;
location += cinfo.output_width*cinfo.output_components;
jpeg_read_scanlines(&cinfo, row_pointer, 1);
}
/* When read image file with broken data, jpeg_finish_decompress() may cause error.
* Besides, jpeg_destroy_decompress() shall deallocate and release all memory associated
* with the decompression object.
* So it doesn't need to call jpeg_finish_decompress().
*/
//jpeg_finish_decompress( &cinfo );
/* When read image file with broken data, jpeg_finish_decompress() may cause error.
* Besides, jpeg_destroy_decompress() shall deallocate and release all memory associated
* with the decompression object.
* So it doesn't need to call jpeg_finish_decompress().
*/
//jpeg_finish_decompress( &cinfo );
jpeg_destroy_decompress( &cinfo );
/* wrap up decompression, destroy objects, free pointers and close open files */
ret = true;
} while (0);
if (row_pointer[0] != nullptr)
{
free(row_pointer[0]);
};
return ret;
#else
return false;

View File

@ -27,6 +27,10 @@
#include "renderer/ccGLStateCache.h"
#include "renderer/CCGLProgram.h"
#include "renderer/CCGLProgramState.h"
#include "renderer/CCRenderer.h"
#include "base/CCDirector.h"
#include "xxhash.h"
NS_CC_BEGIN
@ -77,6 +81,7 @@ void PrimitiveCommand::execute() const
_glProgramState->apply(_mv);
_primitive->draw();
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1,_primitive->getCount());
}
NS_CC_END

View File

@ -1,7 +1,7 @@
--------------------------------
-- @module AudioEngine
-- @parent_module cc
-- @parent_module ccexp
--------------------------------
--
@ -124,7 +124,7 @@
-- @param #string filePath
-- @param #bool loop
-- @param #float volume
-- @param #cc.AudioProfile profile
-- @param #cc.experimental::AudioProfile profile
-- @return int#int ret (return value: int)
--------------------------------
@ -173,7 +173,7 @@
-- return the default profile of audio instances
-- @function [parent=#AudioEngine] getDefaultProfile
-- @param self
-- @return AudioProfile#AudioProfile ret (return value: cc.AudioProfile)
-- @return experimental::AudioProfile#experimental::AudioProfile ret (return value: cc.experimental::AudioProfile)
--------------------------------
-- @overload self, string
@ -181,6 +181,6 @@
-- @function [parent=#AudioEngine] getProfile
-- @param self
-- @param #int audioID
-- @return AudioProfile#AudioProfile ret (retunr value: cc.AudioProfile)
-- @return experimental::AudioProfile#experimental::AudioProfile ret (retunr value: cc.experimental::AudioProfile)
return nil

View File

@ -1,7 +1,7 @@
--------------------------------
-- @module AudioProfile
-- @parent_module cc
-- @parent_module ccexp
--------------------------------
--

View File

@ -24,7 +24,15 @@
-- @param #bool able
--------------------------------
-- brief Return a zoom scale
-- Return the inner title renderer of Button<br>
-- since v3.3
-- @function [parent=#Button] getTitleRenderer
-- @param self
-- @return Label#Label ret (return value: cc.Label)
--------------------------------
-- brief Return a zoom scale <br>
-- since v3.3
-- @function [parent=#Button] getZoomScale
-- @param self
-- @return float#float ret (return value: float)
@ -166,7 +174,8 @@
--------------------------------
-- When user pressed the button, the button will zoom to a scale.<br>
-- The final scale of the button equals (button original scale + _zoomScale)
-- The final scale of the button equals (button original scale + _zoomScale)<br>
-- since v3.3
-- @function [parent=#Button] setZoomScale
-- @param self
-- @param #float scale

View File

@ -39,7 +39,8 @@
-- @return Node#Node ret (return value: cc.Node)
--------------------------------
-- brief Allow widget touch events to propagate to its parents. Set false will disable propagation
-- brief Allow widget touch events to propagate to its parents. Set false will disable propagation<br>
-- since v3.3
-- @function [parent=#Widget] setPropagateTouchEvents
-- @param self
-- @param #bool isPropagate
@ -59,7 +60,8 @@
-- @param #vec2_table percent
--------------------------------
-- brief Specify widget to swallow touches or not
-- brief Specify widget to swallow touches or not<br>
-- since v3.3
-- @function [parent=#Widget] setSwallowTouches
-- @param self
-- @param #bool swallow
@ -290,7 +292,8 @@
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- Return whether the widget is propagate touch events to its parents or not<br>
-- since v3.3
-- @function [parent=#Widget] isPropagateTouchEvents
-- @param self
-- @return bool#bool ret (return value: bool)
@ -399,7 +402,8 @@
-- @param #bool bright
--------------------------------
--
-- Return whether the widget is swallowing touch or not<br>
-- since v3.3
-- @function [parent=#Widget] isSwallowTouches
-- @param self
-- @return bool#bool ret (return value: bool)

View File

@ -1,14 +1,14 @@
--------------------------------
-- @module cc
-- @module ccexp
--------------------------------------------------------
-- the cc AudioProfile
-- @field [parent=#cc] AudioProfile#AudioProfile AudioProfile preloaded module
-- the ccexp AudioProfile
-- @field [parent=#ccexp] AudioProfile#AudioProfile AudioProfile preloaded module
--------------------------------------------------------
-- the cc AudioEngine
-- @field [parent=#cc] AudioEngine#AudioEngine AudioEngine preloaded module
-- the ccexp AudioEngine
-- @field [parent=#ccexp] AudioEngine#AudioEngine AudioEngine preloaded module
return nil

View File

@ -8,7 +8,7 @@
int lua_cocos2dx_audioengine_AudioProfile_constructor(lua_State* tolua_S)
{
int argc = 0;
cocos2d::AudioProfile* cobj = nullptr;
cocos2d::experimental::AudioProfile* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
@ -22,12 +22,12 @@ int lua_cocos2dx_audioengine_AudioProfile_constructor(lua_State* tolua_S)
{
if(!ok)
return 0;
cobj = new cocos2d::AudioProfile();
tolua_pushusertype(tolua_S,(void*)cobj,"cc.AudioProfile");
cobj = new cocos2d::experimental::AudioProfile();
tolua_pushusertype(tolua_S,(void*)cobj,"ccexp.AudioProfile");
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.AudioProfile:AudioProfile",argc, 0);
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.AudioProfile:AudioProfile",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
@ -45,15 +45,15 @@ static int lua_cocos2dx_audioengine_AudioProfile_finalize(lua_State* tolua_S)
int lua_register_cocos2dx_audioengine_AudioProfile(lua_State* tolua_S)
{
tolua_usertype(tolua_S,"cc.AudioProfile");
tolua_cclass(tolua_S,"AudioProfile","cc.AudioProfile","",nullptr);
tolua_usertype(tolua_S,"ccexp.AudioProfile");
tolua_cclass(tolua_S,"AudioProfile","ccexp.AudioProfile","",nullptr);
tolua_beginmodule(tolua_S,"AudioProfile");
tolua_function(tolua_S,"new",lua_cocos2dx_audioengine_AudioProfile_constructor);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::AudioProfile).name();
g_luaType[typeName] = "cc.AudioProfile";
g_typeCast["AudioProfile"] = "cc.AudioProfile";
std::string typeName = typeid(cocos2d::experimental::AudioProfile).name();
g_luaType[typeName] = "ccexp.AudioProfile";
g_typeCast["AudioProfile"] = "ccexp.AudioProfile";
return 1;
}
@ -67,7 +67,7 @@ int lua_cocos2dx_audioengine_AudioEngine_lazyInit(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -76,11 +76,11 @@ int lua_cocos2dx_audioengine_AudioEngine_lazyInit(lua_State* tolua_S)
{
if(!ok)
return 0;
bool ret = cocos2d::AudioEngine::lazyInit();
bool ret = cocos2d::experimental::AudioEngine::lazyInit();
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:lazyInit",argc, 0);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:lazyInit",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -98,7 +98,7 @@ int lua_cocos2dx_audioengine_AudioEngine_setCurrentTime(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -107,15 +107,15 @@ int lua_cocos2dx_audioengine_AudioEngine_setCurrentTime(lua_State* tolua_S)
{
int arg0;
double arg1;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.AudioEngine:setCurrentTime");
ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.AudioEngine:setCurrentTime");
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccexp.AudioEngine:setCurrentTime");
ok &= luaval_to_number(tolua_S, 3,&arg1, "ccexp.AudioEngine:setCurrentTime");
if(!ok)
return 0;
bool ret = cocos2d::AudioEngine::setCurrentTime(arg0, arg1);
bool ret = cocos2d::experimental::AudioEngine::setCurrentTime(arg0, arg1);
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:setCurrentTime",argc, 2);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:setCurrentTime",argc, 2);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -133,7 +133,7 @@ int lua_cocos2dx_audioengine_AudioEngine_getVolume(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -141,14 +141,14 @@ int lua_cocos2dx_audioengine_AudioEngine_getVolume(lua_State* tolua_S)
if (argc == 1)
{
int arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.AudioEngine:getVolume");
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccexp.AudioEngine:getVolume");
if(!ok)
return 0;
double ret = cocos2d::AudioEngine::getVolume(arg0);
double ret = cocos2d::experimental::AudioEngine::getVolume(arg0);
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:getVolume",argc, 1);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:getVolume",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -166,7 +166,7 @@ int lua_cocos2dx_audioengine_AudioEngine_uncache(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -174,13 +174,13 @@ int lua_cocos2dx_audioengine_AudioEngine_uncache(lua_State* tolua_S)
if (argc == 1)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.AudioEngine:uncache");
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.AudioEngine:uncache");
if(!ok)
return 0;
cocos2d::AudioEngine::uncache(arg0);
cocos2d::experimental::AudioEngine::uncache(arg0);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:uncache",argc, 1);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:uncache",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -198,7 +198,7 @@ int lua_cocos2dx_audioengine_AudioEngine_resumeAll(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -207,10 +207,10 @@ int lua_cocos2dx_audioengine_AudioEngine_resumeAll(lua_State* tolua_S)
{
if(!ok)
return 0;
cocos2d::AudioEngine::resumeAll();
cocos2d::experimental::AudioEngine::resumeAll();
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:resumeAll",argc, 0);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:resumeAll",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -228,7 +228,7 @@ int lua_cocos2dx_audioengine_AudioEngine_stopAll(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -237,10 +237,10 @@ int lua_cocos2dx_audioengine_AudioEngine_stopAll(lua_State* tolua_S)
{
if(!ok)
return 0;
cocos2d::AudioEngine::stopAll();
cocos2d::experimental::AudioEngine::stopAll();
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:stopAll",argc, 0);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:stopAll",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -258,7 +258,7 @@ int lua_cocos2dx_audioengine_AudioEngine_pause(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -266,13 +266,13 @@ int lua_cocos2dx_audioengine_AudioEngine_pause(lua_State* tolua_S)
if (argc == 1)
{
int arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.AudioEngine:pause");
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccexp.AudioEngine:pause");
if(!ok)
return 0;
cocos2d::AudioEngine::pause(arg0);
cocos2d::experimental::AudioEngine::pause(arg0);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:pause",argc, 1);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:pause",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -290,7 +290,7 @@ int lua_cocos2dx_audioengine_AudioEngine_end(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -299,10 +299,10 @@ int lua_cocos2dx_audioengine_AudioEngine_end(lua_State* tolua_S)
{
if(!ok)
return 0;
cocos2d::AudioEngine::end();
cocos2d::experimental::AudioEngine::end();
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:end",argc, 0);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:end",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -320,7 +320,7 @@ int lua_cocos2dx_audioengine_AudioEngine_getMaxAudioInstance(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -329,11 +329,11 @@ int lua_cocos2dx_audioengine_AudioEngine_getMaxAudioInstance(lua_State* tolua_S)
{
if(!ok)
return 0;
int ret = cocos2d::AudioEngine::getMaxAudioInstance();
int ret = cocos2d::experimental::AudioEngine::getMaxAudioInstance();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:getMaxAudioInstance",argc, 0);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:getMaxAudioInstance",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -351,7 +351,7 @@ int lua_cocos2dx_audioengine_AudioEngine_getCurrentTime(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -359,14 +359,14 @@ int lua_cocos2dx_audioengine_AudioEngine_getCurrentTime(lua_State* tolua_S)
if (argc == 1)
{
int arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.AudioEngine:getCurrentTime");
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccexp.AudioEngine:getCurrentTime");
if(!ok)
return 0;
double ret = cocos2d::AudioEngine::getCurrentTime(arg0);
double ret = cocos2d::experimental::AudioEngine::getCurrentTime(arg0);
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:getCurrentTime",argc, 1);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:getCurrentTime",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -384,7 +384,7 @@ int lua_cocos2dx_audioengine_AudioEngine_setMaxAudioInstance(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -392,14 +392,14 @@ int lua_cocos2dx_audioengine_AudioEngine_setMaxAudioInstance(lua_State* tolua_S)
if (argc == 1)
{
int arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.AudioEngine:setMaxAudioInstance");
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccexp.AudioEngine:setMaxAudioInstance");
if(!ok)
return 0;
bool ret = cocos2d::AudioEngine::setMaxAudioInstance(arg0);
bool ret = cocos2d::experimental::AudioEngine::setMaxAudioInstance(arg0);
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:setMaxAudioInstance",argc, 1);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:setMaxAudioInstance",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -417,7 +417,7 @@ int lua_cocos2dx_audioengine_AudioEngine_isLoop(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -425,14 +425,14 @@ int lua_cocos2dx_audioengine_AudioEngine_isLoop(lua_State* tolua_S)
if (argc == 1)
{
int arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.AudioEngine:isLoop");
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccexp.AudioEngine:isLoop");
if(!ok)
return 0;
bool ret = cocos2d::AudioEngine::isLoop(arg0);
bool ret = cocos2d::experimental::AudioEngine::isLoop(arg0);
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:isLoop",argc, 1);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:isLoop",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -450,7 +450,7 @@ int lua_cocos2dx_audioengine_AudioEngine_pauseAll(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -459,10 +459,10 @@ int lua_cocos2dx_audioengine_AudioEngine_pauseAll(lua_State* tolua_S)
{
if(!ok)
return 0;
cocos2d::AudioEngine::pauseAll();
cocos2d::experimental::AudioEngine::pauseAll();
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:pauseAll",argc, 0);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:pauseAll",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -480,7 +480,7 @@ int lua_cocos2dx_audioengine_AudioEngine_uncacheAll(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -489,10 +489,10 @@ int lua_cocos2dx_audioengine_AudioEngine_uncacheAll(lua_State* tolua_S)
{
if(!ok)
return 0;
cocos2d::AudioEngine::uncacheAll();
cocos2d::experimental::AudioEngine::uncacheAll();
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:uncacheAll",argc, 0);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:uncacheAll",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -510,7 +510,7 @@ int lua_cocos2dx_audioengine_AudioEngine_setVolume(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -519,14 +519,14 @@ int lua_cocos2dx_audioengine_AudioEngine_setVolume(lua_State* tolua_S)
{
int arg0;
double arg1;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.AudioEngine:setVolume");
ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.AudioEngine:setVolume");
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccexp.AudioEngine:setVolume");
ok &= luaval_to_number(tolua_S, 3,&arg1, "ccexp.AudioEngine:setVolume");
if(!ok)
return 0;
cocos2d::AudioEngine::setVolume(arg0, arg1);
cocos2d::experimental::AudioEngine::setVolume(arg0, arg1);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:setVolume",argc, 2);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:setVolume",argc, 2);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -544,7 +544,7 @@ int lua_cocos2dx_audioengine_AudioEngine_play2d(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -552,10 +552,10 @@ int lua_cocos2dx_audioengine_AudioEngine_play2d(lua_State* tolua_S)
if (argc == 1)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.AudioEngine:play2d");
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.AudioEngine:play2d");
if(!ok)
return 0;
int ret = cocos2d::AudioEngine::play2d(arg0);
int ret = cocos2d::experimental::AudioEngine::play2d(arg0);
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
@ -563,11 +563,11 @@ int lua_cocos2dx_audioengine_AudioEngine_play2d(lua_State* tolua_S)
{
std::string arg0;
bool arg1;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.AudioEngine:play2d");
ok &= luaval_to_boolean(tolua_S, 3,&arg1, "cc.AudioEngine:play2d");
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.AudioEngine:play2d");
ok &= luaval_to_boolean(tolua_S, 3,&arg1, "ccexp.AudioEngine:play2d");
if(!ok)
return 0;
int ret = cocos2d::AudioEngine::play2d(arg0, arg1);
int ret = cocos2d::experimental::AudioEngine::play2d(arg0, arg1);
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
@ -576,12 +576,12 @@ int lua_cocos2dx_audioengine_AudioEngine_play2d(lua_State* tolua_S)
std::string arg0;
bool arg1;
double arg2;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.AudioEngine:play2d");
ok &= luaval_to_boolean(tolua_S, 3,&arg1, "cc.AudioEngine:play2d");
ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.AudioEngine:play2d");
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.AudioEngine:play2d");
ok &= luaval_to_boolean(tolua_S, 3,&arg1, "ccexp.AudioEngine:play2d");
ok &= luaval_to_number(tolua_S, 4,&arg2, "ccexp.AudioEngine:play2d");
if(!ok)
return 0;
int ret = cocos2d::AudioEngine::play2d(arg0, arg1, arg2);
int ret = cocos2d::experimental::AudioEngine::play2d(arg0, arg1, arg2);
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
@ -590,18 +590,18 @@ int lua_cocos2dx_audioengine_AudioEngine_play2d(lua_State* tolua_S)
std::string arg0;
bool arg1;
double arg2;
const cocos2d::AudioProfile* arg3;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.AudioEngine:play2d");
ok &= luaval_to_boolean(tolua_S, 3,&arg1, "cc.AudioEngine:play2d");
ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.AudioEngine:play2d");
ok &= luaval_to_object<const cocos2d::AudioProfile>(tolua_S, 5, "cc.AudioProfile",&arg3);
const cocos2d::experimental::AudioProfile* arg3;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.AudioEngine:play2d");
ok &= luaval_to_boolean(tolua_S, 3,&arg1, "ccexp.AudioEngine:play2d");
ok &= luaval_to_number(tolua_S, 4,&arg2, "ccexp.AudioEngine:play2d");
ok &= luaval_to_object<const cocos2d::experimental::AudioProfile>(tolua_S, 5, "ccexp.AudioProfile",&arg3);
if(!ok)
return 0;
int ret = cocos2d::AudioEngine::play2d(arg0, arg1, arg2, arg3);
int ret = cocos2d::experimental::AudioEngine::play2d(arg0, arg1, arg2, arg3);
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:play2d",argc, 1);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:play2d",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -619,7 +619,7 @@ int lua_cocos2dx_audioengine_AudioEngine_getState(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -627,14 +627,14 @@ int lua_cocos2dx_audioengine_AudioEngine_getState(lua_State* tolua_S)
if (argc == 1)
{
int arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.AudioEngine:getState");
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccexp.AudioEngine:getState");
if(!ok)
return 0;
int ret = (int)cocos2d::AudioEngine::getState(arg0);
int ret = (int)cocos2d::experimental::AudioEngine::getState(arg0);
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:getState",argc, 1);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:getState",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -652,7 +652,7 @@ int lua_cocos2dx_audioengine_AudioEngine_resume(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -660,13 +660,13 @@ int lua_cocos2dx_audioengine_AudioEngine_resume(lua_State* tolua_S)
if (argc == 1)
{
int arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.AudioEngine:resume");
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccexp.AudioEngine:resume");
if(!ok)
return 0;
cocos2d::AudioEngine::resume(arg0);
cocos2d::experimental::AudioEngine::resume(arg0);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:resume",argc, 1);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:resume",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -684,7 +684,7 @@ int lua_cocos2dx_audioengine_AudioEngine_stop(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -692,13 +692,13 @@ int lua_cocos2dx_audioengine_AudioEngine_stop(lua_State* tolua_S)
if (argc == 1)
{
int arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.AudioEngine:stop");
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccexp.AudioEngine:stop");
if(!ok)
return 0;
cocos2d::AudioEngine::stop(arg0);
cocos2d::experimental::AudioEngine::stop(arg0);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:stop",argc, 1);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:stop",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -716,7 +716,7 @@ int lua_cocos2dx_audioengine_AudioEngine_getDuration(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -724,14 +724,14 @@ int lua_cocos2dx_audioengine_AudioEngine_getDuration(lua_State* tolua_S)
if (argc == 1)
{
int arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.AudioEngine:getDuration");
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccexp.AudioEngine:getDuration");
if(!ok)
return 0;
double ret = cocos2d::AudioEngine::getDuration(arg0);
double ret = cocos2d::experimental::AudioEngine::getDuration(arg0);
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:getDuration",argc, 1);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:getDuration",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -749,7 +749,7 @@ int lua_cocos2dx_audioengine_AudioEngine_setLoop(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -758,14 +758,14 @@ int lua_cocos2dx_audioengine_AudioEngine_setLoop(lua_State* tolua_S)
{
int arg0;
bool arg1;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.AudioEngine:setLoop");
ok &= luaval_to_boolean(tolua_S, 3,&arg1, "cc.AudioEngine:setLoop");
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccexp.AudioEngine:setLoop");
ok &= luaval_to_boolean(tolua_S, 3,&arg1, "ccexp.AudioEngine:setLoop");
if(!ok)
return 0;
cocos2d::AudioEngine::setLoop(arg0, arg1);
cocos2d::experimental::AudioEngine::setLoop(arg0, arg1);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:setLoop",argc, 2);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:setLoop",argc, 2);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -783,7 +783,7 @@ int lua_cocos2dx_audioengine_AudioEngine_getDefaultProfile(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -792,11 +792,11 @@ int lua_cocos2dx_audioengine_AudioEngine_getDefaultProfile(lua_State* tolua_S)
{
if(!ok)
return 0;
cocos2d::AudioProfile* ret = cocos2d::AudioEngine::getDefaultProfile();
object_to_luaval<cocos2d::AudioProfile>(tolua_S, "cc.AudioProfile",(cocos2d::AudioProfile*)ret);
cocos2d::experimental::AudioProfile* ret = cocos2d::experimental::AudioEngine::getDefaultProfile();
object_to_luaval<cocos2d::experimental::AudioProfile>(tolua_S, "ccexp.AudioProfile",(cocos2d::experimental::AudioProfile*)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:getDefaultProfile",argc, 0);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:getDefaultProfile",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -813,7 +813,7 @@ int lua_cocos2dx_audioengine_AudioEngine_getProfile(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S)-1;
@ -823,10 +823,10 @@ int lua_cocos2dx_audioengine_AudioEngine_getProfile(lua_State* tolua_S)
if (argc == 1)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.AudioEngine:getProfile");
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.AudioEngine:getProfile");
if (!ok) { break; }
cocos2d::AudioProfile* ret = cocos2d::AudioEngine::getProfile(arg0);
object_to_luaval<cocos2d::AudioProfile>(tolua_S, "cc.AudioProfile",(cocos2d::AudioProfile*)ret);
cocos2d::experimental::AudioProfile* ret = cocos2d::experimental::AudioEngine::getProfile(arg0);
object_to_luaval<cocos2d::experimental::AudioProfile>(tolua_S, "ccexp.AudioProfile",(cocos2d::experimental::AudioProfile*)ret);
return 1;
}
} while (0);
@ -836,15 +836,15 @@ int lua_cocos2dx_audioengine_AudioEngine_getProfile(lua_State* tolua_S)
if (argc == 1)
{
int arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.AudioEngine:getProfile");
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccexp.AudioEngine:getProfile");
if (!ok) { break; }
cocos2d::AudioProfile* ret = cocos2d::AudioEngine::getProfile(arg0);
object_to_luaval<cocos2d::AudioProfile>(tolua_S, "cc.AudioProfile",(cocos2d::AudioProfile*)ret);
cocos2d::experimental::AudioProfile* ret = cocos2d::experimental::AudioEngine::getProfile(arg0);
object_to_luaval<cocos2d::experimental::AudioProfile>(tolua_S, "ccexp.AudioProfile",(cocos2d::experimental::AudioProfile*)ret);
return 1;
}
} while (0);
ok = true;
CCLOG("%s has wrong number of arguments: %d, was expecting %d", "cc.AudioEngine:getProfile",argc, 1);
CCLOG("%s has wrong number of arguments: %d, was expecting %d", "ccexp.AudioEngine:getProfile",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -860,8 +860,8 @@ static int lua_cocos2dx_audioengine_AudioEngine_finalize(lua_State* tolua_S)
int lua_register_cocos2dx_audioengine_AudioEngine(lua_State* tolua_S)
{
tolua_usertype(tolua_S,"cc.AudioEngine");
tolua_cclass(tolua_S,"AudioEngine","cc.AudioEngine","",nullptr);
tolua_usertype(tolua_S,"ccexp.AudioEngine");
tolua_cclass(tolua_S,"AudioEngine","ccexp.AudioEngine","",nullptr);
tolua_beginmodule(tolua_S,"AudioEngine");
tolua_function(tolua_S,"lazyInit", lua_cocos2dx_audioengine_AudioEngine_lazyInit);
@ -888,17 +888,17 @@ int lua_register_cocos2dx_audioengine_AudioEngine(lua_State* tolua_S)
tolua_function(tolua_S,"getDefaultProfile", lua_cocos2dx_audioengine_AudioEngine_getDefaultProfile);
tolua_function(tolua_S,"getProfile", lua_cocos2dx_audioengine_AudioEngine_getProfile);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::AudioEngine).name();
g_luaType[typeName] = "cc.AudioEngine";
g_typeCast["AudioEngine"] = "cc.AudioEngine";
std::string typeName = typeid(cocos2d::experimental::AudioEngine).name();
g_luaType[typeName] = "ccexp.AudioEngine";
g_typeCast["AudioEngine"] = "ccexp.AudioEngine";
return 1;
}
TOLUA_API int register_all_cocos2dx_audioengine(lua_State* tolua_S)
{
tolua_open(tolua_S);
tolua_module(tolua_S,"cc",0);
tolua_beginmodule(tolua_S,"cc");
tolua_module(tolua_S,"ccexp",0);
tolua_beginmodule(tolua_S,"ccexp");
lua_register_cocos2dx_audioengine_AudioProfile(tolua_S);
lua_register_cocos2dx_audioengine_AudioEngine(tolua_S);

View File

@ -5304,6 +5304,50 @@ int lua_cocos2dx_ui_Button_setScale9Enabled(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_ui_Button_getTitleRenderer(lua_State* tolua_S)
{
int argc = 0;
cocos2d::ui::Button* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccui.Button",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::ui::Button*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Button_getTitleRenderer'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
cocos2d::Label* ret = cobj->getTitleRenderer();
object_to_luaval<cocos2d::Label>(tolua_S, "cc.Label",(cocos2d::Label*)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Button:getTitleRenderer",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Button_getTitleRenderer'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_ui_Button_getZoomScale(lua_State* tolua_S)
{
int argc = 0;
@ -6514,6 +6558,7 @@ int lua_register_cocos2dx_ui_Button(lua_State* tolua_S)
tolua_function(tolua_S,"getTitleText",lua_cocos2dx_ui_Button_getTitleText);
tolua_function(tolua_S,"setTitleFontSize",lua_cocos2dx_ui_Button_setTitleFontSize);
tolua_function(tolua_S,"setScale9Enabled",lua_cocos2dx_ui_Button_setScale9Enabled);
tolua_function(tolua_S,"getTitleRenderer",lua_cocos2dx_ui_Button_getTitleRenderer);
tolua_function(tolua_S,"getZoomScale",lua_cocos2dx_ui_Button_getZoomScale);
tolua_function(tolua_S,"getCapInsetsDisabledRenderer",lua_cocos2dx_ui_Button_getCapInsetsDisabledRenderer);
tolua_function(tolua_S,"setTitleColor",lua_cocos2dx_ui_Button_setTitleColor);

View File

@ -477,6 +477,7 @@ int register_all_cocos2dx_ui(lua_State* tolua_S);
#endif // __cocos2dx_ui_h__

View File

@ -31,14 +31,14 @@
static int lua_get_AudioProfile_name(lua_State* L)
{
cocos2d::AudioProfile* self = nullptr;
cocos2d::experimental::AudioProfile* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"cc.AudioProfile",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertype(L,1,"ccexp.AudioProfile",0,&tolua_err)) goto tolua_lerror;
#endif
self = (cocos2d::AudioProfile*) tolua_tousertype(L,1,0);
self = (cocos2d::experimental::AudioProfile*) tolua_tousertype(L,1,0);
#if COCOS2D_DEBUG >= 1
if (nullptr == self)
{
@ -60,14 +60,14 @@ tolua_lerror:
static int lua_set_AudioProfile_name(lua_State* L)
{
int argc = 0;
cocos2d::AudioProfile* self = nullptr;
cocos2d::experimental::AudioProfile* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"cc.AudioProfile",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertype(L,1,"ccexp.AudioProfile",0,&tolua_err)) goto tolua_lerror;
#endif
self = (cocos2d::AudioProfile*) tolua_tousertype(L,1,0);
self = (cocos2d::experimental::AudioProfile*) tolua_tousertype(L,1,0);
#if COCOS2D_DEBUG >= 1
if (nullptr == self)
{
@ -99,14 +99,14 @@ tolua_lerror:
static int lua_get_AudioProfile_maxInstances(lua_State* L)
{
cocos2d::AudioProfile* self = nullptr;
cocos2d::experimental::AudioProfile* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"cc.AudioProfile",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertype(L,1,"ccexp.AudioProfile",0,&tolua_err)) goto tolua_lerror;
#endif
self = (cocos2d::AudioProfile*) tolua_tousertype(L,1,0);
self = (cocos2d::experimental::AudioProfile*) tolua_tousertype(L,1,0);
#if COCOS2D_DEBUG >= 1
if (nullptr == self)
{
@ -128,14 +128,14 @@ tolua_lerror:
static int lua_set_AudioProfile_maxInstances(lua_State* L)
{
int argc = 0;
cocos2d::AudioProfile* self = nullptr;
cocos2d::experimental::AudioProfile* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"cc.AudioProfile",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertype(L,1,"ccexp.AudioProfile",0,&tolua_err)) goto tolua_lerror;
#endif
self = (cocos2d::AudioProfile*) tolua_tousertype(L,1,0);
self = (cocos2d::experimental::AudioProfile*) tolua_tousertype(L,1,0);
#if COCOS2D_DEBUG >= 1
if (nullptr == self)
{
@ -167,14 +167,14 @@ tolua_lerror:
static int lua_get_AudioProfile_minDelay(lua_State* L)
{
cocos2d::AudioProfile* self = nullptr;
cocos2d::experimental::AudioProfile* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"cc.AudioProfile",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertype(L,1,"ccexp.AudioProfile",0,&tolua_err)) goto tolua_lerror;
#endif
self = (cocos2d::AudioProfile*) tolua_tousertype(L,1,0);
self = (cocos2d::experimental::AudioProfile*) tolua_tousertype(L,1,0);
#if COCOS2D_DEBUG >= 1
if (nullptr == self)
{
@ -196,14 +196,14 @@ tolua_lerror:
static int lua_set_AudioProfile_minDelay(lua_State* L)
{
int argc = 0;
cocos2d::AudioProfile* self = nullptr;
cocos2d::experimental::AudioProfile* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"cc.AudioProfile",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertype(L,1,"ccexp.AudioProfile",0,&tolua_err)) goto tolua_lerror;
#endif
self = (cocos2d::AudioProfile*) tolua_tousertype(L,1,0);
self = (cocos2d::experimental::AudioProfile*) tolua_tousertype(L,1,0);
#if COCOS2D_DEBUG >= 1
if (nullptr == self)
{
@ -243,7 +243,7 @@ int lua_cocos2dx_audioengine_AudioEngine_setFinishCallback(lua_State* tolua_S)
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AudioEngine",0,&tolua_err)) goto tolua_lerror;
if (!tolua_isusertable(tolua_S,1,"ccexp.AudioEngine",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
@ -251,7 +251,7 @@ int lua_cocos2dx_audioengine_AudioEngine_setFinishCallback(lua_State* tolua_S)
if (argc == 2)
{
int arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.AudioEngine:setFinishCallback");
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccexp.AudioEngine:setFinishCallback");
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(tolua_S,3,"LUA_FUNCTION",0,&tolua_err))
@ -262,7 +262,7 @@ int lua_cocos2dx_audioengine_AudioEngine_setFinishCallback(lua_State* tolua_S)
LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S,3,0));
cocos2d::AudioEngine::setFinishCallback(arg0, [handler](int audioID, std::string filePath){
cocos2d::experimental::AudioEngine::setFinishCallback(arg0, [handler](int audioID, std::string filePath){
LuaStack* stack = LuaEngine::getInstance()->getLuaStack();
stack->pushInt(audioID);
@ -275,7 +275,7 @@ int lua_cocos2dx_audioengine_AudioEngine_setFinishCallback(lua_State* tolua_S)
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AudioEngine:setFinishCallback",argc, 2);
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.AudioEngine:setFinishCallback",argc, 2);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
@ -292,7 +292,7 @@ int register_audioengine_module(lua_State* L)
register_all_cocos2dx_audioengine(L);
if (L)
{
lua_pushstring(L, "cc.AudioProfile");
lua_pushstring(L, "ccexp.AudioProfile");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
@ -302,7 +302,7 @@ int register_audioengine_module(lua_State* L)
}
lua_pop(L, 1);
lua_pushstring(L, "cc.AudioEngine");
lua_pushstring(L, "ccexp.AudioEngine");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{

View File

@ -691,6 +691,11 @@ void Button::setTitleFontName(const std::string& fontName)
_fontName = fontName;
}
Label* Button::getTitleRenderer()const
{
return _titleRenderer;
}
const std::string& Button::getTitleFontName() const
{
return _fontName;

View File

@ -175,6 +175,12 @@ public:
//override "getVirtualRenderer" method of widget.
virtual Node* getVirtualRenderer() override;
/**
* Return the inner title renderer of Button
* @since v3.3
*/
Label* getTitleRenderer()const;
/**
* Returns the "class name" of widget.
*/
@ -190,10 +196,12 @@ public:
const std::string& getTitleFontName() const;
/** When user pressed the button, the button will zoom to a scale.
* The final scale of the button equals (button original scale + _zoomScale)
* @since v3.3
*/
void setZoomScale(float scale);
/**
* @brief Return a zoom scale
* @since v3.3
*/
float getZoomScale()const;

View File

@ -367,7 +367,6 @@ void Layout::drawFullScreenQuadClearStencil()
};
auto glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_U_COLOR);
glProgram->retain();
int colorLocation = glProgram->getUniformLocation("u_color");
CHECK_GL_ERROR_DEBUG();
@ -380,14 +379,8 @@ void Layout::drawFullScreenQuadClearStencil()
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );
GLuint vbo;
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vec2)*4, vertices, GL_STREAM_DRAW);
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glBindBuffer(GL_ARRAY_BUFFER, 0);
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 4);

View File

@ -510,14 +510,28 @@ public:
int getActionTag()const;
/**
*@brief Allow widget touch events to propagate to its parents. Set false will disable propagation
* @brief Allow widget touch events to propagate to its parents. Set false will disable propagation
* @since v3.3
*/
void setPropagateTouchEvents(bool isPropagate);
bool isPropagateTouchEvents()const;
/**
*@brief Specify widget to swallow touches or not
* Return whether the widget is propagate touch events to its parents or not
* @since v3.3
*/
bool isPropagateTouchEvents()const;
/**
* @brief Specify widget to swallow touches or not
* @since v3.3
*/
void setSwallowTouches(bool swallow);
/**
* Return whether the widget is swallowing touch or not
* @since v3.3
*/
bool isSwallowTouches()const;
/**

View File

@ -23,7 +23,7 @@
- [AABB, OBB and Ray](#user-content-aabb-obb-and-ray)
- [BillBoard](#user-content-billboard)
- [Primitive](#user-content-primitive)
- [Triangle command](#user-content-triangle-command)
- [Triangles command](#user-content-triangles-command)
- [WebView](#user-content-webview)
- [New audio](#user-content-new-audio)
- [Only two libraries left](#user-content-only-two-libraries-left)
@ -302,9 +302,18 @@ Primitive supports three typs of primitives (POINTS, LINES, TRIANGLES), vertex a
2. Batching is not supported.
## Triangle command
## Triangles command
TBD
We have enhanced auto batching feature by introduce `TrianglesCommand`, the rendering of the `Triangles` can be auto batched. Now if we have anything which can be rendered by `Triangles`, we can use `TrianglesCommand` or inherit from `TrianglesCommand` to take use of auto batching feature and gain rendering improvements. The `QuadCommand`, which is used for `Quad` rendering, is a good example of inheriting from `TrianglesCommand`.
The step to use Triangle Command is very simple.
```
Triangles trs{verts, indices, vertCount, indexCount};
command->init(globalZOrder,textureID, glProgramState,blend,trs,matrix);
renderer->addCommand(command);
```
To improve performance, `Triangles` will hold a weak reference to the vertices and indices data to be rendered, which is the same like `QuadCommand`. The userer should not release any rendered data before the `Command` is executed by `Renderer`.
## WebView
WebView is an new widget type which allows you to display web content inside Cocos2D-X. We only provide iOS and Android implementation currently, more platform might be added in the future.
@ -357,7 +366,7 @@ The difference compared to old audio engine
* all functions are static, which means you can more easy to invoke function, such as `Audio::play2d()`
* there is only one method `play2d()` to play music or effect
* should use `Audio::getState()` to determine an audio is playing, paused
* its class name is `cocos2d::AudioEngine` in c++, and its module name is `cc.AudioEngine` in lua-binding
* its class name is `cocos2d::experimental::AudioEngine` in c++, and its module name is `ccexp.AudioEngine` in lua-binding
* there is not preload function, you can play an audio immediately
Full test case please refer to `tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.cpp`.

View File

@ -686,7 +686,6 @@ void RawStencilBufferTest::onBeforeDrawClip(int planeIndex, const Vec2& pt)
};
auto glProgram= GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_U_COLOR);
glProgram->retain();
int colorLocation = glProgram->getUniformLocation("u_color");
CHECK_GL_ERROR_DEBUG();
@ -699,14 +698,8 @@ void RawStencilBufferTest::onBeforeDrawClip(int planeIndex, const Vec2& pt)
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );
GLuint vbo;
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vec2)*4, vertices, GL_STREAM_DRAW);
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glBindBuffer(GL_ARRAY_BUFFER, 0);
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 4);
}
@ -724,7 +717,6 @@ void RawStencilBufferTest::onBeforeDrawSprite(int planeIndex, const Vec2& pt)
};
auto glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_U_COLOR);
glProgram->retain();
int colorLocation = glProgram->getUniformLocation("u_color");
CHECK_GL_ERROR_DEBUG();
@ -736,14 +728,8 @@ void RawStencilBufferTest::onBeforeDrawSprite(int planeIndex, const Vec2& pt)
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );
GLuint vbo;
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vec2)*4, vertices, GL_STREAM_DRAW);
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glBindBuffer(GL_ARRAY_BUFFER, 0);
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 4);
}
@ -931,7 +917,6 @@ void RawStencilBufferTest6::setupStencilForClippingOnPlane(GLint plane)
};
auto glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_U_COLOR);
glProgram->retain();
int colorLocation = glProgram->getUniformLocation("u_color");
CHECK_GL_ERROR_DEBUG();
@ -944,14 +929,8 @@ void RawStencilBufferTest6::setupStencilForClippingOnPlane(GLint plane)
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );
GLuint vbo;
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vec2)*4, vertices, GL_STREAM_DRAW);
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glBindBuffer(GL_ARRAY_BUFFER, 0);
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 4);

View File

@ -25,7 +25,9 @@
#include "NewAudioEngineTest.h"
#include "ui/CocosGUI.h"
using namespace cocos2d;
using namespace cocos2d::ui;
using namespace cocos2d::experimental;
namespace {
@ -166,7 +168,7 @@ Layer* restartAction()
bool _enabled;
};
class SliderEx : public ui::Slider
class SliderEx : public Slider
{
public:
enum class TouchEvent

View File

@ -111,7 +111,7 @@ public:
private:
static const int FILE_COUNT = 4;
std::string _files[FILE_COUNT];
AudioProfile _audioProfile;
cocos2d::experimental::AudioProfile _audioProfile;
int _audioCount;
Label* _showLabel;

View File

@ -218,7 +218,7 @@ void SchedulerPauseResumeAll::onEnter()
scheduleUpdate();
schedule(schedule_selector(SchedulerPauseResumeAll::tick1), 0.5f);
schedule(schedule_selector(SchedulerPauseResumeAll::tick2), 1.0f);
schedule(schedule_selector(SchedulerPauseResumeAll::pause), 3.0f, false, 0);
scheduleOnce(schedule_selector(SchedulerPauseResumeAll::pause), 3.0f);
}
void SchedulerPauseResumeAll::update(float delta)
@ -253,11 +253,20 @@ void SchedulerPauseResumeAll::pause(float dt)
// should have only 2 items: ActionManager, self
CCASSERT(_pausedTargets.size() == 2, "Error: pausedTargets should have only 2 items");
unschedule(schedule_selector(SchedulerPauseResumeAll::tick1));
unschedule(schedule_selector(SchedulerPauseResumeAll::tick2));
resume();
scheduleOnce(schedule_selector(SchedulerPauseResumeAll::resume), 2.0f);
}
void SchedulerPauseResumeAll::resume(float dt)
{
log("Resuming");
schedule(schedule_selector(SchedulerPauseResumeAll::tick1), 0.5f);
schedule(schedule_selector(SchedulerPauseResumeAll::tick2), 1.0f);
auto director = Director::getInstance();
director->getScheduler()->resumeTargets(_pausedTargets);
_pausedTargets.clear();

View File

@ -89,7 +89,7 @@ g_guisTests[] =
UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
sceneManager->setCurrentUISceneId(kUIButtonTest);
sceneManager->setMinUISceneId(kUIButtonTest);
sceneManager->setMaxUISceneId(kUIButtonIgnoreContentSizeTest);
sceneManager->setMaxUISceneId(kUIButtonTitleEffectTest);
Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(scene);
}

View File

@ -712,3 +712,67 @@ bool UIButtonIgnoreContentSizeTest::init()
return false;
}
// UIButtonTitleEffectTest
UIButtonTitleEffectTest::UIButtonTitleEffectTest()
: _displayValueLabel(nullptr)
{
}
UIButtonTitleEffectTest::~UIButtonTitleEffectTest()
{
}
bool UIButtonTitleEffectTest::init()
{
if (UIScene::init())
{
Size widgetSize = _widget->getContentSize();
// Add a label in which the button events will be displayed
_displayValueLabel = Text::create("Button Title Effect", "fonts/Marker Felt.ttf",32);
_displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
_displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + 20));
_uiLayer->addChild(_displayValueLabel);
// Add the alert
Text* alert = Text::create("Button","fonts/Marker Felt.ttf",30);
alert->setColor(Color3B(159, 168, 176));
alert->setPosition(Vec2(widgetSize.width / 2.0f,
widgetSize.height / 2.0f - alert->getContentSize().height * 1.75f));
_uiLayer->addChild(alert);
// Create the button
auto button = Button::create("cocosui/animationbuttonnormal.png",
"cocosui/animationbuttonpressed.png");
button->setNormalizedPosition(Vec2(0.3, 0.5));
button->setTitleText("PLAY GAME");
button->setTitleFontName("fonts/Marker Felt.ttf");
button->setZoomScale(0.3);
button->setScale(2.0);
button->setPressedActionEnabled(true);
Label *title = button->getTitleRenderer();
button->setTitleColor(Color3B::RED);
title->enableShadow(Color4B::BLACK,Size(2,-2));
_uiLayer->addChild(button);
// Create the button
auto button2 = Button::create("cocosui/animationbuttonnormal.png",
"cocosui/animationbuttonpressed.png");
button2->setNormalizedPosition(Vec2(0.8, 0.5));
button2->setTitleText("PLAY GAME");
auto title2 = button2->getTitleRenderer();
title2->enableOutline(Color4B::GREEN, 3);
_uiLayer->addChild(button2);
return true;
}
return false;
}

View File

@ -141,4 +141,16 @@ protected:
UI_SCENE_CREATE_FUNC(UIButtonIgnoreContentSizeTest)
Text* _displayValueLabel;
};
class UIButtonTitleEffectTest : public UIScene
{
public:
UIButtonTitleEffectTest();
~UIButtonTitleEffectTest();
bool init();
protected:
UI_SCENE_CREATE_FUNC(UIButtonTitleEffectTest)
Text* _displayValueLabel;
};
#endif /* defined(__TestCpp__UIButtonTest__) */

View File

@ -41,6 +41,7 @@ static const char* s_testArray[] =
"UIButtonTestZoomScale",
"UIButtonTextOnly",
"UIButtonIgnoreContentSizeTest",
"UIButtonTitleEffectTest",
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
"UIEditBoxTest",
@ -202,7 +203,8 @@ Scene *UISceneManager::currentUIScene()
return UIButtonTextOnly::sceneWithTitle(s_testArray[_currentUISceneId]);
case kUIButtonIgnoreContentSizeTest:
return UIButtonIgnoreContentSizeTest::sceneWithTitle(s_testArray[_currentUISceneId]);
case kUIButtonTitleEffectTest:
return UIButtonTitleEffectTest::sceneWithTitle(s_testArray[_currentUISceneId]);
case kUICheckBoxTest:
return UICheckBoxTest::sceneWithTitle(s_testArray[_currentUISceneId]);

View File

@ -40,6 +40,7 @@ enum
kUIButtonTestZoomScale,
kUIButtonTextOnly,
kUIButtonIgnoreContentSizeTest,
kUIButtonTitleEffectTest,
kUIEditBoxTest,
kUICheckBoxTest,
kUISliderTest,

View File

@ -123,7 +123,7 @@ function AudioControlTest.create()
------playItem
local function playAudio(tag, sender)
if AudioControlTest._audioID == cc.AUDIO_INVAILD_ID then
AudioControlTest._audioID = cc.AudioEngine:play2d("background.mp3", AudioControlTest._loopEnabled, AudioControlTest._volume)
AudioControlTest._audioID = ccexp.AudioEngine:play2d("background.mp3", AudioControlTest._loopEnabled, AudioControlTest._volume)
if AudioControlTest._audioID ~= cc.AUDIO_INVAILD_ID then
AudioControlTest._playItem:setEnabled(false)
@ -133,7 +133,7 @@ function AudioControlTest.create()
AudioControlTest._playItem:setEnabled(true)
end
cc.AudioEngine:setFinishCallback(AudioControlTest._audioID,finishCallback)
ccexp.AudioEngine:setFinishCallback(AudioControlTest._audioID,finishCallback)
end
end
end
@ -145,7 +145,7 @@ function AudioControlTest.create()
------stopItem
local function stopAudio(tag, sender)
if AudioControlTest._audioID ~= cc.AUDIO_INVAILD_ID then
cc.AudioEngine:stop(AudioControlTest._audioID)
ccexp.AudioEngine:stop(AudioControlTest._audioID)
AudioControlTest._audioID = cc.AUDIO_INVAILD_ID
AudioControlTest._playItem:setEnabled(true)
end
@ -158,7 +158,7 @@ function AudioControlTest.create()
------pauseItem
local function pauseAudio(tag, sender)
if AudioControlTest._audioID ~= cc.AUDIO_INVAILD_ID then
cc.AudioEngine:pause(AudioControlTest._audioID)
ccexp.AudioEngine:pause(AudioControlTest._audioID)
end
end
@ -169,7 +169,7 @@ function AudioControlTest.create()
------resumeItem
local function resumeAudio(tag, sender)
if AudioControlTest._audioID ~= cc.AUDIO_INVAILD_ID then
cc.AudioEngine:resume(AudioControlTest._audioID)
ccexp.AudioEngine:resume(AudioControlTest._audioID)
end
end
@ -181,7 +181,7 @@ function AudioControlTest.create()
local function switchLoop(tag, sender)
AudioControlTest._loopEnabled = not AudioControlTest._loopEnabled
if AudioControlTest._audioID ~= cc.AUDIO_INVAILD_ID then
cc.AudioEngine:setLoop(AudioControlTest._audioID, AudioControlTest._loopEnabled)
ccexp.AudioEngine:setLoop(AudioControlTest._audioID, AudioControlTest._loopEnabled)
end
if AudioControlTest._loopEnabled then
AudioControlTest.loopItem:setString("disable-loop")
@ -196,7 +196,7 @@ function AudioControlTest.create()
------uncacheItem
local function uncache(tag, sender)
cc.AudioEngine:uncache("background.mp3")
ccexp.AudioEngine:uncache("background.mp3")
AudioControlTest._audioID = cc.AUDIO_INVAILD_ID
AudioControlTest._playItem:setEnabled(true)
end
@ -218,7 +218,7 @@ function AudioControlTest.create()
local function volumeSliderChangedEvent(sender,eventType)
AudioControlTest._volume = sender:getPercent() / 100.0
if AudioControlTest._audioID ~= cc.AUDIO_INVAILD_ID then
cc.AudioEngine:setVolume(AudioControlTest._audioID, AudioControlTest._volume)
ccexp.AudioEngine:setVolume(AudioControlTest._audioID, AudioControlTest._volume)
end
end
local volumeSlider = ccui.Slider:create()
@ -247,7 +247,7 @@ function AudioControlTest.create()
AudioControlTest._updateTimeSlider = false
else
if (AudioControlTest._audioID ~= cc.AUDIO_INVAILD_ID and AudioControlTest._duration ~= cc.AUDIO_TIME_UNKNOWN) then
cc.AudioEngine:setCurrentTime(AudioControlTest._audioID,AudioControlTest._duration * ratio)
ccexp.AudioEngine:setCurrentTime(AudioControlTest._audioID,AudioControlTest._duration * ratio)
end
AudioControlTest._updateTimeSlider = true
end
@ -261,10 +261,10 @@ function AudioControlTest.create()
local function step(dt)
if AudioControlTest._audioID ~= cc.AUDIO_INVAILD_ID then
if AudioControlTest._duration == cc.AUDIO_TIME_UNKNOWN then
AudioControlTest._duration = cc.AudioEngine:getDuration(AudioControlTest._audioID)
AudioControlTest._duration = ccexp.AudioEngine:getDuration(AudioControlTest._audioID)
end
if AudioControlTest._duration ~= cc.AUDIO_TIME_UNKNOWN then
local time = cc.AudioEngine:getCurrentTime(AudioControlTest._audioID)
local time = ccexp.AudioEngine:getCurrentTime(AudioControlTest._audioID)
AudioControlTest._timeRatio = time / AudioControlTest._duration
if AudioControlTest._updateTimeSlider then
AudioControlTest._timeSlider:setRatio(AudioControlTest._timeRatio)
@ -277,7 +277,7 @@ function AudioControlTest.create()
function onNodeEvent(tag)
if tag == "exit" then
cc.AudioEngine:stopAll()
ccexp.AudioEngine:stopAll()
end
end
layer:registerScriptHandler(onNodeEvent)
@ -302,7 +302,7 @@ function PlaySimultaneouslyTest.create()
local audioID = cc.AUDIO_INVAILD_ID
--for k, v in pairs(PlaySimultaneouslyTest.files) do
for index=1,10 do
audioID = cc.AudioEngine:play2d(PlaySimultaneouslyTest.files[index])
audioID = ccexp.AudioEngine:play2d(PlaySimultaneouslyTest.files[index])
if audioID ~= cc.AUDIO_INVAILD_ID then
PlaySimultaneouslyTest._playItem:setEnabled(false)
@ -315,7 +315,7 @@ function PlaySimultaneouslyTest.create()
end
end
cc.AudioEngine:setFinishCallback(audioID,finishCallback)
ccexp.AudioEngine:setFinishCallback(audioID,finishCallback)
end
end
end
@ -330,7 +330,7 @@ function PlaySimultaneouslyTest.create()
function onNodeEvent(tag)
if tag == "exit" then
cc.AudioEngine:stopAll()
ccexp.AudioEngine:stopAll()
end
end
layer:registerScriptHandler(onNodeEvent)
@ -358,7 +358,7 @@ function AudioProfileTest.create()
AudioProfileTest._files[3] = "background.wav"
AudioProfileTest._files[4] = "pew-pew-lei.wav"
AudioProfileTest._profile = cc.AudioProfile:new()
AudioProfileTest._profile = ccexp.AudioProfile:new()
AudioProfileTest._profile.name = "AudioProfileTest"
AudioProfileTest._profile.maxInstances = 3
AudioProfileTest._profile.minDelay = 1.0
@ -374,7 +374,7 @@ function AudioProfileTest.create()
local heightRatio = 0.7
for index=1,4 do
local function itemClickCallback(tag, sender)
local audioID = cc.AudioEngine:play2d(AudioProfileTest._files[tag],false,1.0,AudioProfileTest._profile)
local audioID = ccexp.AudioEngine:play2d(AudioProfileTest._files[tag],false,1.0,AudioProfileTest._profile)
if audioID ~= cc.AUDIO_INVAILD_ID then
AudioProfileTest._time = AudioProfileTest._minDelay
AudioProfileTest._audioCount = AudioProfileTest._audioCount + 1
@ -385,7 +385,7 @@ function AudioProfileTest.create()
AudioProfileTest._showLabel:setString(string.format("audio count:%d",AudioProfileTest._audioCount))
end
cc.AudioEngine:setFinishCallback(audioID,finishCallback)
ccexp.AudioEngine:setFinishCallback(audioID,finishCallback)
end
end
@ -431,7 +431,7 @@ function AudioProfileTest.create()
function onNodeEvent(tag)
if tag == "exit" then
cc.AudioEngine:stopAll()
ccexp.AudioEngine:stopAll()
end
end
layer:registerScriptHandler(onNodeEvent)
@ -452,10 +452,10 @@ function InvalidAudioFileTest.create()
local function playUnsupportedAudio(tag, sender)
local targetPlatform = cc.Application:getInstance():getTargetPlatform()
if (cc.PLATFORM_OS_IPHONE == targetPlatform or cc.PLATFORM_OS_IPAD == targetPlatform) then
cc.AudioEngine:play2d("background.ogg")
ccexp.AudioEngine:play2d("background.ogg")
end
if (cc.PLATFORM_OS_ANDROID == targetPlatform) then
cc.AudioEngine:play2d("background.caf")
ccexp.AudioEngine:play2d("background.caf")
end
end
@ -465,7 +465,7 @@ function InvalidAudioFileTest.create()
-- not-existent audio
local function playNotExistentAudio(tag, sender)
cc.AudioEngine:play2d("not-existent file.mp3")
ccexp.AudioEngine:play2d("not-existent file.mp3")
end
local playItem2 = cc.MenuItemFont:create("play not-existent file")
@ -490,7 +490,7 @@ function LargeAudioFileTest.create()
local layerSize = layer:getContentSize()
local function playAudio(tag, sender)
cc.AudioEngine:play2d("audio/Chee Lai(Arise).mp3")
ccexp.AudioEngine:play2d("audio/Chee Lai(Arise).mp3")
end
local playItem = cc.MenuItemFont:create("play large audio file")
@ -503,7 +503,7 @@ function LargeAudioFileTest.create()
function onNodeEvent(tag)
if tag == "exit" then
cc.AudioEngine:stopAll()
ccexp.AudioEngine:stopAll()
end
end
layer:registerScriptHandler(onNodeEvent)

@ -1 +1 @@
Subproject commit 0fd9899d8797dad6fd68d99b5dc41a5548219a97
Subproject commit af131ebbdefe0f34ac53f59f4ac7719879e56c5b

View File

@ -5,7 +5,7 @@ prefix = cocos2dx_audioengine
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = cc
target_namespace = ccexp
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/include
android_flags = -D_SIZE_T_DEFINED_