From 4d1ff40736b0020aa5e574ed1faeb3226b2764ff Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 15:39:28 +1000 Subject: [PATCH 01/19] Usage of long and unsigned long changed to platform independent fixed-sized types where appropriate. --- cocos/2d/CCFontAtlas.cpp | 4 +- cocos/2d/CCFontFNT.cpp | 12 +++--- cocos/2d/CCFontFNT.h | 2 +- cocos/2d/CCFontFreeType.cpp | 42 +++++++++---------- cocos/2d/CCFontFreeType.h | 6 +-- cocos/2d/CCParticleBatchNode.cpp | 4 +- cocos/3d/CCBundleReader.cpp | 2 +- cocos/3d/CCBundleReader.h | 2 +- cocos/audio/include/AudioDecoderWav.h | 2 +- cocos/audio/src/AudioDecoderMp3.cpp | 2 +- cocos/audio/src/AudioDecoderOgg.cpp | 2 +- cocos/audio/src/AudioDecoderWav.cpp | 2 +- cocos/base/CCDirector.cpp | 8 ++-- cocos/base/CCProfiling.cpp | 2 +- cocos/base/CCProfiling.h | 12 +++--- cocos/base/CCProperties.cpp | 4 +- cocos/base/CCProperties.h | 2 +- cocos/base/TGAlib.cpp | 10 ++--- cocos/base/TGAlib.h | 6 +-- cocos/base/ZipUtils.cpp | 14 +++---- cocos/base/ZipUtils.h | 4 +- cocos/base/ccUTF8.cpp | 2 +- cocos/base/ccUTF8.h | 2 +- cocos/base/ccUtils.cpp | 2 +- cocos/network/CCDownloader-curl.cpp | 8 ++-- cocos/network/CCDownloader.cpp | 2 +- cocos/network/HttpResponse.h | 2 +- cocos/platform/CCFileStream.h | 2 +- cocos/platform/CCGLView.cpp | 4 +- cocos/platform/CCImage.cpp | 4 +- cocos/platform/CCPosixFileStream.cpp | 10 ++--- cocos/platform/CCPosixFileStream.h | 2 +- .../Java_org_cocos2dx_lib_Cocos2dxHelper.cpp | 2 +- .../Java_org_cocos2dx_lib_Cocos2dxHelper.h | 2 +- cocos/platform/linux/CCApplication-linux.cpp | 8 ++-- cocos/platform/linux/CCApplication-linux.h | 2 +- cocos/platform/mac/CCApplication-mac.h | 2 +- cocos/platform/mac/CCApplication-mac.mm | 8 ++-- cocos/platform/win32/CCFileUtils-win32.cpp | 2 +- cocos/platform/win32/CCStdC-win32.cpp | 4 +- cocos/renderer/CCRenderState.cpp | 4 +- cocos/renderer/CCRenderState.h | 4 +- cocos/renderer/CCTexture2D.cpp | 2 +- cocos/renderer/CCTextureCache.cpp | 12 +++--- .../ui/UIEditBox/Mac/CCUIPasswordTextField.m | 4 +- .../UIEditBox/Mac/CCUISingleLineTextField.m | 4 +- cocos/ui/UIHelper.cpp | 2 +- cocos/ui/UITextField.cpp | 14 +++---- 48 files changed, 130 insertions(+), 130 deletions(-) diff --git a/cocos/2d/CCFontAtlas.cpp b/cocos/2d/CCFontAtlas.cpp index d311159279..d0ce7d5378 100644 --- a/cocos/2d/CCFontAtlas.cpp +++ b/cocos/2d/CCFontAtlas.cpp @@ -376,8 +376,8 @@ bool FontAtlas::prepareLetterDefinitions(const std::u32string& utf32Text) int adjustForDistanceMap = _letterPadding / 2; int adjustForExtend = _letterEdgeExtend / 2; - long bitmapWidth; - long bitmapHeight; + int32_t bitmapWidth; + int32_t bitmapHeight; int glyphHeight; Rect tempRect; FontLetterDefinition tempDef; diff --git a/cocos/2d/CCFontFNT.cpp b/cocos/2d/CCFontFNT.cpp index 8d1fc34d1e..04c76e6acb 100644 --- a/cocos/2d/CCFontFNT.cpp +++ b/cocos/2d/CCFontFNT.cpp @@ -229,13 +229,13 @@ std::set* BMFontConfiguration::parseConfigFile(const std::string& return validCharsString; } -std::set* BMFontConfiguration::parseBinaryConfigFile(unsigned char* pData, unsigned long size, const std::string& controlFile) +std::set* BMFontConfiguration::parseBinaryConfigFile(unsigned char* pData, uint32_t size, const std::string& controlFile) { /* based on http://www.angelcode.com/products/bmfont/doc/file_format.html file format */ std::set *validCharsString = new (std::nothrow) std::set(); - unsigned long remains = size; + uint32_t remains = size; CCASSERT(pData[3] == 3, "Only version 3 is supported"); @@ -324,9 +324,9 @@ std::set* BMFontConfiguration::parseBinaryConfigFile(unsigned char chnl 1 uint 19+c*20 */ - unsigned long count = blockSize / 20; + uint32_t count = blockSize / 20; - for (unsigned long i = 0; i < count; i++) + for (uint32_t i = 0; i < count; i++) { uint32_t charId = 0; memcpy(&charId, pData + (i * 20), 4); @@ -364,9 +364,9 @@ std::set* BMFontConfiguration::parseBinaryConfigFile(unsigned char amount 2 int 8+c*10 */ - unsigned long count = blockSize / 20; + uint32_t count = blockSize / 20; - for (unsigned long i = 0; i < count; i++) + for (uint32_t i = 0; i < count; i++) { uint32_t first = 0; memcpy(&first, pData + (i * 10), 4); uint32_t second = 0; memcpy(&second, pData + (i * 10) + 4, 4); diff --git a/cocos/2d/CCFontFNT.h b/cocos/2d/CCFontFNT.h index 83a07f1634..c41790d638 100644 --- a/cocos/2d/CCFontFNT.h +++ b/cocos/2d/CCFontFNT.h @@ -123,7 +123,7 @@ public: protected: virtual std::set* parseConfigFile(const std::string& controlFile); - virtual std::set* parseBinaryConfigFile(unsigned char* pData, unsigned long size, const std::string& controlFile); + virtual std::set* parseBinaryConfigFile(unsigned char* pData, uint32_t size, const std::string& controlFile); private: unsigned int parseCharacterDefinition(const char* line); diff --git a/cocos/2d/CCFontFreeType.cpp b/cocos/2d/CCFontFreeType.cpp index a1c2974c33..6cd186e85e 100644 --- a/cocos/2d/CCFontFreeType.cpp +++ b/cocos/2d/CCFontFreeType.cpp @@ -62,10 +62,10 @@ typedef struct _DataRef static std::unordered_map s_cacheFontData; // ------ freetype2 stream parsing support --- -static unsigned long ft_stream_read_callback(FT_Stream stream, - unsigned long offset, - unsigned char* buf, - unsigned long size) +static uint32_t ft_stream_read_callback(FT_Stream stream, + uint32_t offset, + unsigned char* buf, + uint32_t size) { auto fd = (FileStream*)stream->descriptor.pointer; if (!fd) @@ -388,8 +388,8 @@ const char* FontFreeType::getFontFamily() const } unsigned char* FontFreeType::getGlyphBitmap(uint64_t theChar, - long& outWidth, - long& outHeight, + int32_t& outWidth, + int32_t& outHeight, Rect& outRect, int& xAdvance) { @@ -543,8 +543,8 @@ unsigned char* FontFreeType::getGlyphBitmapWithOutline(uint64_t theChar, FT_BBox { FT_Outline* outline = &reinterpret_cast(glyph)->outline; FT_Glyph_Get_CBox(glyph, FT_GLYPH_BBOX_GRIDFIT, &bbox); - long width = (bbox.xMax - bbox.xMin) >> 6; - long rows = (bbox.yMax - bbox.yMin) >> 6; + int32_t width = (bbox.xMax - bbox.xMin) >> 6; + int32_t rows = (bbox.yMax - bbox.yMin) >> 6; FT_Bitmap bmp; bmp.buffer = new (std::nothrow) unsigned char[width * rows]; @@ -573,9 +573,9 @@ unsigned char* FontFreeType::getGlyphBitmapWithOutline(uint64_t theChar, FT_BBox return ret; } -unsigned char* makeDistanceMap(unsigned char* img, long width, long height) +unsigned char* makeDistanceMap(unsigned char* img, int32_t width, int32_t height) { - long pixelAmount = (width + 2 * FontFreeType::DistanceMapSpread) * (height + 2 * FontFreeType::DistanceMapSpread); + int32_t pixelAmount = (width + 2 * FontFreeType::DistanceMapSpread) * (height + 2 * FontFreeType::DistanceMapSpread); short* xdist = (short*)malloc(pixelAmount * sizeof(short)); short* ydist = (short*)malloc(pixelAmount * sizeof(short)); @@ -584,10 +584,10 @@ unsigned char* makeDistanceMap(unsigned char* img, long width, long height) double* data = (double*)calloc(pixelAmount, sizeof(double)); double* outside = (double*)calloc(pixelAmount, sizeof(double)); double* inside = (double*)calloc(pixelAmount, sizeof(double)); - long i, j; + int32_t i, j; // Convert img into double (data) rescale image levels between 0 and 1 - long outWidth = width + 2 * FontFreeType::DistanceMapSpread; + int32_t outWidth = width + 2 * FontFreeType::DistanceMapSpread; for (i = 0; i < width; ++i) { for (j = 0; j < height; ++j) @@ -660,8 +660,8 @@ void FontFreeType::renderCharAt(unsigned char* dest, int posX, int posY, unsigned char* bitmap, - long bitmapWidth, - long bitmapHeight) + int32_t bitmapWidth, + int32_t bitmapHeight) { int iX = posX; int iY = posY; @@ -673,11 +673,11 @@ void FontFreeType::renderCharAt(unsigned char* dest, bitmapWidth += 2 * DistanceMapSpread; bitmapHeight += 2 * DistanceMapSpread; - for (long y = 0; y < bitmapHeight; ++y) + for (int32_t y = 0; y < bitmapHeight; ++y) { - long bitmap_y = y * bitmapWidth; + int32_t bitmap_y = y * bitmapWidth; - for (long x = 0; x < bitmapWidth; ++x) + for (int32_t x = 0; x < bitmapWidth; ++x) { /* Dual channel 16-bit output (more complicated, but good precision and range) */ /*int index = (iX + ( iY * destSize )) * 3; @@ -700,9 +700,9 @@ void FontFreeType::renderCharAt(unsigned char* dest, else if (_outlineSize > 0) { unsigned char tempChar; - for (long y = 0; y < bitmapHeight; ++y) + for (int32_t y = 0; y < bitmapHeight; ++y) { - long bitmap_y = y * bitmapWidth; + int32_t bitmap_y = y * bitmapWidth; for (int x = 0; x < bitmapWidth; ++x) { @@ -721,9 +721,9 @@ void FontFreeType::renderCharAt(unsigned char* dest, } else { - for (long y = 0; y < bitmapHeight; ++y) + for (int32_t y = 0; y < bitmapHeight; ++y) { - long bitmap_y = y * bitmapWidth; + int32_t bitmap_y = y * bitmapWidth; for (int x = 0; x < bitmapWidth; ++x) { diff --git a/cocos/2d/CCFontFreeType.h b/cocos/2d/CCFontFreeType.h index 4f181803a3..909fdd842a 100644 --- a/cocos/2d/CCFontFreeType.h +++ b/cocos/2d/CCFontFreeType.h @@ -86,14 +86,14 @@ public: int posX, int posY, unsigned char* bitmap, - long bitmapWidth, - long bitmapHeight); + int32_t bitmapWidth, + int32_t bitmapHeight); FT_Encoding getEncoding() const { return _encoding; } int* getHorizontalKerningForTextUTF32(const std::u32string& text, int& outNumLetters) const override; - unsigned char* getGlyphBitmap(uint64_t theChar, long& outWidth, long& outHeight, Rect& outRect, int& xAdvance); + unsigned char* getGlyphBitmap(uint64_t theChar, int32_t& outWidth, int32_t& outHeight, Rect& outRect, int& xAdvance); int getFontAscender() const; const char* getFontFamily() const; diff --git a/cocos/2d/CCParticleBatchNode.cpp b/cocos/2d/CCParticleBatchNode.cpp index 99c103d4fd..6da5f0b99d 100644 --- a/cocos/2d/CCParticleBatchNode.cpp +++ b/cocos/2d/CCParticleBatchNode.cpp @@ -466,8 +466,8 @@ void ParticleBatchNode::draw(Renderer* renderer, const Mat4 & transform, uint32_ void ParticleBatchNode::increaseAtlasCapacityTo(ssize_t quantity) { CCLOG("cocos2d: ParticleBatchNode: resizing TextureAtlas capacity from [%lu] to [%lu].", - (long)_textureAtlas->getCapacity(), - (long)quantity); + (int32_t)_textureAtlas->getCapacity(), + (int32_t)quantity); if( ! _textureAtlas->resizeCapacity(quantity) ) { // serious problems diff --git a/cocos/3d/CCBundleReader.cpp b/cocos/3d/CCBundleReader.cpp index 3ac6ff1c5f..521b172e6f 100644 --- a/cocos/3d/CCBundleReader.cpp +++ b/cocos/3d/CCBundleReader.cpp @@ -127,7 +127,7 @@ ssize_t BundleReader::tell() return _position; } -bool BundleReader::seek(long int offset, int origin) +bool BundleReader::seek(int32_t offset, int origin) { if (!_buffer) return false; diff --git a/cocos/3d/CCBundleReader.h b/cocos/3d/CCBundleReader.h index 373de09bdd..7f12e9b3a9 100644 --- a/cocos/3d/CCBundleReader.h +++ b/cocos/3d/CCBundleReader.h @@ -100,7 +100,7 @@ public: /** * Sets the position of the file pointer. */ - bool seek(long int offset, int origin); + bool seek(int32_t offset, int origin); /** * Sets the file pointer at the start of the file. diff --git a/cocos/audio/include/AudioDecoderWav.h b/cocos/audio/include/AudioDecoderWav.h index 40d00a7334..ae62e4d485 100644 --- a/cocos/audio/include/AudioDecoderWav.h +++ b/cocos/audio/include/AudioDecoderWav.h @@ -36,7 +36,7 @@ #if !defined(_WIN32) typedef struct _GUID { - unsigned long Data1; + uint32_t Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[8]; diff --git a/cocos/audio/src/AudioDecoderMp3.cpp b/cocos/audio/src/AudioDecoderMp3.cpp index a35f125a50..c37f7b5e27 100644 --- a/cocos/audio/src/AudioDecoderMp3.cpp +++ b/cocos/audio/src/AudioDecoderMp3.cpp @@ -169,7 +169,7 @@ namespace cocos2d { return false; #else - long rate = 0; + int32_t rate = 0; int error = MPG123_OK; int mp3Encoding = 0; int channel = 0; diff --git a/cocos/audio/src/AudioDecoderOgg.cpp b/cocos/audio/src/AudioDecoderOgg.cpp index 6557fb3cbd..292c94b4b8 100644 --- a/cocos/audio/src/AudioDecoderOgg.cpp +++ b/cocos/audio/src/AudioDecoderOgg.cpp @@ -113,7 +113,7 @@ namespace cocos2d { { int currentSection = 0; int bytesToRead = framesToBytes(framesToRead); - long bytesRead = ov_read(&_vf, pcmBuf, bytesToRead, 0, 2, 1, ¤tSection); + int32_t bytesRead = ov_read(&_vf, pcmBuf, bytesToRead, 0, 2, 1, ¤tSection); return bytesToFrames(bytesRead); } diff --git a/cocos/audio/src/AudioDecoderWav.cpp b/cocos/audio/src/AudioDecoderWav.cpp index b1d7acb40b..18049aea5a 100644 --- a/cocos/audio/src/AudioDecoderWav.cpp +++ b/cocos/audio/src/AudioDecoderWav.cpp @@ -230,7 +230,7 @@ namespace cocos2d { uint32_t AudioDecoderWav::read(uint32_t framesToRead, char* pcmBuf) { auto bytesToRead = framesToBytes(framesToRead); - long bytesRead = wav_read(&_wavf, pcmBuf, bytesToRead); + int32_t bytesRead = wav_read(&_wavf, pcmBuf, bytesToRead); return bytesToFrames(bytesRead); } diff --git a/cocos/base/CCDirector.cpp b/cocos/base/CCDirector.cpp index 99678deaae..88d4db02a4 100644 --- a/cocos/base/CCDirector.cpp +++ b/cocos/base/CCDirector.cpp @@ -1169,8 +1169,8 @@ void Director::showStats() _isStatusLabelUpdated = false; } - static unsigned long prevCalls = 0; - static unsigned long prevVerts = 0; + static uint32_t prevCalls = 0; + static uint32_t prevVerts = 0; ++_frames; _accumDt += _deltaTime; @@ -1190,8 +1190,8 @@ void Director::showStats() _frames = 0; } - auto currentCalls = (unsigned long)_renderer->getDrawnBatches(); - auto currentVerts = (unsigned long)_renderer->getDrawnVertices(); + auto currentCalls = (uint32_t)_renderer->getDrawnBatches(); + auto currentVerts = (uint32_t)_renderer->getDrawnVertices(); if( currentCalls != prevCalls ) { sprintf(buffer, "GL calls:%6lu", currentCalls); _drawnBatchesLabel->setString(buffer); diff --git a/cocos/base/CCProfiling.cpp b/cocos/base/CCProfiling.cpp index b4c2a4e553..d3324790b3 100644 --- a/cocos/base/CCProfiling.cpp +++ b/cocos/base/CCProfiling.cpp @@ -156,7 +156,7 @@ void ProfilingEndTimingBlock(const char *timerName) CCASSERT(timer, "CCProfilingTimer not found"); - long duration = static_cast(chrono::duration_cast(now - timer->_startTime).count()); + int32_t duration = static_cast(chrono::duration_cast(now - timer->_startTime).count()); timer->totalTime += duration; timer->_averageTime1 = (timer->_averageTime1 + duration) / 2.0f; diff --git a/cocos/base/CCProfiling.h b/cocos/base/CCProfiling.h index 5c18e4b494..1c69fb62bb 100644 --- a/cocos/base/CCProfiling.h +++ b/cocos/base/CCProfiling.h @@ -133,12 +133,12 @@ public: std::string _nameStr; std::chrono::high_resolution_clock::time_point _startTime; - long _averageTime1; - long _averageTime2; - long minTime; - long maxTime; - long totalTime; - long numberOfCalls; + int32_t _averageTime1; + int32_t _averageTime2; + int32_t minTime; + int32_t maxTime; + int32_t totalTime; + int32_t numberOfCalls; }; extern void CC_DLL ProfilingBeginTimingBlock(const char *timerName); diff --git a/cocos/base/CCProperties.cpp b/cocos/base/CCProperties.cpp index 93ec762ab0..8dbb70070e 100644 --- a/cocos/base/CCProperties.cpp +++ b/cocos/base/CCProperties.cpp @@ -895,12 +895,12 @@ float Properties::getFloat(const char* name) const return 0.0f; } -long Properties::getLong(const char* name) const +int32_t Properties::getLong(const char* name) const { const char* valueString = getString(name); if (valueString) { - long value; + int32_t value; int scanned; scanned = sscanf(valueString, "%ld", &value); if (scanned != 1) diff --git a/cocos/base/CCProperties.h b/cocos/base/CCProperties.h index 5813441f26..ccbe5c3959 100644 --- a/cocos/base/CCProperties.h +++ b/cocos/base/CCProperties.h @@ -337,7 +337,7 @@ public: * @return The value of the given property interpreted as a long. * Zero if the property does not exist or could not be scanned. */ - long getLong(const char* name = NULL) const; + int32_t getLong(const char* name = NULL) const; /** * Interpret the value of the given property as a Matrix. diff --git a/cocos/base/TGAlib.cpp b/cocos/base/TGAlib.cpp index e5d2b43c1a..5bd1e6183d 100644 --- a/cocos/base/TGAlib.cpp +++ b/cocos/base/TGAlib.cpp @@ -33,11 +33,11 @@ THE SOFTWARE. NS_CC_BEGIN -static bool tgaLoadRLEImageData(unsigned char* Buffer, unsigned long bufSize, tImageTGA *info); +static bool tgaLoadRLEImageData(unsigned char* Buffer, uint32_t bufSize, tImageTGA *info); void tgaFlipImage( tImageTGA *info ); // load the image header field from stream -bool tgaLoadHeader(unsigned char* buffer, unsigned long bufSize, tImageTGA *info) +bool tgaLoadHeader(unsigned char* buffer, uint32_t bufSize, tImageTGA *info) { bool ret = false; @@ -71,7 +71,7 @@ bool tgaLoadHeader(unsigned char* buffer, unsigned long bufSize, tImageTGA *info return ret; } -bool tgaLoadImageData(unsigned char *Buffer, unsigned long bufSize, tImageTGA *info) +bool tgaLoadImageData(unsigned char *Buffer, uint32_t bufSize, tImageTGA *info) { bool ret = false; @@ -108,7 +108,7 @@ bool tgaLoadImageData(unsigned char *Buffer, unsigned long bufSize, tImageTGA *i return ret; } -static bool tgaLoadRLEImageData(unsigned char* buffer, unsigned long bufSize, tImageTGA *info) +static bool tgaLoadRLEImageData(unsigned char* buffer, uint32_t bufSize, tImageTGA *info) { unsigned int mode,total,i, index = 0; unsigned char aux[4], runlength = 0; @@ -195,7 +195,7 @@ void tgaFlipImage( tImageTGA *info ) info->flipped = 0; } -tImageTGA* tgaLoadBuffer(unsigned char* buffer, long size) +tImageTGA* tgaLoadBuffer(unsigned char* buffer, int32_t size) { int mode,total; tImageTGA *info = nullptr; diff --git a/cocos/base/TGAlib.h b/cocos/base/TGAlib.h index 5047219f4c..3a258bbff1 100644 --- a/cocos/base/TGAlib.h +++ b/cocos/base/TGAlib.h @@ -56,13 +56,13 @@ typedef struct sImageTGA { } tImageTGA; /// load the image header fields. We only keep those that matter! -bool tgaLoadHeader(unsigned char *buffer, unsigned long bufSize, tImageTGA *info); +bool tgaLoadHeader(unsigned char *buffer, uint32_t bufSize, tImageTGA *info); /// loads the image pixels. You shouldn't call this function directly -bool tgaLoadImageData(unsigned char *buffer, unsigned long bufSize, tImageTGA *info); +bool tgaLoadImageData(unsigned char *buffer, uint32_t bufSize, tImageTGA *info); /// this is the function to call when we want to load an image buffer. -tImageTGA* tgaLoadBuffer(unsigned char* buffer, long size); +tImageTGA* tgaLoadBuffer(unsigned char* buffer, int32_t size); /// this is the function to call when we want to load an image tImageTGA * tgaLoad(const char *filename); diff --git a/cocos/base/ZipUtils.cpp b/cocos/base/ZipUtils.cpp index d279fae2cc..62fe9ca4a1 100644 --- a/cocos/base/ZipUtils.cpp +++ b/cocos/base/ZipUtils.cpp @@ -450,7 +450,7 @@ int ZipUtils::inflateCCZBuffer(const unsigned char *buffer, ssize_t bufferLen, u return -1; } - unsigned long destlen = len; + uint32_t destlen = len; size_t source = (size_t) buffer + sizeof(*header); int ret = uncompress(*out, &destlen, (Bytef*)source, bufferLen - sizeof(*header) ); @@ -528,7 +528,7 @@ struct ZipFilePrivate } // unzip overrides to support FileStream - static long ZipFile_tell_file_func(voidpf opaque, voidpf stream) { + static int32_t ZipFile_tell_file_func(voidpf opaque, voidpf stream) { if (stream == nullptr) return -1; @@ -537,13 +537,13 @@ struct ZipFilePrivate return fs->tell(); } - static long ZipFile_seek_file_func(voidpf opaque, voidpf stream, uint32_t offset, int origin) { + static int32_t ZipFile_seek_file_func(voidpf opaque, voidpf stream, uint32_t offset, int origin) { if (stream == nullptr) return -1; auto* fs = (FileStream*) stream; - return fs->seek((long) offset, origin); // must return 0 for success or -1 for error + return fs->seek((int32_t) offset, origin); // must return 0 for success or -1 for error } static voidpf ZipFile_open_file_func(voidpf opaque, const char* filename, int mode) { @@ -914,9 +914,9 @@ int ZipFile::zfread(ZipFileStream* zfs, void* buf, unsigned int size) return n; } -long ZipFile::zfseek(ZipFileStream* zfs, long offset, int origin) +int32_t ZipFile::zfseek(ZipFileStream* zfs, int32_t offset, int origin) { - long result = -1; + int32_t result = -1; if (zfs != nullptr) { switch (origin) { case SEEK_SET: @@ -926,7 +926,7 @@ long ZipFile::zfseek(ZipFileStream* zfs, long offset, int origin) result = zfs->offset + offset; break; case SEEK_END: - result = (long)zfs->entry->uncompressed_size + offset; + result = (int32_t)zfs->entry->uncompressed_size + offset; break; default:; } diff --git a/cocos/base/ZipUtils.h b/cocos/base/ZipUtils.h index 610c1f38ba..bd1f32ee63 100644 --- a/cocos/base/ZipUtils.h +++ b/cocos/base/ZipUtils.h @@ -215,7 +215,7 @@ namespace cocos2d struct ZipFileStream { ZipEntryInfo* entry; - long offset; + int32_t offset; }; /** * Zip file - reader helper class. @@ -301,7 +301,7 @@ namespace cocos2d */ bool zfopen(const std::string& fileName, ZipFileStream* zfs); int zfread(ZipFileStream* zfs, void* buf, unsigned int size); - long zfseek(ZipFileStream* zfs, long offset, int origin); + int32_t zfseek(ZipFileStream* zfs, int32_t offset, int origin); void zfclose(ZipFileStream* zfs); long long zfsize(ZipFileStream* zfs); diff --git a/cocos/base/ccUTF8.cpp b/cocos/base/ccUTF8.cpp index 4b715d740b..402a0617c9 100644 --- a/cocos/base/ccUTF8.cpp +++ b/cocos/base/ccUTF8.cpp @@ -351,7 +351,7 @@ std::vector getChar16VectorFromUTF16String(const std::u16string& utf16 return std::vector(utf16.begin(), utf16.end()); } -long getCharacterCountInUTF8String(const std::string& utf8) { +int32_t getCharacterCountInUTF8String(const std::string& utf8) { return getUTF8StringLength((const UTF8*) utf8.c_str()); } diff --git a/cocos/base/ccUTF8.h b/cocos/base/ccUTF8.h index f1fbb10742..b82d6bdaf4 100644 --- a/cocos/base/ccUTF8.h +++ b/cocos/base/ccUTF8.h @@ -198,7 +198,7 @@ CC_DLL bool isUnicodeNonBreaking(char32_t ch); * @param utf8 An UTF-8 encoded string. * @returns The length of the string in characters. */ -CC_DLL long getCharacterCountInUTF8String(const std::string& utf8); +CC_DLL int32_t getCharacterCountInUTF8String(const std::string& utf8); /** * @brief Gets the index of the last character that is not equal to the character given. diff --git a/cocos/base/ccUtils.cpp b/cocos/base/ccUtils.cpp index 9427357393..30e0eeee93 100644 --- a/cocos/base/ccUtils.cpp +++ b/cocos/base/ccUtils.cpp @@ -636,7 +636,7 @@ std::vector parseIntegerList(const std::string &intsString) { const char *cStr = intsString.c_str(); char *endptr; - for (long int i = strtol(cStr, &endptr, 10); endptr != cStr; i = strtol(cStr, &endptr, 10)) { + for (int32_t i = strtol(cStr, &endptr, 10); endptr != cStr; i = strtol(cStr, &endptr, 10)) { if (errno == ERANGE) { errno = 0; CCLOGWARN("%s contains out of range integers", intsString.c_str()); diff --git a/cocos/network/CCDownloader-curl.cpp b/cocos/network/CCDownloader-curl.cpp index a959be9b89..c28ae86a79 100644 --- a/cocos/network/CCDownloader-curl.cpp +++ b/cocos/network/CCDownloader-curl.cpp @@ -483,8 +483,8 @@ private: curl_easy_setopt(handle, CURLOPT_CONNECTTIMEOUT, hints.timeoutInSeconds); } - static const long LOW_SPEED_LIMIT = 1; - static const long LOW_SPEED_TIME = 10; + static const int32_t LOW_SPEED_LIMIT = 1; + static const int32_t LOW_SPEED_TIME = 10; curl_easy_setopt(handle, CURLOPT_LOW_SPEED_LIMIT, LOW_SPEED_LIMIT); curl_easy_setopt(handle, CURLOPT_LOW_SPEED_TIME, LOW_SPEED_TIME); @@ -506,7 +506,7 @@ private: bool _getHeaderInfoProc(CURL* handle, DownloadTaskCURL* coTask) { CURLcode rc = CURLE_OK; do { - long httpResponseCode = 0; + int32_t httpResponseCode = 0; rc = curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &httpResponseCode); if (CURLE_OK != rc) { break; @@ -581,7 +581,7 @@ private: if (runningHandles) { // get timeout setting from multi-handle - long timeoutMS = -1; + int32_t timeoutMS = -1; curl_multi_timeout(curlmHandle, &timeoutMS); if (timeoutMS < 0) { diff --git a/cocos/network/CCDownloader.cpp b/cocos/network/CCDownloader.cpp index 81a032c64f..73a7cdf36c 100644 --- a/cocos/network/CCDownloader.cpp +++ b/cocos/network/CCDownloader.cpp @@ -141,7 +141,7 @@ std::shared_ptr Downloader::createDownloadFileTask(const std::stri //{ // // Find file name and file extension // std::string filename; -// unsigned long found = srcUrl.find_last_of("/\\"); +// unsigned int32_t found = srcUrl.find_last_of("/\\"); // if (found != std::string::npos) // filename = srcUrl.substr(found+1); // return filename; diff --git a/cocos/network/HttpResponse.h b/cocos/network/HttpResponse.h index 6baf3e356e..cc1febbf1f 100644 --- a/cocos/network/HttpResponse.h +++ b/cocos/network/HttpResponse.h @@ -122,7 +122,7 @@ public: * Get the http response code to judge whether response is successful or not. * I know that you want to see the _responseCode is 200. * If _responseCode is not 200, you should check the meaning for _responseCode by the net. - * @return long the value of _responseCode + * @return int32_t the value of _responseCode */ int getResponseCode() const { diff --git a/cocos/platform/CCFileStream.h b/cocos/platform/CCFileStream.h index 894f6579cc..017f364ec5 100644 --- a/cocos/platform/CCFileStream.h +++ b/cocos/platform/CCFileStream.h @@ -40,7 +40,7 @@ public: * @param origin SEEK_SET | SEEK_CUR | SEEK_END * @return 0 if successful, -1 if not */ - virtual long seek(int64_t offset, int origin) = 0; + virtual int seek(int64_t offset, int origin) = 0; /** * Read data from file stream diff --git a/cocos/platform/CCGLView.cpp b/cocos/platform/CCGLView.cpp index 5b79b2ce93..95968bf261 100644 --- a/cocos/platform/CCGLView.cpp +++ b/cocos/platform/CCGLView.cpp @@ -380,7 +380,7 @@ void GLView::handleTouchesMove(int num, intptr_t ids[], float xs[], float ys[], else { // It is error, should return. - CCLOG("Moving touches with id: %ld error", (long int)id); + CCLOG("Moving touches with id: %ld error", (int32_t)id); return; } } @@ -433,7 +433,7 @@ void GLView::handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num } else { - CCLOG("Ending touches with id: %ld error", static_cast(id)); + CCLOG("Ending touches with id: %ld error", static_cast(id)); return; } diff --git a/cocos/platform/CCImage.cpp b/cocos/platform/CCImage.cpp index 9d4aa56da9..da1e50d652 100644 --- a/cocos/platform/CCImage.cpp +++ b/cocos/platform/CCImage.cpp @@ -982,7 +982,7 @@ bool Image::initWithJpgData(uint8_t * data, ssize_t dataLen) struct MyErrorMgr jerr; /* libjpeg data structure for storing one row, that is, scanline of an image */ JSAMPROW row_pointer[1] = {0}; - unsigned long location = 0; + uint32_t location = 0; bool ret = false; do @@ -2319,7 +2319,7 @@ bool Image::saveImageToJPG(const std::string& filePath) CC_BREAK_IF(nullptr == outfile); unsigned char* outputBuffer = nullptr; - unsigned long outputSize = 0; + uint32_t outputSize = 0; jpeg_mem_dest(&cinfo, &outputBuffer, &outputSize); cinfo.image_width = _width; /* image width and height, in pixels */ diff --git a/cocos/platform/CCPosixFileStream.cpp b/cocos/platform/CCPosixFileStream.cpp index 8e25bfa278..cfff079c1a 100644 --- a/cocos/platform/CCPosixFileStream.cpp +++ b/cocos/platform/CCPosixFileStream.cpp @@ -13,7 +13,7 @@ NS_CC_BEGIN struct PXIoF { int(*read)(PXFileHandle& handle, void*, unsigned int); - long(*seek)(PXFileHandle& handle, long, int); + off_t(*seek)(PXFileHandle& handle, off_t, int); int(*close)(PXFileHandle& handle); long long(*size)(PXFileHandle& handle); }; @@ -41,7 +41,7 @@ static int pfs_posix_open(const std::string& path, FileStream::Mode mode, PXFile // posix standard wrappers static int pfs_posix_read(PXFileHandle& handle, void* buf, unsigned int size) { return static_cast(posix_read(handle._fd, buf, size)); } -static long pfs_posix_seek(PXFileHandle& handle, long offst, int origin) { return posix_lseek(handle._fd, offst, origin); } +static off_t pfs_posix_seek(PXFileHandle& handle, off_t offst, int origin) { return posix_lseek(handle._fd, offst, origin); } static int pfs_posix_close(PXFileHandle& handle) { int fd = handle._fd; if (fd != -1) { @@ -74,7 +74,7 @@ static PXIoF pfs_posix_iof = { #if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID // android AssetManager wrappers static int pfs_asset_read(PXFileHandle& handle, void* buf, unsigned int size) { return AAsset_read(handle._asset, buf, size); } -static long pfs_asset_seek(PXFileHandle& handle, long offst, int origin) { return AAsset_seek(handle._asset, offst, origin); } +static off_t pfs_asset_seek(PXFileHandle& handle, off_t offst, int origin) { return AAsset_seek(handle._asset, offst, origin); } static int pfs_asset_close(PXFileHandle& handle) { if (handle._asset != nullptr) { AAsset_close(handle._asset); @@ -95,7 +95,7 @@ static PXIoF pfs_asset_iof = { // android obb static int pfs_obb_read(PXFileHandle& handle, void* buf, unsigned int size) { return FileUtilsAndroid::getObbFile()->zfread(&handle._zfs, buf, size); } -static long pfs_obb_seek(PXFileHandle& handle, long offset, int origin) { return FileUtilsAndroid::getObbFile()->zfseek(&handle._zfs, offset, origin); } +static off_t pfs_obb_seek(PXFileHandle& handle, off_t offset, int origin) { return FileUtilsAndroid::getObbFile()->zfseek(&handle._zfs, offset, origin); } static int pfs_obb_close(PXFileHandle& handle) { FileUtilsAndroid::getObbFile()->zfclose(&handle._zfs); return 0; @@ -178,7 +178,7 @@ int PosixFileStream::close() return internalClose(); } -long PosixFileStream::seek(int64_t offset, int origin) +int PosixFileStream::seek(int64_t offset, int origin) { const auto result = _iof->seek(_handle, static_cast(offset), origin); // this returns -1 for error, and resulting offset on success return result < 0 ? -1 : 0; // return 0 for success diff --git a/cocos/platform/CCPosixFileStream.h b/cocos/platform/CCPosixFileStream.h index 4a912ed556..f3624aaced 100644 --- a/cocos/platform/CCPosixFileStream.h +++ b/cocos/platform/CCPosixFileStream.h @@ -109,7 +109,7 @@ public: bool open(const std::string& path, FileStream::Mode mode) override; int close() override; - long seek(int64_t offset, int origin) override; + int seek(int64_t offset, int origin) override; int read(void* buf, unsigned int size) override; int write(const void* buf, unsigned int size) override; int64_t tell() override; diff --git a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp index 1997ae31eb..980df0589c 100644 --- a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp +++ b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp @@ -114,7 +114,7 @@ std::string getPackageNameJNI() { return JniHelper::callStaticStringMethod(className, "getCocos2dxPackageName"); } -int getObbAssetFileDescriptorJNI(const char* path, long* startOffset, long* size) { +int getObbAssetFileDescriptorJNI(const char* path, int64_t* startOffset, int64_t* size) { JniMethodInfo methodInfo; int fd = 0; diff --git a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h index ef146c2f60..f6d07dd443 100644 --- a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h +++ b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h @@ -32,7 +32,7 @@ typedef void (*EditTextCallback)(const char* text, void* ctx); extern const char * getApkPath(); extern std::string getPackageNameJNI(); -extern int getObbAssetFileDescriptorJNI(const char* path, long* startOffset, long* size); +extern int getObbAssetFileDescriptorJNI(const char* path, int64_t* startOffset, int64_t* size); extern void conversionEncodingJNI(const char* src, int byteSize, const char* fromCharset, char* dst, const char* newCharset); extern int getDeviceSampleRate(); diff --git a/cocos/platform/linux/CCApplication-linux.cpp b/cocos/platform/linux/CCApplication-linux.cpp index 630ecb7928..0753223b57 100644 --- a/cocos/platform/linux/CCApplication-linux.cpp +++ b/cocos/platform/linux/CCApplication-linux.cpp @@ -37,8 +37,8 @@ NS_CC_BEGIN // sharedApplication pointer Application * Application::sm_pSharedApplication = nullptr; -static long getCurrentMillSecond() { - long lLastTime; +static int32_t getCurrentMillSecond() { + int32_t lLastTime; struct timeval stCurrentTime; gettimeofday(&stCurrentTime,NULL); @@ -68,8 +68,8 @@ int Application::run() return 0; } - long lastTime = 0L; - long curTime = 0L; + int32_t lastTime = 0L; + int32_t curTime = 0L; auto director = Director::getInstance(); auto glview = director->getOpenGLView(); diff --git a/cocos/platform/linux/CCApplication-linux.h b/cocos/platform/linux/CCApplication-linux.h index 8e47460231..04dbabf84c 100644 --- a/cocos/platform/linux/CCApplication-linux.h +++ b/cocos/platform/linux/CCApplication-linux.h @@ -104,7 +104,7 @@ public: */ virtual Platform getTargetPlatform() override; protected: - long _animationInterval; //micro second + int32_t _animationInterval; //micro second std::string _resourceRootPath; static Application * sm_pSharedApplication; diff --git a/cocos/platform/mac/CCApplication-mac.h b/cocos/platform/mac/CCApplication-mac.h index ac5fe5790f..dc187e8082 100644 --- a/cocos/platform/mac/CCApplication-mac.h +++ b/cocos/platform/mac/CCApplication-mac.h @@ -99,7 +99,7 @@ public: protected: static Application * sm_pSharedApplication; - long _animationInterval; //micro second + int32_t _animationInterval; //micro second std::string _resourceRootPath; std::string _startupScriptFilename; }; diff --git a/cocos/platform/mac/CCApplication-mac.mm b/cocos/platform/mac/CCApplication-mac.mm index a38a8e69ff..e208ccd93b 100644 --- a/cocos/platform/mac/CCApplication-mac.mm +++ b/cocos/platform/mac/CCApplication-mac.mm @@ -36,9 +36,9 @@ THE SOFTWARE. NS_CC_BEGIN -static long getCurrentMillSecond() +static int32_t getCurrentMillSecond() { - long lLastTime = 0; + int32_t lLastTime = 0; struct timeval stCurrentTime; gettimeofday(&stCurrentTime,NULL); @@ -69,8 +69,8 @@ int Application::run() return 1; } - long lastTime = 0L; - long curTime = 0L; + int32_t lastTime = 0L; + int32_t curTime = 0L; auto director = Director::getInstance(); auto glview = director->getOpenGLView(); diff --git a/cocos/platform/win32/CCFileUtils-win32.cpp b/cocos/platform/win32/CCFileUtils-win32.cpp index 539cf42bad..7927407f65 100644 --- a/cocos/platform/win32/CCFileUtils-win32.cpp +++ b/cocos/platform/win32/CCFileUtils-win32.cpp @@ -107,7 +107,7 @@ bool FileUtilsWin32::init() bool FileUtilsWin32::isDirectoryExistInternal(const std::string& dirPath) const { - unsigned long fAttrib = GetFileAttributesW(ntcvt::from_chars(dirPath).c_str()); + uint32_t fAttrib = GetFileAttributesW(ntcvt::from_chars(dirPath).c_str()); return (fAttrib != INVALID_FILE_ATTRIBUTES && (fAttrib & FILE_ATTRIBUTE_DIRECTORY)); } diff --git a/cocos/platform/win32/CCStdC-win32.cpp b/cocos/platform/win32/CCStdC-win32.cpp index 68f46b3a05..7a061b18cd 100644 --- a/cocos/platform/win32/CCStdC-win32.cpp +++ b/cocos/platform/win32/CCStdC-win32.cpp @@ -36,8 +36,8 @@ int gettimeofday(struct timeval * val, struct timezone *) LARGE_INTEGER liTime, liFreq; QueryPerformanceFrequency( &liFreq ); QueryPerformanceCounter( &liTime ); - val->tv_sec = (long)( liTime.QuadPart / liFreq.QuadPart ); - val->tv_usec = (long)( liTime.QuadPart * 1000000.0 / liFreq.QuadPart - val->tv_sec * 1000000.0 ); + val->tv_sec = (int32_t)( liTime.QuadPart / liFreq.QuadPart ); + val->tv_usec = (int32_t)( liTime.QuadPart * 1000000.0 / liFreq.QuadPart - val->tv_sec * 1000000.0 ); } return 0; } diff --git a/cocos/renderer/CCRenderState.cpp b/cocos/renderer/CCRenderState.cpp index 6d881e0eb5..c80c9cba28 100644 --- a/cocos/renderer/CCRenderState.cpp +++ b/cocos/renderer/CCRenderState.cpp @@ -58,7 +58,7 @@ void RenderState::bindPass(Pass* pass, MeshCommand* command) //pipelineDescriptor.blendDescriptor.blendEnabled = true; // Get the combined modified state bits for our RenderState hierarchy. - long overrideBits = _state._modifiedBits; + int32_t overrideBits = _state._modifiedBits; overrideBits |= technique->getStateBlock()._modifiedBits; overrideBits |= material->getStateBlock()._modifiedBits; @@ -140,7 +140,7 @@ void RenderState::StateBlock::apply(PipelineDescriptor *pipelineDescriptor) } } -void RenderState::StateBlock::restoreUnmodifiedStates(long overrideBits, PipelineDescriptor *programState) +void RenderState::StateBlock::restoreUnmodifiedStates(int32_t overrideBits, PipelineDescriptor *programState) { auto renderer = Director::getInstance()->getRenderer(); auto &blend = programState->blendDescriptor; diff --git a/cocos/renderer/CCRenderState.h b/cocos/renderer/CCRenderState.h index 7de8c681e1..d7ed567f69 100644 --- a/cocos/renderer/CCRenderState.h +++ b/cocos/renderer/CCRenderState.h @@ -227,7 +227,7 @@ public: */ void apply(PipelineDescriptor *pipelineDescriptor); - static void restoreUnmodifiedStates(long flags, PipelineDescriptor *pipelineDescriptor); + static void restoreUnmodifiedStates(int32_t flags, PipelineDescriptor *pipelineDescriptor); bool _cullFaceEnabled = false; @@ -239,7 +239,7 @@ public: backend::BlendFactor _blendDst = backend::BlendFactor::ZERO; CullFaceSide _cullFaceSide = CullFaceSide::BACK; FrontFace _frontFace = FrontFace::COUNTER_CLOCK_WISE; - long _modifiedBits = 0L; + int32_t _modifiedBits = 0L; mutable uint32_t _hash; mutable bool _hashDirty; diff --git a/cocos/renderer/CCTexture2D.cpp b/cocos/renderer/CCTexture2D.cpp index af8bfeef98..1a0088eb8c 100644 --- a/cocos/renderer/CCTexture2D.cpp +++ b/cocos/renderer/CCTexture2D.cpp @@ -284,7 +284,7 @@ bool Texture2D::updateWithMipmaps(MipmapInfo* mipmaps, int mipmapsNum, backend:: auto& pfd = backend::PixelFormatUtils::getFormatDescriptor(pixelFormat); if (!pfd.bpp) { - CCLOG("cocos2d: WARNING: unsupported pixelformat: %lx", (unsigned long)pixelFormat); + CCLOG("cocos2d: WARNING: unsupported pixelformat: %lx", (uint32_t)pixelFormat); #ifdef CC_USE_METAL CCASSERT(false, "pixeformat not found in _pixelFormatInfoTables, register required!"); #endif diff --git a/cocos/renderer/CCTextureCache.cpp b/cocos/renderer/CCTextureCache.cpp index 7298da6763..58987d4a01 100644 --- a/cocos/renderer/CCTextureCache.cpp +++ b/cocos/renderer/CCTextureCache.cpp @@ -654,17 +654,17 @@ std::string TextureCache::getCachedTextureInfo() const count++; snprintf(buftmp, sizeof(buftmp) - 1, "\"%s\" rc=%lu id=%p %lu x %lu @ %ld bpp => %lu KB\n", texture.first.c_str(), - (long)tex->getReferenceCount(), + (int32_t)tex->getReferenceCount(), tex->getBackendTexture(), - (long)tex->getPixelsWide(), - (long)tex->getPixelsHigh(), - (long)bpp, - (long)bytes / 1024); + (int32_t)tex->getPixelsWide(), + (int32_t)tex->getPixelsHigh(), + (int32_t)bpp, + (int32_t)bytes / 1024); buffer += buftmp; } - snprintf(buftmp, sizeof(buftmp) - 1, "TextureCache dumpDebugInfo: %ld textures, for %lu KB (%.2f MB)\n", (long)count, (long)totalBytes / 1024, totalBytes / (1024.0f*1024.0f)); + snprintf(buftmp, sizeof(buftmp) - 1, "TextureCache dumpDebugInfo: %ld textures, for %lu KB (%.2f MB)\n", (int32_t)count, (int32_t)totalBytes / 1024, totalBytes / (1024.0f*1024.0f)); buffer += buftmp; return buffer; diff --git a/cocos/ui/UIEditBox/Mac/CCUIPasswordTextField.m b/cocos/ui/UIEditBox/Mac/CCUIPasswordTextField.m index c75db227e3..704c8d9e0c 100644 --- a/cocos/ui/UIEditBox/Mac/CCUIPasswordTextField.m +++ b/cocos/ui/UIEditBox/Mac/CCUIPasswordTextField.m @@ -66,8 +66,8 @@ inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject - start:(long)selStart - length:(long)selLength + start:(int32_t)selStart + length:(int32_t)selLength { aRect = [self drawingRectForBounds:aRect]; mIsEditingOrSelecting = YES; diff --git a/cocos/ui/UIEditBox/Mac/CCUISingleLineTextField.m b/cocos/ui/UIEditBox/Mac/CCUISingleLineTextField.m index aa8d2c7725..4573f53c55 100644 --- a/cocos/ui/UIEditBox/Mac/CCUISingleLineTextField.m +++ b/cocos/ui/UIEditBox/Mac/CCUISingleLineTextField.m @@ -66,8 +66,8 @@ inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject - start:(long)selStart - length:(long)selLength + start:(int32_t)selStart + length:(int32_t)selLength { aRect = [self drawingRectForBounds:aRect]; mIsEditingOrSelecting = YES; diff --git a/cocos/ui/UIHelper.cpp b/cocos/ui/UIHelper.cpp index eaef0ba59c..0e72f299d1 100644 --- a/cocos/ui/UIHelper.cpp +++ b/cocos/ui/UIHelper.cpp @@ -123,7 +123,7 @@ std::string Helper::getSubStringOfUTF8String(const std::string& str, std::string return ""; } if (utf32.size() < start) { - CCLOGERROR("'start' is out of range: %ld, %s", static_cast(start), str.c_str()); + CCLOGERROR("'start' is out of range: %ld, %s", static_cast(start), str.c_str()); return ""; } std::string result; diff --git a/cocos/ui/UITextField.cpp b/cocos/ui/UITextField.cpp index aa09277d37..4366a006ce 100644 --- a/cocos/ui/UITextField.cpp +++ b/cocos/ui/UITextField.cpp @@ -126,7 +126,7 @@ void UICCTextField::insertText(const char* text, size_t len) { if (_maxLengthEnabled) { - long text_count = StringUtils::getCharacterCountInUTF8String(getString()); + int32_t text_count = StringUtils::getCharacterCountInUTF8String(getString()); if (text_count >= _maxLength) { // password @@ -137,12 +137,12 @@ void UICCTextField::insertText(const char* text, size_t len) return; } - long input_count = StringUtils::getCharacterCountInUTF8String(text); - long total = text_count + input_count; + int32_t input_count = StringUtils::getCharacterCountInUTF8String(text); + int32_t total = text_count + input_count; if (total > _maxLength) { - long length = _maxLength - text_count; + int32_t length = _maxLength - text_count; input_text = Helper::getSubStringOfUTF8String(input_text, 0, length); len = input_text.length(); @@ -205,8 +205,8 @@ void UICCTextField::setPasswordStyleText(const std::string& styleText) void UICCTextField::setPasswordText(const std::string& text) { std::string tempStr = ""; - long text_count = StringUtils::getCharacterCountInUTF8String(text); - long max = text_count; + int32_t text_count = StringUtils::getCharacterCountInUTF8String(text); + int32_t max = text_count; if (_maxLengthEnabled) { @@ -373,7 +373,7 @@ void TextField::setString(const std::string& text) if (isMaxLengthEnabled()) { int max = _textFieldRenderer->getMaxLength(); - long text_count = StringUtils::getCharacterCountInUTF8String(text); + int32_t text_count = StringUtils::getCharacterCountInUTF8String(text); if (text_count > max) { strText = Helper::getSubStringOfUTF8String(strText, 0, max); From e5bbea3ccab2755b832a9ceab68f89195042763b Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 15:48:05 +1000 Subject: [PATCH 02/19] Test code updated with long to int32_t changes --- .../Classes/ActionsTest/ActionsTest.cpp | 4 ++-- .../Classes/ActionsTest/ActionsTest.h | 4 ++-- tests/cpp-tests/Classes/BugsTest/Bug-14327.cpp | 2 +- .../Classes/Camera3DTest/Camera3DTest.cpp | 4 ++-- .../TableViewTest/TableViewTestScene.cpp | 4 ++-- .../Classes/FileUtilsTest/FileUtilsTest.cpp | 4 ++-- .../HttpClientTest/HttpClientTest.cpp | 4 ++-- .../Classes/Sprite3DTest/Sprite3DTest.cpp | 8 ++++---- .../UIPageViewTest/UIPageViewTest.cpp | 18 +++++++++--------- .../UIRichTextTest/UIRichTextTest.cpp | 4 ++-- tests/cpp-tests/Classes/controller.cpp | 2 +- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp index a8ca9c8e29..1b86e03172 100644 --- a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp +++ b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp @@ -773,7 +773,7 @@ void ActionSequence2::callback2(Node* sender) addChild(label); } -void ActionSequence2::callback3(Node* sender, long data) +void ActionSequence2::callback3(Node* sender, int32_t data) { auto s = Director::getInstance()->getWinSize(); auto label = Label::createWithTTF("callback 3 called", "fonts/Marker Felt.ttf", 16.0f); @@ -950,7 +950,7 @@ void ActionCallFunction::callback2(Node* sender) CCLOG("sender is: %p", sender); } -void ActionCallFunction::callback3(Node* sender, long data) +void ActionCallFunction::callback3(Node* sender, int32_t data) { auto s = Director::getInstance()->getWinSize(); auto label = Label::createWithTTF("callback 3 called", "fonts/Marker Felt.ttf", 16.0f); diff --git a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.h b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.h index e83a6b94f4..12b16ed6a1 100644 --- a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.h +++ b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.h @@ -205,7 +205,7 @@ public: void callback1(); void callback2(Node* sender); - void callback3(Node* sender, long data); + void callback3(Node* sender, int32_t data); }; class ActionSequence3 : public ActionsDemo @@ -351,7 +351,7 @@ public: void callback1(); void callback2(Node* pTarget); - void callback3(Node* pTarget, long data); + void callback3(Node* pTarget, int32_t data); }; diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-14327.cpp b/tests/cpp-tests/Classes/BugsTest/Bug-14327.cpp index 10d07ef80c..a5f56f5751 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-14327.cpp +++ b/tests/cpp-tests/Classes/BugsTest/Bug-14327.cpp @@ -75,7 +75,7 @@ bool Bug14327Layer::init() void Bug14327Layer::update(float dt) { - long delta = _removeTime - time(nullptr); + int32_t delta = _removeTime - time(nullptr); if (delta > 0) { ldiv_t ret = ldiv(delta, 60L); diff --git a/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp b/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp index e9961f616e..9f03e2456d 100644 --- a/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp +++ b/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp @@ -900,7 +900,7 @@ void CameraCullingDemo::addSpriteCallback(Ref* sender) // update sprite number char szText[16]; - sprintf(szText,"%ld sprits", static_cast(_layer3D->getChildrenCount())); + sprintf(szText,"%ld sprits", static_cast(_layer3D->getChildrenCount())); _labelSprite3DCount->setString(szText); } @@ -928,7 +928,7 @@ void CameraCullingDemo::delSpriteCallback(Ref* sender) // update sprite number char szText[16]; - sprintf(szText,"%ld sprits", static_cast(_layer3D->getChildrenCount())); + sprintf(szText,"%ld sprits", static_cast(_layer3D->getChildrenCount())); _labelSprite3DCount->setString(szText); } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp index 144595032e..6db8a02f3c 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp @@ -71,7 +71,7 @@ bool TableViewTest::init() void TableViewTest::tableCellTouched(TableView* table, TableViewCell* cell) { - CCLOG("cell touched at index: %ld", static_cast(cell->getIdx())); + CCLOG("cell touched at index: %ld", static_cast(cell->getIdx())); } Size TableViewTest::tableCellSizeForIndex(TableView *table, ssize_t idx) @@ -84,7 +84,7 @@ Size TableViewTest::tableCellSizeForIndex(TableView *table, ssize_t idx) TableViewCell* TableViewTest::tableCellAtIndex(TableView *table, ssize_t idx) { - auto string = StringUtils::format("%ld", static_cast(idx)); + auto string = StringUtils::format("%ld", static_cast(idx)); TableViewCell *cell = table->dequeueCell(); if (!cell) { cell = new (std::nothrow) CustomTableViewCell(); diff --git a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp index f6a81d9803..a16ff5af97 100644 --- a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp +++ b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp @@ -373,7 +373,7 @@ void TestFileFuncs::onEnter() this->addChild(label); // getFileSize Test - long size = sharedFileUtils->getFileSize(filepath); + int32_t size = sharedFileUtils->getFileSize(filepath); msg = StringUtils::format("getFileSize: Test file size equals %ld", size); label = Label::createWithSystemFont(msg, "", 20); label->setPosition(x, y * 3); @@ -1160,7 +1160,7 @@ void TestFileFuncsAsync::onEnter() label->setPosition(x, y * 4); this->addChild(label); - sharedFileUtils->getFileSize(filepath, [=](long size) { + sharedFileUtils->getFileSize(filepath, [=](int32_t size) { auto msg = StringUtils::format("getFileSize: Test file size equals %ld", size); auto label = Label::createWithSystemFont(msg, "", 20); label->setPosition(x, y * 3); diff --git a/tests/cpp-tests/Classes/NetworkTest/HttpClientTest/HttpClientTest.cpp b/tests/cpp-tests/Classes/NetworkTest/HttpClientTest/HttpClientTest.cpp index eccd33d7ba..0494cf5281 100644 --- a/tests/cpp-tests/Classes/NetworkTest/HttpClientTest/HttpClientTest.cpp +++ b/tests/cpp-tests/Classes/NetworkTest/HttpClientTest/HttpClientTest.cpp @@ -311,7 +311,7 @@ void HttpClientTest::onHttpRequestCompleted(HttpClient *sender, HttpResponse *re log("%s completed", response->getHttpRequest()->getTag()); } - long statusCode = response->getResponseCode(); + int32_t statusCode = response->getResponseCode(); char statusString[64] = {}; sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag()); _labelStatusCode->setString(statusString); @@ -460,7 +460,7 @@ void HttpClientClearRequestsTest::onHttpRequestCompleted(HttpClient *sender, Htt log("%s completed", response->getHttpRequest()->getTag()); } - long statusCode = response->getResponseCode(); + int32_t statusCode = response->getResponseCode(); char statusString[64] = {}; sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag()); _labelStatusCode->setString(statusString); diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp index 02fb1d237b..3ce4a440e3 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp @@ -885,7 +885,7 @@ void AsyncLoadSprite3DTest::menuCallback_asyncLoadSprite(Ref* sender) //remove cache data Sprite3DCache::getInstance()->removeAllSprite3DData(); - long index = 0; + int32_t index = 0; for (const auto& path : _paths) { Sprite3D::createAsync(path, CC_CALLBACK_2(AsyncLoadSprite3DTest::asyncLoad_Callback, this), (void*)index++); } @@ -893,7 +893,7 @@ void AsyncLoadSprite3DTest::menuCallback_asyncLoadSprite(Ref* sender) void AsyncLoadSprite3DTest::asyncLoad_Callback(Sprite3D* sprite, void* param) { - long index = (long)param; + auto index = (int32_t)param; auto node = getChildByTag(101); auto s = Director::getInstance()->getWinSize(); float width = s.width / _paths.size(); @@ -1324,7 +1324,7 @@ Sprite3DReskinTest::Sprite3DReskinTest() } void Sprite3DReskinTest::menuCallback_reSkin(Ref* sender) { - long index = (long)(((MenuItemLabel*)sender)->getUserData()); + auto index = (int32_t)(((MenuItemLabel*)sender)->getUserData()); if (index < (int)SkinType::MAX_TYPE) { _curSkin[index] = (_curSkin[index] + 1) % _skins[index].size(); @@ -1506,7 +1506,7 @@ void Sprite3DWithOBBPerformanceTest::onTouchesMoved(const std::vector& t void Sprite3DWithOBBPerformanceTest::update(float dt) { char szText[16]; - sprintf(szText, "%lu cubes", static_cast(_obb.size())); + sprintf(szText, "%lu cubes", static_cast(_obb.size())); _labelCubeCount->setString(szText); if (_drawDebug) diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp index 8897df3bbf..18e62bb436 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp @@ -129,7 +129,7 @@ void UIPageViewTest::pageViewEvent(Ref *pSender, PageView::EventType type) { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); + _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); } break; @@ -241,7 +241,7 @@ void UIPageViewButtonTest::pageViewEvent(Ref *pSender, PageView::EventType type) { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); + _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); } break; @@ -438,7 +438,7 @@ void UIPageViewTouchPropagationTest::pageViewEvent(Ref *pSender, PageView::Event { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); + _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); } break; @@ -558,7 +558,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init() } pageView->pushBackCustomItem(outerBox); - _displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast(pageView->getItems().size()))); + _displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast(pageView->getItems().size()))); CCLOG("current page index = %zd", pageView->getCurrentPageIndex()); }); _uiLayer->addChild(button); @@ -579,7 +579,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init() { CCLOG("There is no page to remove!"); } - _displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast(pageView->getItems().size()))); + _displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast(pageView->getItems().size()))); CCLOG("current page index = %zd", pageView->getCurrentPageIndex()); }); @@ -594,7 +594,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init() button3->addClickEventListener([=](Ref* sender) { pageView->removeAllItems(); - _displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast(pageView->getItems().size()))); + _displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast(pageView->getItems().size()))); CCLOG("current page index = %zd", pageView->getCurrentPageIndex()); }); @@ -623,7 +623,7 @@ void UIPageViewDynamicAddAndRemoveTest::pageViewEvent(Ref *pSender, PageView::Ev { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast((pageView->getCurrentPageIndex() + 1)))); + _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast((pageView->getCurrentPageIndex() + 1)))); } break; @@ -825,7 +825,7 @@ void UIPageViewVerticalTest::pageViewEvent(Ref *pSender, PageView::EventType typ { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); + _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); } break; @@ -984,7 +984,7 @@ void UIPageViewChildSizeTest::pageViewEvent(Ref *pSender, PageView::EventType ty { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); + _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); } break; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp index 40d546abb5..2def10a868 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp @@ -69,12 +69,12 @@ bool UIRichTextTest::init() std::string str2 = config->getValue("Japanese").asString(); CCLOG("str1:%s ascii length = %ld, utf8 length = %ld, substr = %s", str1.c_str(), - static_cast(str1.length()), + static_cast(str1.length()), StringUtils::getCharacterCountInUTF8String(str1), Helper::getSubStringOfUTF8String(str1, 0, 5).c_str()); CCLOG("str2:%s ascii length = %ld, utf8 length = %ld, substr = %s", str2.c_str(), - static_cast(str2.length()), + static_cast(str2.length()), StringUtils::getCharacterCountInUTF8String(str2), Helper::getSubStringOfUTF8String(str2, 0, 2).c_str()); diff --git a/tests/cpp-tests/Classes/controller.cpp b/tests/cpp-tests/Classes/controller.cpp index 9f991eec05..7e0647b1b2 100644 --- a/tests/cpp-tests/Classes/controller.cpp +++ b/tests/cpp-tests/Classes/controller.cpp @@ -494,7 +494,7 @@ bool TestController::blockTouchBegan(Touch* touch, Event* event) #if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 #include -static long __stdcall windowExceptionFilter(_EXCEPTION_POINTERS* excp) +static int32_t __stdcall windowExceptionFilter(_EXCEPTION_POINTERS* excp) { if (s_testController) { From aecfb8be47807cb3257547b1d3ec054a01abe0b1 Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 15:55:57 +1000 Subject: [PATCH 03/19] FT_StreamRec expects specific method signature with `unsigned long` --- cocos/2d/CCFontFreeType.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cocos/2d/CCFontFreeType.cpp b/cocos/2d/CCFontFreeType.cpp index 6cd186e85e..0597e7bdd9 100644 --- a/cocos/2d/CCFontFreeType.cpp +++ b/cocos/2d/CCFontFreeType.cpp @@ -62,10 +62,10 @@ typedef struct _DataRef static std::unordered_map s_cacheFontData; // ------ freetype2 stream parsing support --- -static uint32_t ft_stream_read_callback(FT_Stream stream, - uint32_t offset, +static unsigned long ft_stream_read_callback(FT_Stream stream, + unsigned long offset, unsigned char* buf, - uint32_t size) + unsigned long size) { auto fd = (FileStream*)stream->descriptor.pointer; if (!fd) From 64695cfb48e34e709c16c3d7a627465321a9e21d Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 15:59:29 +1000 Subject: [PATCH 04/19] Revert changes where `long` type is required. --- cocos/base/ZipUtils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/base/ZipUtils.cpp b/cocos/base/ZipUtils.cpp index 62fe9ca4a1..86f533d771 100644 --- a/cocos/base/ZipUtils.cpp +++ b/cocos/base/ZipUtils.cpp @@ -528,7 +528,7 @@ struct ZipFilePrivate } // unzip overrides to support FileStream - static int32_t ZipFile_tell_file_func(voidpf opaque, voidpf stream) { + static long ZipFile_tell_file_func(voidpf opaque, voidpf stream) { if (stream == nullptr) return -1; @@ -537,7 +537,7 @@ struct ZipFilePrivate return fs->tell(); } - static int32_t ZipFile_seek_file_func(voidpf opaque, voidpf stream, uint32_t offset, int origin) { + static long ZipFile_seek_file_func(voidpf opaque, voidpf stream, uint32_t offset, int origin) { if (stream == nullptr) return -1; From 737f0c39d7cdf4d016ac81db98a2a25f77f4ac23 Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 16:08:57 +1000 Subject: [PATCH 05/19] Revert to usage of `long` type for external library methods that require it. --- cocos/base/ZipUtils.cpp | 2 +- cocos/platform/CCImage.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/base/ZipUtils.cpp b/cocos/base/ZipUtils.cpp index 86f533d771..ac4eaf6db6 100644 --- a/cocos/base/ZipUtils.cpp +++ b/cocos/base/ZipUtils.cpp @@ -450,7 +450,7 @@ int ZipUtils::inflateCCZBuffer(const unsigned char *buffer, ssize_t bufferLen, u return -1; } - uint32_t destlen = len; + unsigned long destlen = len; size_t source = (size_t) buffer + sizeof(*header); int ret = uncompress(*out, &destlen, (Bytef*)source, bufferLen - sizeof(*header) ); diff --git a/cocos/platform/CCImage.cpp b/cocos/platform/CCImage.cpp index da1e50d652..bb0753db54 100644 --- a/cocos/platform/CCImage.cpp +++ b/cocos/platform/CCImage.cpp @@ -2319,7 +2319,7 @@ bool Image::saveImageToJPG(const std::string& filePath) CC_BREAK_IF(nullptr == outfile); unsigned char* outputBuffer = nullptr; - uint32_t outputSize = 0; + unsigned long outputSize = 0; jpeg_mem_dest(&cinfo, &outputBuffer, &outputSize); cinfo.image_width = _width; /* image width and height, in pixels */ From 0b27d0980cc373cb8e65942a03fa134e23d51963 Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 16:18:32 +1000 Subject: [PATCH 06/19] Add required include for uint32_t Fix code warning --- cocos/base/TGAlib.h | 2 ++ cocos/renderer/CCTextureCache.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cocos/base/TGAlib.h b/cocos/base/TGAlib.h index 3a258bbff1..2471802e18 100644 --- a/cocos/base/TGAlib.h +++ b/cocos/base/TGAlib.h @@ -28,6 +28,8 @@ THE SOFTWARE. #define __SUPPORT_DATA_SUPPORT_TGALIB_H__ /// @cond DO_NOT_SHOW +#include + namespace cocos2d { enum { diff --git a/cocos/renderer/CCTextureCache.cpp b/cocos/renderer/CCTextureCache.cpp index 58987d4a01..ee58ae3e12 100644 --- a/cocos/renderer/CCTextureCache.cpp +++ b/cocos/renderer/CCTextureCache.cpp @@ -664,7 +664,7 @@ std::string TextureCache::getCachedTextureInfo() const buffer += buftmp; } - snprintf(buftmp, sizeof(buftmp) - 1, "TextureCache dumpDebugInfo: %ld textures, for %lu KB (%.2f MB)\n", (int32_t)count, (int32_t)totalBytes / 1024, totalBytes / (1024.0f*1024.0f)); + snprintf(buftmp, sizeof(buftmp) - 1, "TextureCache dumpDebugInfo: %ld textures, for %lu KB (%.2f MB)\n", (long)count, (long)totalBytes / 1024, totalBytes / (1024.0f*1024.0f)); buffer += buftmp; return buffer; From 101eb89f4c13c54de9ceed7c19bdf1d4b25dc1b4 Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 16:20:16 +1000 Subject: [PATCH 07/19] Revert to `long` for library usage --- cocos/network/CCDownloader-curl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/network/CCDownloader-curl.cpp b/cocos/network/CCDownloader-curl.cpp index c28ae86a79..24e6c6f04d 100644 --- a/cocos/network/CCDownloader-curl.cpp +++ b/cocos/network/CCDownloader-curl.cpp @@ -581,7 +581,7 @@ private: if (runningHandles) { // get timeout setting from multi-handle - int32_t timeoutMS = -1; + long timeoutMS = -1; curl_multi_timeout(curlmHandle, &timeoutMS); if (timeoutMS < 0) { From 3c5fa51a015952f9d432ee986f4792f1da65ce93 Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 16:38:23 +1000 Subject: [PATCH 08/19] Fix for compilation issue due to pointer to int32 conversion. Fix warning. --- tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp index 3ce4a440e3..1f1c97ea5a 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp @@ -893,7 +893,7 @@ void AsyncLoadSprite3DTest::menuCallback_asyncLoadSprite(Ref* sender) void AsyncLoadSprite3DTest::asyncLoad_Callback(Sprite3D* sprite, void* param) { - auto index = (int32_t)param; + auto index = (long)param; auto node = getChildByTag(101); auto s = Director::getInstance()->getWinSize(); float width = s.width / _paths.size(); @@ -1324,7 +1324,7 @@ Sprite3DReskinTest::Sprite3DReskinTest() } void Sprite3DReskinTest::menuCallback_reSkin(Ref* sender) { - auto index = (int32_t)(((MenuItemLabel*)sender)->getUserData()); + auto index = (long)(((MenuItemLabel*)sender)->getUserData()); if (index < (int)SkinType::MAX_TYPE) { _curSkin[index] = (_curSkin[index] + 1) % _skins[index].size(); @@ -1506,7 +1506,7 @@ void Sprite3DWithOBBPerformanceTest::onTouchesMoved(const std::vector& t void Sprite3DWithOBBPerformanceTest::update(float dt) { char szText[16]; - sprintf(szText, "%lu cubes", static_cast(_obb.size())); + sprintf(szText, "%lu cubes", static_cast(_obb.size())); _labelCubeCount->setString(szText); if (_drawDebug) From 386f7deb9d4c14f64dbda760508b1ab8b3fbed1c Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 16:52:40 +1000 Subject: [PATCH 09/19] Use explicit cast to uintptr_t prior to casting to int type. --- tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp index 1f1c97ea5a..b3016e6b76 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp @@ -893,7 +893,7 @@ void AsyncLoadSprite3DTest::menuCallback_asyncLoadSprite(Ref* sender) void AsyncLoadSprite3DTest::asyncLoad_Callback(Sprite3D* sprite, void* param) { - auto index = (long)param; + auto index = static_cast((uintptr_t)param)); auto node = getChildByTag(101); auto s = Director::getInstance()->getWinSize(); float width = s.width / _paths.size(); @@ -1324,7 +1324,7 @@ Sprite3DReskinTest::Sprite3DReskinTest() } void Sprite3DReskinTest::menuCallback_reSkin(Ref* sender) { - auto index = (long)(((MenuItemLabel*)sender)->getUserData()); + auto index = static_cast((uintptr_t)(((MenuItemLabel*)sender)->getUserData())); if (index < (int)SkinType::MAX_TYPE) { _curSkin[index] = (_curSkin[index] + 1) % _skins[index].size(); From d8ef523abb164133f6e149263ac3bf7be257643a Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 17:05:33 +1000 Subject: [PATCH 10/19] Fix typo --- tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp index b3016e6b76..12748d2f6d 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp @@ -893,7 +893,7 @@ void AsyncLoadSprite3DTest::menuCallback_asyncLoadSprite(Ref* sender) void AsyncLoadSprite3DTest::asyncLoad_Callback(Sprite3D* sprite, void* param) { - auto index = static_cast((uintptr_t)param)); + auto index = static_cast((uintptr_t)param); auto node = getChildByTag(101); auto s = Director::getInstance()->getWinSize(); float width = s.width / _paths.size(); From de182c83604b689ea83bc6a8e75c74fd24770bd9 Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 17:46:22 +1000 Subject: [PATCH 11/19] Change %ld to %d for 32bit data types Regenerate LUA bindings --- cocos/base/CCProfiling.cpp | 2 +- cocos/base/CCProperties.cpp | 2 +- cocos/platform/CCGLView.cpp | 4 +- cocos/renderer/CCTextureCache.cpp | 2 +- cocos/ui/UIHelper.cpp | 2 +- .../lua-bindings/auto/lua_cocos2dx_auto.cpp | 4640 +++++++++-------- .../lua-bindings/auto/lua_cocos2dx_auto.hpp | 4 + .../Classes/ActionsTest/ActionsTest.cpp | 2 +- .../Classes/Camera3DTest/Camera3DTest.cpp | 4 +- .../TableViewTest/TableViewTestScene.cpp | 4 +- .../Classes/FileUtilsTest/FileUtilsTest.cpp | 4 +- .../HttpClientTest/HttpClientTest.cpp | 8 +- .../UIPageViewTest/UIPageViewTest.cpp | 6 +- .../UIRichTextTest/UIRichTextTest.cpp | 4 +- 14 files changed, 2445 insertions(+), 2243 deletions(-) diff --git a/cocos/base/CCProfiling.cpp b/cocos/base/CCProfiling.cpp index d3324790b3..de7e90fd8f 100644 --- a/cocos/base/CCProfiling.cpp +++ b/cocos/base/CCProfiling.cpp @@ -115,7 +115,7 @@ std::string ProfilingTimer::getDescription() const { static char s_description[512] = {0}; - sprintf(s_description, "%s ::\tavg1: %ldu,\tavg2: %ldu,\tmin: %ldu,\tmax: %ldu,\ttotal: %.2fs,\tnr calls: %ld", _nameStr.c_str(), _averageTime1, _averageTime2, minTime, maxTime, totalTime/1000000., numberOfCalls); + sprintf(s_description, "%s ::\tavg1: %du,\tavg2: %du,\tmin: %du,\tmax: %du,\ttotal: %.2fs,\tnr calls: %d", _nameStr.c_str(), _averageTime1, _averageTime2, minTime, maxTime, totalTime/1000000., numberOfCalls); return s_description; } diff --git a/cocos/base/CCProperties.cpp b/cocos/base/CCProperties.cpp index 8dbb70070e..6a5d8f4a26 100644 --- a/cocos/base/CCProperties.cpp +++ b/cocos/base/CCProperties.cpp @@ -902,7 +902,7 @@ int32_t Properties::getLong(const char* name) const { int32_t value; int scanned; - scanned = sscanf(valueString, "%ld", &value); + scanned = sscanf(valueString, "%d", &value); if (scanned != 1) { CCLOGERROR("Error attempting to parse property '%s' as a long integer.", name); diff --git a/cocos/platform/CCGLView.cpp b/cocos/platform/CCGLView.cpp index 95968bf261..dc447f640f 100644 --- a/cocos/platform/CCGLView.cpp +++ b/cocos/platform/CCGLView.cpp @@ -380,7 +380,7 @@ void GLView::handleTouchesMove(int num, intptr_t ids[], float xs[], float ys[], else { // It is error, should return. - CCLOG("Moving touches with id: %ld error", (int32_t)id); + CCLOG("Moving touches with id: %d error", static_cast(id)); return; } } @@ -433,7 +433,7 @@ void GLView::handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num } else { - CCLOG("Ending touches with id: %ld error", static_cast(id)); + CCLOG("Ending touches with id: %d error", static_cast(id)); return; } diff --git a/cocos/renderer/CCTextureCache.cpp b/cocos/renderer/CCTextureCache.cpp index ee58ae3e12..8ce35c4d25 100644 --- a/cocos/renderer/CCTextureCache.cpp +++ b/cocos/renderer/CCTextureCache.cpp @@ -652,7 +652,7 @@ std::string TextureCache::getCachedTextureInfo() const auto bytes = tex->getPixelsWide() * tex->getPixelsHigh() * bpp / 8; totalBytes += bytes; count++; - snprintf(buftmp, sizeof(buftmp) - 1, "\"%s\" rc=%lu id=%p %lu x %lu @ %ld bpp => %lu KB\n", + snprintf(buftmp, sizeof(buftmp) - 1, "\"%s\" rc=%lu id=%p %lu x %lu @ %d bpp => %lu KB\n", texture.first.c_str(), (int32_t)tex->getReferenceCount(), tex->getBackendTexture(), diff --git a/cocos/ui/UIHelper.cpp b/cocos/ui/UIHelper.cpp index 0e72f299d1..02e74c3b11 100644 --- a/cocos/ui/UIHelper.cpp +++ b/cocos/ui/UIHelper.cpp @@ -123,7 +123,7 @@ std::string Helper::getSubStringOfUTF8String(const std::string& str, std::string return ""; } if (utf32.size() < start) { - CCLOGERROR("'start' is out of range: %ld, %s", static_cast(start), str.c_str()); + CCLOGERROR("'start' is out of range: %d, %s", static_cast(start), str.c_str()); return ""; } std::string result; diff --git a/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index 866e1ca34a..3a0b98fae5 100644 --- a/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -29629,7 +29629,7 @@ int lua_cocos2dx_Properties_getLong(lua_State* tolua_S) tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getLong'", nullptr); return 0; } - long ret = cobj->getLong(); + int ret = cobj->getLong(); tolua_pushnumber(tolua_S,(lua_Number)ret); return 1; } @@ -29643,7 +29643,7 @@ int lua_cocos2dx_Properties_getLong(lua_State* tolua_S) tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getLong'", nullptr); return 0; } - long ret = cobj->getLong(arg0); + int ret = cobj->getLong(arg0); tolua_pushnumber(tolua_S,(lua_Number)ret); return 1; } @@ -57589,2207 +57589,6 @@ int lua_register_cocos2dx_LabelAtlas(lua_State* tolua_S) return 1; } -int lua_cocos2dx_Sprite_setSpriteFrame(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setSpriteFrame'", nullptr); - return 0; - } -#endif - argc = lua_gettop(tolua_S)-1; - do{ - if (argc == 1) { - cocos2d::SpriteFrame* arg0; - ok &= luaval_to_object(tolua_S, 2, "cc.SpriteFrame",&arg0, "cc.Sprite:setSpriteFrame"); - - if (!ok) { break; } - cobj->setSpriteFrame(arg0); - lua_settop(tolua_S, 1); - return 1; - } - }while(0); - ok = true; - do{ - if (argc == 1) { - std::string arg0; - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite:setSpriteFrame"); - - if (!ok) { break; } - cobj->setSpriteFrame(arg0); - lua_settop(tolua_S, 1); - return 1; - } - }while(0); - ok = true; - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setSpriteFrame",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setSpriteFrame'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_setTexture(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setTexture'", nullptr); - return 0; - } -#endif - argc = lua_gettop(tolua_S)-1; - do{ - if (argc == 1) { - cocos2d::Texture2D* arg0; - ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.Sprite:setTexture"); - - if (!ok) { break; } - cobj->setTexture(arg0); - lua_settop(tolua_S, 1); - return 1; - } - }while(0); - ok = true; - do{ - if (argc == 1) { - std::string arg0; - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite:setTexture"); - - if (!ok) { break; } - cobj->setTexture(arg0); - lua_settop(tolua_S, 1); - return 1; - } - }while(0); - ok = true; - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setTexture",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setTexture'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_getTexture(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getTexture'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getTexture'", nullptr); - return 0; - } - cocos2d::Texture2D* ret = cobj->getTexture(); - object_to_luaval(tolua_S, "cc.Texture2D",(cocos2d::Texture2D*)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getTexture",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getTexture'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_setFlippedY(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setFlippedY'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - bool arg0; - - ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Sprite:setFlippedY"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setFlippedY'", nullptr); - return 0; - } - cobj->setFlippedY(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setFlippedY",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setFlippedY'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_setFlippedX(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setFlippedX'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - bool arg0; - - ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Sprite:setFlippedX"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setFlippedX'", nullptr); - return 0; - } - cobj->setFlippedX(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setFlippedX",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setFlippedX'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_getResourceType(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getResourceType'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getResourceType'", nullptr); - return 0; - } - int ret = cobj->getResourceType(); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getResourceType",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getResourceType'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_setDisplayFrameWithAnimationName(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setDisplayFrameWithAnimationName'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 2) - { - std::string arg0; - unsigned int arg1; - - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite:setDisplayFrameWithAnimationName"); - - ok &= luaval_to_uint32(tolua_S, 3,&arg1, "cc.Sprite:setDisplayFrameWithAnimationName"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setDisplayFrameWithAnimationName'", nullptr); - return 0; - } - cobj->setDisplayFrameWithAnimationName(arg0, arg1); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setDisplayFrameWithAnimationName",argc, 2); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setDisplayFrameWithAnimationName'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_getBatchNode(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getBatchNode'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getBatchNode'", nullptr); - return 0; - } - cocos2d::SpriteBatchNode* ret = cobj->getBatchNode(); - object_to_luaval(tolua_S, "cc.SpriteBatchNode",(cocos2d::SpriteBatchNode*)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getBatchNode",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getBatchNode'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_getOffsetPosition(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getOffsetPosition'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getOffsetPosition'", nullptr); - return 0; - } - const cocos2d::Vec2& ret = cobj->getOffsetPosition(); - vec2_to_luaval(tolua_S, ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getOffsetPosition",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getOffsetPosition'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_getCenterRect(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getCenterRect'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getCenterRect'", nullptr); - return 0; - } - cocos2d::Rect ret = cobj->getCenterRect(); - rect_to_luaval(tolua_S, ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getCenterRect",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getCenterRect'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_setCenterRectNormalized(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setCenterRectNormalized'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - cocos2d::Rect arg0; - - ok &= luaval_to_rect(tolua_S, 2, &arg0, "cc.Sprite:setCenterRectNormalized"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setCenterRectNormalized'", nullptr); - return 0; - } - cobj->setCenterRectNormalized(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setCenterRectNormalized",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setCenterRectNormalized'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_isStretchEnabled(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_isStretchEnabled'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_isStretchEnabled'", nullptr); - return 0; - } - bool ret = cobj->isStretchEnabled(); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:isStretchEnabled",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_isStretchEnabled'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_setTextureRect(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setTextureRect'", nullptr); - return 0; - } -#endif - argc = lua_gettop(tolua_S)-1; - do{ - if (argc == 3) { - cocos2d::Rect arg0; - ok &= luaval_to_rect(tolua_S, 2, &arg0, "cc.Sprite:setTextureRect"); - - if (!ok) { break; } - bool arg1; - ok &= luaval_to_boolean(tolua_S, 3,&arg1, "cc.Sprite:setTextureRect"); - - if (!ok) { break; } - cocos2d::Size arg2; - ok &= luaval_to_size(tolua_S, 4, &arg2, "cc.Sprite:setTextureRect"); - - if (!ok) { break; } - cobj->setTextureRect(arg0, arg1, arg2); - lua_settop(tolua_S, 1); - return 1; - } - }while(0); - ok = true; - do{ - if (argc == 1) { - cocos2d::Rect arg0; - ok &= luaval_to_rect(tolua_S, 2, &arg0, "cc.Sprite:setTextureRect"); - - if (!ok) { break; } - cobj->setTextureRect(arg0); - lua_settop(tolua_S, 1); - return 1; - } - }while(0); - ok = true; - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setTextureRect",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setTextureRect'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_initWithSpriteFrameName(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_initWithSpriteFrameName'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - std::string arg0; - - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite:initWithSpriteFrameName"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_initWithSpriteFrameName'", nullptr); - return 0; - } - bool ret = cobj->initWithSpriteFrameName(arg0); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:initWithSpriteFrameName",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_initWithSpriteFrameName'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_setStretchEnabled(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setStretchEnabled'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - bool arg0; - - ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Sprite:setStretchEnabled"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setStretchEnabled'", nullptr); - return 0; - } - cobj->setStretchEnabled(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setStretchEnabled",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setStretchEnabled'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_isFrameDisplayed(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_isFrameDisplayed'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - cocos2d::SpriteFrame* arg0; - - ok &= luaval_to_object(tolua_S, 2, "cc.SpriteFrame",&arg0, "cc.Sprite:isFrameDisplayed"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_isFrameDisplayed'", nullptr); - return 0; - } - bool ret = cobj->isFrameDisplayed(arg0); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:isFrameDisplayed",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_isFrameDisplayed'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_getAtlasIndex(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getAtlasIndex'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getAtlasIndex'", nullptr); - return 0; - } - unsigned int ret = cobj->getAtlasIndex(); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getAtlasIndex",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getAtlasIndex'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_setTextureAtlas(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setTextureAtlas'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - cocos2d::TextureAtlas* arg0; - - ok &= luaval_to_object(tolua_S, 2, "cc.TextureAtlas",&arg0, "cc.Sprite:setTextureAtlas"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setTextureAtlas'", nullptr); - return 0; - } - cobj->setTextureAtlas(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setTextureAtlas",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setTextureAtlas'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_setBatchNode(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setBatchNode'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - cocos2d::SpriteBatchNode* arg0; - - ok &= luaval_to_object(tolua_S, 2, "cc.SpriteBatchNode",&arg0, "cc.Sprite:setBatchNode"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setBatchNode'", nullptr); - return 0; - } - cobj->setBatchNode(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setBatchNode",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setBatchNode'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_getBlendFunc(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getBlendFunc'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getBlendFunc'", nullptr); - return 0; - } - const cocos2d::BlendFunc& ret = cobj->getBlendFunc(); - blendfunc_to_luaval(tolua_S, ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getBlendFunc",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getBlendFunc'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_setCenterRect(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setCenterRect'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - cocos2d::Rect arg0; - - ok &= luaval_to_rect(tolua_S, 2, &arg0, "cc.Sprite:setCenterRect"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setCenterRect'", nullptr); - return 0; - } - cobj->setCenterRect(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setCenterRect",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setCenterRect'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_getSpriteFrame(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getSpriteFrame'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getSpriteFrame'", nullptr); - return 0; - } - cocos2d::SpriteFrame* ret = cobj->getSpriteFrame(); - object_to_luaval(tolua_S, "cc.SpriteFrame",(cocos2d::SpriteFrame*)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getSpriteFrame",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getSpriteFrame'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_setVertexLayout(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setVertexLayout'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setVertexLayout'", nullptr); - return 0; - } - cobj->setVertexLayout(); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setVertexLayout",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setVertexLayout'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_removeAllChildrenWithCleanup(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_removeAllChildrenWithCleanup'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - bool arg0; - - ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Sprite:removeAllChildrenWithCleanup"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_removeAllChildrenWithCleanup'", nullptr); - return 0; - } - cobj->removeAllChildrenWithCleanup(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:removeAllChildrenWithCleanup",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_removeAllChildrenWithCleanup'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_getResourceName(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getResourceName'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getResourceName'", nullptr); - return 0; - } - const std::string& ret = cobj->getResourceName(); - lua_pushlstring(tolua_S,ret.c_str(),ret.length()); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getResourceName",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getResourceName'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_isDirty(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_isDirty'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_isDirty'", nullptr); - return 0; - } - bool ret = cobj->isDirty(); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:isDirty",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_isDirty'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_getCenterRectNormalized(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getCenterRectNormalized'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getCenterRectNormalized'", nullptr); - return 0; - } - cocos2d::Rect ret = cobj->getCenterRectNormalized(); - rect_to_luaval(tolua_S, ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getCenterRectNormalized",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getCenterRectNormalized'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_setAtlasIndex(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setAtlasIndex'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - unsigned int arg0; - - ok &= luaval_to_uint32(tolua_S, 2,&arg0, "cc.Sprite:setAtlasIndex"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setAtlasIndex'", nullptr); - return 0; - } - cobj->setAtlasIndex(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setAtlasIndex",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setAtlasIndex'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_initWithTexture(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_initWithTexture'", nullptr); - return 0; - } -#endif - argc = lua_gettop(tolua_S)-1; - do{ - if (argc == 2) { - cocos2d::Texture2D* arg0; - ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.Sprite:initWithTexture"); - - if (!ok) { break; } - cocos2d::Rect arg1; - ok &= luaval_to_rect(tolua_S, 3, &arg1, "cc.Sprite:initWithTexture"); - - if (!ok) { break; } - bool ret = cobj->initWithTexture(arg0, arg1); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - }while(0); - ok = true; - do{ - if (argc == 1) { - cocos2d::Texture2D* arg0; - ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.Sprite:initWithTexture"); - - if (!ok) { break; } - bool ret = cobj->initWithTexture(arg0); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - }while(0); - ok = true; - do{ - if (argc == 3) { - cocos2d::Texture2D* arg0; - ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.Sprite:initWithTexture"); - - if (!ok) { break; } - cocos2d::Rect arg1; - ok &= luaval_to_rect(tolua_S, 3, &arg1, "cc.Sprite:initWithTexture"); - - if (!ok) { break; } - bool arg2; - ok &= luaval_to_boolean(tolua_S, 4,&arg2, "cc.Sprite:initWithTexture"); - - if (!ok) { break; } - bool ret = cobj->initWithTexture(arg0, arg1, arg2); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - }while(0); - ok = true; - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:initWithTexture",argc, 3); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_initWithTexture'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_setDirty(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setDirty'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - bool arg0; - - ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Sprite:setDirty"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setDirty'", nullptr); - return 0; - } - cobj->setDirty(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setDirty",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setDirty'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_isTextureRectRotated(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_isTextureRectRotated'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_isTextureRectRotated'", nullptr); - return 0; - } - bool ret = cobj->isTextureRectRotated(); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:isTextureRectRotated",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_isTextureRectRotated'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_getTextureRect(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getTextureRect'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getTextureRect'", nullptr); - return 0; - } - const cocos2d::Rect& ret = cobj->getTextureRect(); - rect_to_luaval(tolua_S, ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getTextureRect",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getTextureRect'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_initWithFile(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_initWithFile'", nullptr); - return 0; - } -#endif - argc = lua_gettop(tolua_S)-1; - do{ - if (argc == 2) { - std::string arg0; - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite:initWithFile"); - - if (!ok) { break; } - cocos2d::Rect arg1; - ok &= luaval_to_rect(tolua_S, 3, &arg1, "cc.Sprite:initWithFile"); - - if (!ok) { break; } - bool ret = cobj->initWithFile(arg0, arg1); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - }while(0); - ok = true; - do{ - if (argc == 1) { - std::string arg0; - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite:initWithFile"); - - if (!ok) { break; } - bool ret = cobj->initWithFile(arg0); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - }while(0); - ok = true; - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:initWithFile",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_initWithFile'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_setBlendFunc(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setBlendFunc'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - cocos2d::BlendFunc arg0; - - ok &= luaval_to_blendfunc(tolua_S, 2, &arg0, "cc.Sprite:setBlendFunc"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setBlendFunc'", nullptr); - return 0; - } - cobj->setBlendFunc(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setBlendFunc",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setBlendFunc'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_getTextureAtlas(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getTextureAtlas'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getTextureAtlas'", nullptr); - return 0; - } - cocos2d::TextureAtlas* ret = cobj->getTextureAtlas(); - object_to_luaval(tolua_S, "cc.TextureAtlas",(cocos2d::TextureAtlas*)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getTextureAtlas",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getTextureAtlas'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_initWithSpriteFrame(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_initWithSpriteFrame'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - cocos2d::SpriteFrame* arg0; - - ok &= luaval_to_object(tolua_S, 2, "cc.SpriteFrame",&arg0, "cc.Sprite:initWithSpriteFrame"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_initWithSpriteFrame'", nullptr); - return 0; - } - bool ret = cobj->initWithSpriteFrame(arg0); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:initWithSpriteFrame",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_initWithSpriteFrame'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_isFlippedX(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_isFlippedX'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_isFlippedX'", nullptr); - return 0; - } - bool ret = cobj->isFlippedX(); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:isFlippedX",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_isFlippedX'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_isFlippedY(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_isFlippedY'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_isFlippedY'", nullptr); - return 0; - } - bool ret = cobj->isFlippedY(); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:isFlippedY",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_isFlippedY'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_setVertexRect(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setVertexRect'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - cocos2d::Rect arg0; - - ok &= luaval_to_rect(tolua_S, 2, &arg0, "cc.Sprite:setVertexRect"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setVertexRect'", nullptr); - return 0; - } - cobj->setVertexRect(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setVertexRect",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setVertexRect'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Sprite_createWithTexture(lua_State* tolua_S) -{ - int argc = 0; - bool ok = true; -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertable(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - argc = lua_gettop(tolua_S)-1; - - do - { - if (argc == 2) - { - cocos2d::Texture2D* arg0; - ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.Sprite:createWithTexture"); - if (!ok) { break; } - cocos2d::Rect arg1; - ok &= luaval_to_rect(tolua_S, 3, &arg1, "cc.Sprite:createWithTexture"); - if (!ok) { break; } - cocos2d::Sprite* ret = cocos2d::Sprite::createWithTexture(arg0, arg1); - object_to_luaval(tolua_S, "cc.Sprite",(cocos2d::Sprite*)ret); - return 1; - } - } while (0); - ok = true; - do - { - if (argc == 3) - { - cocos2d::Texture2D* arg0; - ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.Sprite:createWithTexture"); - if (!ok) { break; } - cocos2d::Rect arg1; - ok &= luaval_to_rect(tolua_S, 3, &arg1, "cc.Sprite:createWithTexture"); - if (!ok) { break; } - bool arg2; - ok &= luaval_to_boolean(tolua_S, 4,&arg2, "cc.Sprite:createWithTexture"); - if (!ok) { break; } - cocos2d::Sprite* ret = cocos2d::Sprite::createWithTexture(arg0, arg1, arg2); - object_to_luaval(tolua_S, "cc.Sprite",(cocos2d::Sprite*)ret); - return 1; - } - } while (0); - ok = true; - do - { - if (argc == 1) - { - cocos2d::Texture2D* arg0; - ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.Sprite:createWithTexture"); - if (!ok) { break; } - cocos2d::Sprite* ret = cocos2d::Sprite::createWithTexture(arg0); - object_to_luaval(tolua_S, "cc.Sprite",(cocos2d::Sprite*)ret); - return 1; - } - } while (0); - ok = true; - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "cc.Sprite:createWithTexture",argc, 1); - return 0; -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_createWithTexture'.",&tolua_err); -#endif - return 0; -} -int lua_cocos2dx_Sprite_createWithSpriteFrameName(lua_State* tolua_S) -{ - int argc = 0; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertable(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - argc = lua_gettop(tolua_S) - 1; - - if (argc == 1) - { - std::string arg0; - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite:createWithSpriteFrameName"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_createWithSpriteFrameName'", nullptr); - return 0; - } - cocos2d::Sprite* ret = cocos2d::Sprite::createWithSpriteFrameName(arg0); - object_to_luaval(tolua_S, "cc.Sprite",(cocos2d::Sprite*)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Sprite:createWithSpriteFrameName",argc, 1); - return 0; -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_createWithSpriteFrameName'.",&tolua_err); -#endif - return 0; -} -int lua_cocos2dx_Sprite_createWithSpriteFrame(lua_State* tolua_S) -{ - int argc = 0; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertable(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - argc = lua_gettop(tolua_S) - 1; - - if (argc == 1) - { - cocos2d::SpriteFrame* arg0; - ok &= luaval_to_object(tolua_S, 2, "cc.SpriteFrame",&arg0, "cc.Sprite:createWithSpriteFrame"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_createWithSpriteFrame'", nullptr); - return 0; - } - cocos2d::Sprite* ret = cocos2d::Sprite::createWithSpriteFrame(arg0); - object_to_luaval(tolua_S, "cc.Sprite",(cocos2d::Sprite*)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Sprite:createWithSpriteFrame",argc, 1); - return 0; -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_createWithSpriteFrame'.",&tolua_err); -#endif - return 0; -} -int lua_cocos2dx_Sprite_constructor(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_constructor'", nullptr); - return 0; - } - cobj = new cocos2d::Sprite(); - cobj->autorelease(); - int ID = (int)cobj->_ID ; - int* luaID = &cobj->_luaID ; - toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)cobj,"cc.Sprite"); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:Sprite",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_constructor'.",&tolua_err); -#endif - - return 0; -} - -static int lua_cocos2dx_Sprite_finalize(lua_State* tolua_S) -{ - printf("luabindings: finalizing LUA object (Sprite)"); - return 0; -} - -int lua_register_cocos2dx_Sprite(lua_State* tolua_S) -{ - tolua_usertype(tolua_S,"cc.Sprite"); - tolua_cclass(tolua_S,"Sprite","cc.Sprite","cc.Node",nullptr); - - tolua_beginmodule(tolua_S,"Sprite"); - tolua_function(tolua_S,"new",lua_cocos2dx_Sprite_constructor); - tolua_function(tolua_S,"setSpriteFrame",lua_cocos2dx_Sprite_setSpriteFrame); - tolua_function(tolua_S,"setTexture",lua_cocos2dx_Sprite_setTexture); - tolua_function(tolua_S,"getTexture",lua_cocos2dx_Sprite_getTexture); - tolua_function(tolua_S,"setFlippedY",lua_cocos2dx_Sprite_setFlippedY); - tolua_function(tolua_S,"setFlippedX",lua_cocos2dx_Sprite_setFlippedX); - tolua_function(tolua_S,"getResourceType",lua_cocos2dx_Sprite_getResourceType); - tolua_function(tolua_S,"setDisplayFrameWithAnimationName",lua_cocos2dx_Sprite_setDisplayFrameWithAnimationName); - tolua_function(tolua_S,"getBatchNode",lua_cocos2dx_Sprite_getBatchNode); - tolua_function(tolua_S,"getOffsetPosition",lua_cocos2dx_Sprite_getOffsetPosition); - tolua_function(tolua_S,"getCenterRect",lua_cocos2dx_Sprite_getCenterRect); - tolua_function(tolua_S,"setCenterRectNormalized",lua_cocos2dx_Sprite_setCenterRectNormalized); - tolua_function(tolua_S,"isStretchEnabled",lua_cocos2dx_Sprite_isStretchEnabled); - tolua_function(tolua_S,"setTextureRect",lua_cocos2dx_Sprite_setTextureRect); - tolua_function(tolua_S,"initWithSpriteFrameName",lua_cocos2dx_Sprite_initWithSpriteFrameName); - tolua_function(tolua_S,"setStretchEnabled",lua_cocos2dx_Sprite_setStretchEnabled); - tolua_function(tolua_S,"isFrameDisplayed",lua_cocos2dx_Sprite_isFrameDisplayed); - tolua_function(tolua_S,"getAtlasIndex",lua_cocos2dx_Sprite_getAtlasIndex); - tolua_function(tolua_S,"setTextureAtlas",lua_cocos2dx_Sprite_setTextureAtlas); - tolua_function(tolua_S,"setBatchNode",lua_cocos2dx_Sprite_setBatchNode); - tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_Sprite_getBlendFunc); - tolua_function(tolua_S,"setCenterRect",lua_cocos2dx_Sprite_setCenterRect); - tolua_function(tolua_S,"getSpriteFrame",lua_cocos2dx_Sprite_getSpriteFrame); - tolua_function(tolua_S,"setVertexLayout",lua_cocos2dx_Sprite_setVertexLayout); - tolua_function(tolua_S,"removeAllChildrenWithCleanup",lua_cocos2dx_Sprite_removeAllChildrenWithCleanup); - tolua_function(tolua_S,"getResourceName",lua_cocos2dx_Sprite_getResourceName); - tolua_function(tolua_S,"isDirty",lua_cocos2dx_Sprite_isDirty); - tolua_function(tolua_S,"getCenterRectNormalized",lua_cocos2dx_Sprite_getCenterRectNormalized); - tolua_function(tolua_S,"setAtlasIndex",lua_cocos2dx_Sprite_setAtlasIndex); - tolua_function(tolua_S,"initWithTexture",lua_cocos2dx_Sprite_initWithTexture); - tolua_function(tolua_S,"setDirty",lua_cocos2dx_Sprite_setDirty); - tolua_function(tolua_S,"isTextureRectRotated",lua_cocos2dx_Sprite_isTextureRectRotated); - tolua_function(tolua_S,"getTextureRect",lua_cocos2dx_Sprite_getTextureRect); - tolua_function(tolua_S,"initWithFile",lua_cocos2dx_Sprite_initWithFile); - tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_Sprite_setBlendFunc); - tolua_function(tolua_S,"getTextureAtlas",lua_cocos2dx_Sprite_getTextureAtlas); - tolua_function(tolua_S,"initWithSpriteFrame",lua_cocos2dx_Sprite_initWithSpriteFrame); - tolua_function(tolua_S,"isFlippedX",lua_cocos2dx_Sprite_isFlippedX); - tolua_function(tolua_S,"isFlippedY",lua_cocos2dx_Sprite_isFlippedY); - tolua_function(tolua_S,"setVertexRect",lua_cocos2dx_Sprite_setVertexRect); - tolua_function(tolua_S,"createWithTexture", lua_cocos2dx_Sprite_createWithTexture); - tolua_function(tolua_S,"createWithSpriteFrameName", lua_cocos2dx_Sprite_createWithSpriteFrameName); - tolua_function(tolua_S,"createWithSpriteFrame", lua_cocos2dx_Sprite_createWithSpriteFrame); - tolua_endmodule(tolua_S); - auto typeName = typeid(cocos2d::Sprite).name(); // rtti is literal storage - g_luaType[reinterpret_cast(typeName)] = "cc.Sprite"; - g_typeCast[typeName] = "cc.Sprite"; - return 1; -} - int lua_cocos2dx_Layer_create(lua_State* tolua_S) { int argc = 0; @@ -59870,7 +57669,7 @@ static int lua_cocos2dx_Layer_finalize(lua_State* tolua_S) int lua_register_cocos2dx_Layer(lua_State* tolua_S) { tolua_usertype(tolua_S,"cc.Layer"); - tolua_cclass(tolua_S,"Layer","cc.Layer","cc.Sprite",nullptr); + tolua_cclass(tolua_S,"Layer","cc.Layer","cc.Node",nullptr); tolua_beginmodule(tolua_S,"Layer"); tolua_function(tolua_S,"new",lua_cocos2dx_Layer_constructor); @@ -59935,7 +57734,7 @@ int lua_cocos2dx_LayerColor_changeWidthAndHeight(lua_State* tolua_S) return 0; } -int lua_cocos2dx_LayerColor_changeHeight(lua_State* tolua_S) +int lua_cocos2dx_LayerColor_getBlendFunc(lua_State* tolua_S) { int argc = 0; cocos2d::LayerColor* cobj = nullptr; @@ -59955,7 +57754,104 @@ int lua_cocos2dx_LayerColor_changeHeight(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_LayerColor_changeHeight'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_LayerColor_getBlendFunc'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_LayerColor_getBlendFunc'", nullptr); + return 0; + } + const cocos2d::BlendFunc& ret = cobj->getBlendFunc(); + blendfunc_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.LayerColor:getBlendFunc",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_LayerColor_getBlendFunc'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_LayerColor_setBlendFunc(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::LayerColor* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.LayerColor",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::LayerColor*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_LayerColor_setBlendFunc'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::BlendFunc arg0; + + ok &= luaval_to_blendfunc(tolua_S, 2, &arg0, "cc.LayerColor:setBlendFunc"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_LayerColor_setBlendFunc'", nullptr); + return 0; + } + cobj->setBlendFunc(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.LayerColor:setBlendFunc",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_LayerColor_setBlendFunc'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_LayerColor_changeWidth(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::LayerColor* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.LayerColor",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::LayerColor*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_LayerColor_changeWidth'", nullptr); return 0; } #endif @@ -59965,22 +57861,22 @@ int lua_cocos2dx_LayerColor_changeHeight(lua_State* tolua_S) { double arg0; - ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.LayerColor:changeHeight"); + ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.LayerColor:changeWidth"); if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_LayerColor_changeHeight'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_LayerColor_changeWidth'", nullptr); return 0; } - cobj->changeHeight(arg0); + cobj->changeWidth(arg0); lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.LayerColor:changeHeight",argc, 1); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.LayerColor:changeWidth",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_LayerColor_changeHeight'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_LayerColor_changeWidth'.",&tolua_err); #endif return 0; @@ -60048,7 +57944,7 @@ int lua_cocos2dx_LayerColor_initWithColor(lua_State* tolua_S) return 0; } -int lua_cocos2dx_LayerColor_changeWidth(lua_State* tolua_S) +int lua_cocos2dx_LayerColor_changeHeight(lua_State* tolua_S) { int argc = 0; cocos2d::LayerColor* cobj = nullptr; @@ -60068,7 +57964,7 @@ int lua_cocos2dx_LayerColor_changeWidth(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_LayerColor_changeWidth'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_LayerColor_changeHeight'", nullptr); return 0; } #endif @@ -60078,22 +57974,22 @@ int lua_cocos2dx_LayerColor_changeWidth(lua_State* tolua_S) { double arg0; - ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.LayerColor:changeWidth"); + ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.LayerColor:changeHeight"); if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_LayerColor_changeWidth'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_LayerColor_changeHeight'", nullptr); return 0; } - cobj->changeWidth(arg0); + cobj->changeHeight(arg0); lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.LayerColor:changeWidth",argc, 1); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.LayerColor:changeHeight",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_LayerColor_changeWidth'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_LayerColor_changeHeight'.",&tolua_err); #endif return 0; @@ -60213,9 +58109,11 @@ int lua_register_cocos2dx_LayerColor(lua_State* tolua_S) tolua_beginmodule(tolua_S,"LayerColor"); tolua_function(tolua_S,"new",lua_cocos2dx_LayerColor_constructor); tolua_function(tolua_S,"changeWidthAndHeight",lua_cocos2dx_LayerColor_changeWidthAndHeight); - tolua_function(tolua_S,"changeHeight",lua_cocos2dx_LayerColor_changeHeight); - tolua_function(tolua_S,"initWithColor",lua_cocos2dx_LayerColor_initWithColor); + tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_LayerColor_getBlendFunc); + tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_LayerColor_setBlendFunc); tolua_function(tolua_S,"changeWidth",lua_cocos2dx_LayerColor_changeWidth); + tolua_function(tolua_S,"initWithColor",lua_cocos2dx_LayerColor_initWithColor); + tolua_function(tolua_S,"changeHeight",lua_cocos2dx_LayerColor_changeHeight); tolua_function(tolua_S,"create", lua_cocos2dx_LayerColor_create); tolua_endmodule(tolua_S); auto typeName = typeid(cocos2d::LayerColor).name(); // rtti is literal storage @@ -61058,6 +58956,53 @@ int lua_cocos2dx_LayerRadialGradient_getStartColor(lua_State* tolua_S) return 0; } +int lua_cocos2dx_LayerRadialGradient_getBlendFunc(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::LayerRadialGradient* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.LayerRadialGradient",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::LayerRadialGradient*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_LayerRadialGradient_getBlendFunc'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_LayerRadialGradient_getBlendFunc'", nullptr); + return 0; + } + cocos2d::BlendFunc ret = cobj->getBlendFunc(); + blendfunc_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.LayerRadialGradient:getBlendFunc",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_LayerRadialGradient_getBlendFunc'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_LayerRadialGradient_getStartColor3B(lua_State* tolua_S) { int argc = 0; @@ -61809,6 +59754,56 @@ int lua_cocos2dx_LayerRadialGradient_getExpand(lua_State* tolua_S) return 0; } +int lua_cocos2dx_LayerRadialGradient_setBlendFunc(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::LayerRadialGradient* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.LayerRadialGradient",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::LayerRadialGradient*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_LayerRadialGradient_setBlendFunc'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::BlendFunc arg0; + + ok &= luaval_to_blendfunc(tolua_S, 2, &arg0, "cc.LayerRadialGradient:setBlendFunc"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_LayerRadialGradient_setBlendFunc'", nullptr); + return 0; + } + cobj->setBlendFunc(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.LayerRadialGradient:setBlendFunc",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_LayerRadialGradient_setBlendFunc'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_LayerRadialGradient_getRadius(lua_State* tolua_S) { int argc = 0; @@ -61964,6 +59959,7 @@ int lua_register_cocos2dx_LayerRadialGradient(lua_State* tolua_S) tolua_beginmodule(tolua_S,"LayerRadialGradient"); tolua_function(tolua_S,"new",lua_cocos2dx_LayerRadialGradient_constructor); tolua_function(tolua_S,"getStartColor",lua_cocos2dx_LayerRadialGradient_getStartColor); + tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_LayerRadialGradient_getBlendFunc); tolua_function(tolua_S,"getStartColor3B",lua_cocos2dx_LayerRadialGradient_getStartColor3B); tolua_function(tolua_S,"getStartOpacity",lua_cocos2dx_LayerRadialGradient_getStartOpacity); tolua_function(tolua_S,"setCenter",lua_cocos2dx_LayerRadialGradient_setCenter); @@ -61979,6 +59975,7 @@ int lua_register_cocos2dx_LayerRadialGradient(lua_State* tolua_S) tolua_function(tolua_S,"setRadius",lua_cocos2dx_LayerRadialGradient_setRadius); tolua_function(tolua_S,"setStartColor",lua_cocos2dx_LayerRadialGradient_setStartColor); tolua_function(tolua_S,"getExpand",lua_cocos2dx_LayerRadialGradient_getExpand); + tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_LayerRadialGradient_setBlendFunc); tolua_function(tolua_S,"getRadius",lua_cocos2dx_LayerRadialGradient_getRadius); tolua_function(tolua_S,"create", lua_cocos2dx_LayerRadialGradient_create); tolua_endmodule(tolua_S); @@ -77015,6 +75012,2207 @@ int lua_register_cocos2dx_ProtectedNode(lua_State* tolua_S) return 1; } +int lua_cocos2dx_Sprite_setSpriteFrame(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setSpriteFrame'", nullptr); + return 0; + } +#endif + argc = lua_gettop(tolua_S)-1; + do{ + if (argc == 1) { + cocos2d::SpriteFrame* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.SpriteFrame",&arg0, "cc.Sprite:setSpriteFrame"); + + if (!ok) { break; } + cobj->setSpriteFrame(arg0); + lua_settop(tolua_S, 1); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 1) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite:setSpriteFrame"); + + if (!ok) { break; } + cobj->setSpriteFrame(arg0); + lua_settop(tolua_S, 1); + return 1; + } + }while(0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setSpriteFrame",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setSpriteFrame'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_setTexture(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setTexture'", nullptr); + return 0; + } +#endif + argc = lua_gettop(tolua_S)-1; + do{ + if (argc == 1) { + cocos2d::Texture2D* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.Sprite:setTexture"); + + if (!ok) { break; } + cobj->setTexture(arg0); + lua_settop(tolua_S, 1); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 1) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite:setTexture"); + + if (!ok) { break; } + cobj->setTexture(arg0); + lua_settop(tolua_S, 1); + return 1; + } + }while(0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setTexture",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setTexture'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_getTexture(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getTexture'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getTexture'", nullptr); + return 0; + } + cocos2d::Texture2D* ret = cobj->getTexture(); + object_to_luaval(tolua_S, "cc.Texture2D",(cocos2d::Texture2D*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getTexture",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getTexture'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_setFlippedY(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setFlippedY'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + bool arg0; + + ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Sprite:setFlippedY"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setFlippedY'", nullptr); + return 0; + } + cobj->setFlippedY(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setFlippedY",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setFlippedY'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_setFlippedX(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setFlippedX'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + bool arg0; + + ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Sprite:setFlippedX"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setFlippedX'", nullptr); + return 0; + } + cobj->setFlippedX(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setFlippedX",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setFlippedX'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_getResourceType(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getResourceType'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getResourceType'", nullptr); + return 0; + } + int ret = cobj->getResourceType(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getResourceType",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getResourceType'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_setDisplayFrameWithAnimationName(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setDisplayFrameWithAnimationName'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) + { + std::string arg0; + unsigned int arg1; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite:setDisplayFrameWithAnimationName"); + + ok &= luaval_to_uint32(tolua_S, 3,&arg1, "cc.Sprite:setDisplayFrameWithAnimationName"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setDisplayFrameWithAnimationName'", nullptr); + return 0; + } + cobj->setDisplayFrameWithAnimationName(arg0, arg1); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setDisplayFrameWithAnimationName",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setDisplayFrameWithAnimationName'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_getBatchNode(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getBatchNode'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getBatchNode'", nullptr); + return 0; + } + cocos2d::SpriteBatchNode* ret = cobj->getBatchNode(); + object_to_luaval(tolua_S, "cc.SpriteBatchNode",(cocos2d::SpriteBatchNode*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getBatchNode",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getBatchNode'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_getOffsetPosition(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getOffsetPosition'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getOffsetPosition'", nullptr); + return 0; + } + const cocos2d::Vec2& ret = cobj->getOffsetPosition(); + vec2_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getOffsetPosition",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getOffsetPosition'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_getCenterRect(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getCenterRect'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getCenterRect'", nullptr); + return 0; + } + cocos2d::Rect ret = cobj->getCenterRect(); + rect_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getCenterRect",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getCenterRect'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_setCenterRectNormalized(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setCenterRectNormalized'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::Rect arg0; + + ok &= luaval_to_rect(tolua_S, 2, &arg0, "cc.Sprite:setCenterRectNormalized"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setCenterRectNormalized'", nullptr); + return 0; + } + cobj->setCenterRectNormalized(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setCenterRectNormalized",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setCenterRectNormalized'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_isStretchEnabled(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_isStretchEnabled'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_isStretchEnabled'", nullptr); + return 0; + } + bool ret = cobj->isStretchEnabled(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:isStretchEnabled",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_isStretchEnabled'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_setTextureRect(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setTextureRect'", nullptr); + return 0; + } +#endif + argc = lua_gettop(tolua_S)-1; + do{ + if (argc == 3) { + cocos2d::Rect arg0; + ok &= luaval_to_rect(tolua_S, 2, &arg0, "cc.Sprite:setTextureRect"); + + if (!ok) { break; } + bool arg1; + ok &= luaval_to_boolean(tolua_S, 3,&arg1, "cc.Sprite:setTextureRect"); + + if (!ok) { break; } + cocos2d::Size arg2; + ok &= luaval_to_size(tolua_S, 4, &arg2, "cc.Sprite:setTextureRect"); + + if (!ok) { break; } + cobj->setTextureRect(arg0, arg1, arg2); + lua_settop(tolua_S, 1); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 1) { + cocos2d::Rect arg0; + ok &= luaval_to_rect(tolua_S, 2, &arg0, "cc.Sprite:setTextureRect"); + + if (!ok) { break; } + cobj->setTextureRect(arg0); + lua_settop(tolua_S, 1); + return 1; + } + }while(0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setTextureRect",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setTextureRect'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_initWithSpriteFrameName(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_initWithSpriteFrameName'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + std::string arg0; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite:initWithSpriteFrameName"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_initWithSpriteFrameName'", nullptr); + return 0; + } + bool ret = cobj->initWithSpriteFrameName(arg0); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:initWithSpriteFrameName",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_initWithSpriteFrameName'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_setStretchEnabled(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setStretchEnabled'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + bool arg0; + + ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Sprite:setStretchEnabled"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setStretchEnabled'", nullptr); + return 0; + } + cobj->setStretchEnabled(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setStretchEnabled",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setStretchEnabled'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_isFrameDisplayed(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_isFrameDisplayed'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::SpriteFrame* arg0; + + ok &= luaval_to_object(tolua_S, 2, "cc.SpriteFrame",&arg0, "cc.Sprite:isFrameDisplayed"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_isFrameDisplayed'", nullptr); + return 0; + } + bool ret = cobj->isFrameDisplayed(arg0); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:isFrameDisplayed",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_isFrameDisplayed'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_getAtlasIndex(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getAtlasIndex'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getAtlasIndex'", nullptr); + return 0; + } + unsigned int ret = cobj->getAtlasIndex(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getAtlasIndex",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getAtlasIndex'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_setTextureAtlas(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setTextureAtlas'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::TextureAtlas* arg0; + + ok &= luaval_to_object(tolua_S, 2, "cc.TextureAtlas",&arg0, "cc.Sprite:setTextureAtlas"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setTextureAtlas'", nullptr); + return 0; + } + cobj->setTextureAtlas(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setTextureAtlas",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setTextureAtlas'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_setBatchNode(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setBatchNode'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::SpriteBatchNode* arg0; + + ok &= luaval_to_object(tolua_S, 2, "cc.SpriteBatchNode",&arg0, "cc.Sprite:setBatchNode"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setBatchNode'", nullptr); + return 0; + } + cobj->setBatchNode(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setBatchNode",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setBatchNode'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_getBlendFunc(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getBlendFunc'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getBlendFunc'", nullptr); + return 0; + } + const cocos2d::BlendFunc& ret = cobj->getBlendFunc(); + blendfunc_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getBlendFunc",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getBlendFunc'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_setCenterRect(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setCenterRect'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::Rect arg0; + + ok &= luaval_to_rect(tolua_S, 2, &arg0, "cc.Sprite:setCenterRect"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setCenterRect'", nullptr); + return 0; + } + cobj->setCenterRect(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setCenterRect",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setCenterRect'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_getSpriteFrame(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getSpriteFrame'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getSpriteFrame'", nullptr); + return 0; + } + cocos2d::SpriteFrame* ret = cobj->getSpriteFrame(); + object_to_luaval(tolua_S, "cc.SpriteFrame",(cocos2d::SpriteFrame*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getSpriteFrame",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getSpriteFrame'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_setVertexLayout(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setVertexLayout'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setVertexLayout'", nullptr); + return 0; + } + cobj->setVertexLayout(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setVertexLayout",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setVertexLayout'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_removeAllChildrenWithCleanup(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_removeAllChildrenWithCleanup'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + bool arg0; + + ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Sprite:removeAllChildrenWithCleanup"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_removeAllChildrenWithCleanup'", nullptr); + return 0; + } + cobj->removeAllChildrenWithCleanup(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:removeAllChildrenWithCleanup",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_removeAllChildrenWithCleanup'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_getResourceName(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getResourceName'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getResourceName'", nullptr); + return 0; + } + const std::string& ret = cobj->getResourceName(); + lua_pushlstring(tolua_S,ret.c_str(),ret.length()); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getResourceName",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getResourceName'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_isDirty(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_isDirty'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_isDirty'", nullptr); + return 0; + } + bool ret = cobj->isDirty(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:isDirty",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_isDirty'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_getCenterRectNormalized(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getCenterRectNormalized'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getCenterRectNormalized'", nullptr); + return 0; + } + cocos2d::Rect ret = cobj->getCenterRectNormalized(); + rect_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getCenterRectNormalized",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getCenterRectNormalized'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_setAtlasIndex(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setAtlasIndex'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + unsigned int arg0; + + ok &= luaval_to_uint32(tolua_S, 2,&arg0, "cc.Sprite:setAtlasIndex"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setAtlasIndex'", nullptr); + return 0; + } + cobj->setAtlasIndex(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setAtlasIndex",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setAtlasIndex'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_initWithTexture(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_initWithTexture'", nullptr); + return 0; + } +#endif + argc = lua_gettop(tolua_S)-1; + do{ + if (argc == 2) { + cocos2d::Texture2D* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.Sprite:initWithTexture"); + + if (!ok) { break; } + cocos2d::Rect arg1; + ok &= luaval_to_rect(tolua_S, 3, &arg1, "cc.Sprite:initWithTexture"); + + if (!ok) { break; } + bool ret = cobj->initWithTexture(arg0, arg1); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 1) { + cocos2d::Texture2D* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.Sprite:initWithTexture"); + + if (!ok) { break; } + bool ret = cobj->initWithTexture(arg0); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 3) { + cocos2d::Texture2D* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.Sprite:initWithTexture"); + + if (!ok) { break; } + cocos2d::Rect arg1; + ok &= luaval_to_rect(tolua_S, 3, &arg1, "cc.Sprite:initWithTexture"); + + if (!ok) { break; } + bool arg2; + ok &= luaval_to_boolean(tolua_S, 4,&arg2, "cc.Sprite:initWithTexture"); + + if (!ok) { break; } + bool ret = cobj->initWithTexture(arg0, arg1, arg2); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + }while(0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:initWithTexture",argc, 3); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_initWithTexture'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_setDirty(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setDirty'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + bool arg0; + + ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Sprite:setDirty"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setDirty'", nullptr); + return 0; + } + cobj->setDirty(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setDirty",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setDirty'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_isTextureRectRotated(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_isTextureRectRotated'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_isTextureRectRotated'", nullptr); + return 0; + } + bool ret = cobj->isTextureRectRotated(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:isTextureRectRotated",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_isTextureRectRotated'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_getTextureRect(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getTextureRect'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getTextureRect'", nullptr); + return 0; + } + const cocos2d::Rect& ret = cobj->getTextureRect(); + rect_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getTextureRect",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getTextureRect'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_initWithFile(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_initWithFile'", nullptr); + return 0; + } +#endif + argc = lua_gettop(tolua_S)-1; + do{ + if (argc == 2) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite:initWithFile"); + + if (!ok) { break; } + cocos2d::Rect arg1; + ok &= luaval_to_rect(tolua_S, 3, &arg1, "cc.Sprite:initWithFile"); + + if (!ok) { break; } + bool ret = cobj->initWithFile(arg0, arg1); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 1) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite:initWithFile"); + + if (!ok) { break; } + bool ret = cobj->initWithFile(arg0); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + }while(0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:initWithFile",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_initWithFile'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_setBlendFunc(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setBlendFunc'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::BlendFunc arg0; + + ok &= luaval_to_blendfunc(tolua_S, 2, &arg0, "cc.Sprite:setBlendFunc"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setBlendFunc'", nullptr); + return 0; + } + cobj->setBlendFunc(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setBlendFunc",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setBlendFunc'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_getTextureAtlas(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_getTextureAtlas'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_getTextureAtlas'", nullptr); + return 0; + } + cocos2d::TextureAtlas* ret = cobj->getTextureAtlas(); + object_to_luaval(tolua_S, "cc.TextureAtlas",(cocos2d::TextureAtlas*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:getTextureAtlas",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_getTextureAtlas'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_initWithSpriteFrame(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_initWithSpriteFrame'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::SpriteFrame* arg0; + + ok &= luaval_to_object(tolua_S, 2, "cc.SpriteFrame",&arg0, "cc.Sprite:initWithSpriteFrame"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_initWithSpriteFrame'", nullptr); + return 0; + } + bool ret = cobj->initWithSpriteFrame(arg0); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:initWithSpriteFrame",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_initWithSpriteFrame'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_isFlippedX(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_isFlippedX'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_isFlippedX'", nullptr); + return 0; + } + bool ret = cobj->isFlippedX(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:isFlippedX",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_isFlippedX'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_isFlippedY(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_isFlippedY'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_isFlippedY'", nullptr); + return 0; + } + bool ret = cobj->isFlippedY(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:isFlippedY",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_isFlippedY'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_setVertexRect(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_setVertexRect'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::Rect arg0; + + ok &= luaval_to_rect(tolua_S, 2, &arg0, "cc.Sprite:setVertexRect"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_setVertexRect'", nullptr); + return 0; + } + cobj->setVertexRect(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:setVertexRect",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_setVertexRect'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite_createWithTexture(lua_State* tolua_S) +{ + int argc = 0; + bool ok = true; +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertable(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S)-1; + + do + { + if (argc == 2) + { + cocos2d::Texture2D* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.Sprite:createWithTexture"); + if (!ok) { break; } + cocos2d::Rect arg1; + ok &= luaval_to_rect(tolua_S, 3, &arg1, "cc.Sprite:createWithTexture"); + if (!ok) { break; } + cocos2d::Sprite* ret = cocos2d::Sprite::createWithTexture(arg0, arg1); + object_to_luaval(tolua_S, "cc.Sprite",(cocos2d::Sprite*)ret); + return 1; + } + } while (0); + ok = true; + do + { + if (argc == 3) + { + cocos2d::Texture2D* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.Sprite:createWithTexture"); + if (!ok) { break; } + cocos2d::Rect arg1; + ok &= luaval_to_rect(tolua_S, 3, &arg1, "cc.Sprite:createWithTexture"); + if (!ok) { break; } + bool arg2; + ok &= luaval_to_boolean(tolua_S, 4,&arg2, "cc.Sprite:createWithTexture"); + if (!ok) { break; } + cocos2d::Sprite* ret = cocos2d::Sprite::createWithTexture(arg0, arg1, arg2); + object_to_luaval(tolua_S, "cc.Sprite",(cocos2d::Sprite*)ret); + return 1; + } + } while (0); + ok = true; + do + { + if (argc == 1) + { + cocos2d::Texture2D* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.Sprite:createWithTexture"); + if (!ok) { break; } + cocos2d::Sprite* ret = cocos2d::Sprite::createWithTexture(arg0); + object_to_luaval(tolua_S, "cc.Sprite",(cocos2d::Sprite*)ret); + return 1; + } + } while (0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "cc.Sprite:createWithTexture",argc, 1); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_createWithTexture'.",&tolua_err); +#endif + return 0; +} +int lua_cocos2dx_Sprite_createWithSpriteFrameName(lua_State* tolua_S) +{ + int argc = 0; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertable(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 1) + { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite:createWithSpriteFrameName"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_createWithSpriteFrameName'", nullptr); + return 0; + } + cocos2d::Sprite* ret = cocos2d::Sprite::createWithSpriteFrameName(arg0); + object_to_luaval(tolua_S, "cc.Sprite",(cocos2d::Sprite*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Sprite:createWithSpriteFrameName",argc, 1); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_createWithSpriteFrameName'.",&tolua_err); +#endif + return 0; +} +int lua_cocos2dx_Sprite_createWithSpriteFrame(lua_State* tolua_S) +{ + int argc = 0; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertable(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 1) + { + cocos2d::SpriteFrame* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.SpriteFrame",&arg0, "cc.Sprite:createWithSpriteFrame"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_createWithSpriteFrame'", nullptr); + return 0; + } + cocos2d::Sprite* ret = cocos2d::Sprite::createWithSpriteFrame(arg0); + object_to_luaval(tolua_S, "cc.Sprite",(cocos2d::Sprite*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Sprite:createWithSpriteFrame",argc, 1); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_createWithSpriteFrame'.",&tolua_err); +#endif + return 0; +} +int lua_cocos2dx_Sprite_constructor(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_constructor'", nullptr); + return 0; + } + cobj = new cocos2d::Sprite(); + cobj->autorelease(); + int ID = (int)cobj->_ID ; + int* luaID = &cobj->_luaID ; + toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)cobj,"cc.Sprite"); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:Sprite",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_constructor'.",&tolua_err); +#endif + + return 0; +} + +static int lua_cocos2dx_Sprite_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (Sprite)"); + return 0; +} + +int lua_register_cocos2dx_Sprite(lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"cc.Sprite"); + tolua_cclass(tolua_S,"Sprite","cc.Sprite","cc.Node",nullptr); + + tolua_beginmodule(tolua_S,"Sprite"); + tolua_function(tolua_S,"new",lua_cocos2dx_Sprite_constructor); + tolua_function(tolua_S,"setSpriteFrame",lua_cocos2dx_Sprite_setSpriteFrame); + tolua_function(tolua_S,"setTexture",lua_cocos2dx_Sprite_setTexture); + tolua_function(tolua_S,"getTexture",lua_cocos2dx_Sprite_getTexture); + tolua_function(tolua_S,"setFlippedY",lua_cocos2dx_Sprite_setFlippedY); + tolua_function(tolua_S,"setFlippedX",lua_cocos2dx_Sprite_setFlippedX); + tolua_function(tolua_S,"getResourceType",lua_cocos2dx_Sprite_getResourceType); + tolua_function(tolua_S,"setDisplayFrameWithAnimationName",lua_cocos2dx_Sprite_setDisplayFrameWithAnimationName); + tolua_function(tolua_S,"getBatchNode",lua_cocos2dx_Sprite_getBatchNode); + tolua_function(tolua_S,"getOffsetPosition",lua_cocos2dx_Sprite_getOffsetPosition); + tolua_function(tolua_S,"getCenterRect",lua_cocos2dx_Sprite_getCenterRect); + tolua_function(tolua_S,"setCenterRectNormalized",lua_cocos2dx_Sprite_setCenterRectNormalized); + tolua_function(tolua_S,"isStretchEnabled",lua_cocos2dx_Sprite_isStretchEnabled); + tolua_function(tolua_S,"setTextureRect",lua_cocos2dx_Sprite_setTextureRect); + tolua_function(tolua_S,"initWithSpriteFrameName",lua_cocos2dx_Sprite_initWithSpriteFrameName); + tolua_function(tolua_S,"setStretchEnabled",lua_cocos2dx_Sprite_setStretchEnabled); + tolua_function(tolua_S,"isFrameDisplayed",lua_cocos2dx_Sprite_isFrameDisplayed); + tolua_function(tolua_S,"getAtlasIndex",lua_cocos2dx_Sprite_getAtlasIndex); + tolua_function(tolua_S,"setTextureAtlas",lua_cocos2dx_Sprite_setTextureAtlas); + tolua_function(tolua_S,"setBatchNode",lua_cocos2dx_Sprite_setBatchNode); + tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_Sprite_getBlendFunc); + tolua_function(tolua_S,"setCenterRect",lua_cocos2dx_Sprite_setCenterRect); + tolua_function(tolua_S,"getSpriteFrame",lua_cocos2dx_Sprite_getSpriteFrame); + tolua_function(tolua_S,"setVertexLayout",lua_cocos2dx_Sprite_setVertexLayout); + tolua_function(tolua_S,"removeAllChildrenWithCleanup",lua_cocos2dx_Sprite_removeAllChildrenWithCleanup); + tolua_function(tolua_S,"getResourceName",lua_cocos2dx_Sprite_getResourceName); + tolua_function(tolua_S,"isDirty",lua_cocos2dx_Sprite_isDirty); + tolua_function(tolua_S,"getCenterRectNormalized",lua_cocos2dx_Sprite_getCenterRectNormalized); + tolua_function(tolua_S,"setAtlasIndex",lua_cocos2dx_Sprite_setAtlasIndex); + tolua_function(tolua_S,"initWithTexture",lua_cocos2dx_Sprite_initWithTexture); + tolua_function(tolua_S,"setDirty",lua_cocos2dx_Sprite_setDirty); + tolua_function(tolua_S,"isTextureRectRotated",lua_cocos2dx_Sprite_isTextureRectRotated); + tolua_function(tolua_S,"getTextureRect",lua_cocos2dx_Sprite_getTextureRect); + tolua_function(tolua_S,"initWithFile",lua_cocos2dx_Sprite_initWithFile); + tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_Sprite_setBlendFunc); + tolua_function(tolua_S,"getTextureAtlas",lua_cocos2dx_Sprite_getTextureAtlas); + tolua_function(tolua_S,"initWithSpriteFrame",lua_cocos2dx_Sprite_initWithSpriteFrame); + tolua_function(tolua_S,"isFlippedX",lua_cocos2dx_Sprite_isFlippedX); + tolua_function(tolua_S,"isFlippedY",lua_cocos2dx_Sprite_isFlippedY); + tolua_function(tolua_S,"setVertexRect",lua_cocos2dx_Sprite_setVertexRect); + tolua_function(tolua_S,"createWithTexture", lua_cocos2dx_Sprite_createWithTexture); + tolua_function(tolua_S,"createWithSpriteFrameName", lua_cocos2dx_Sprite_createWithSpriteFrameName); + tolua_function(tolua_S,"createWithSpriteFrame", lua_cocos2dx_Sprite_createWithSpriteFrame); + tolua_endmodule(tolua_S); + auto typeName = typeid(cocos2d::Sprite).name(); // rtti is literal storage + g_luaType[reinterpret_cast(typeName)] = "cc.Sprite"; + g_typeCast[typeName] = "cc.Sprite"; + return 1; +} + int lua_cocos2dx_RenderTexture_setVirtualViewport(lua_State* tolua_S) { int argc = 0; @@ -106225,7 +106423,6 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S) lua_register_cocos2dx_EaseQuadraticActionOut(tolua_S); lua_register_cocos2dx_TransitionProgress(tolua_S); lua_register_cocos2dx_TransitionProgressVertical(tolua_S); - lua_register_cocos2dx_Sprite(tolua_S); lua_register_cocos2dx_Layer(tolua_S); lua_register_cocos2dx_Grid3DAction(tolua_S); lua_register_cocos2dx_BaseLight(tolua_S); @@ -106419,6 +106616,7 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S) lua_register_cocos2dx_MotionStreak(tolua_S); lua_register_cocos2dx_RotateBy(tolua_S); lua_register_cocos2dx_FileUtils(tolua_S); + lua_register_cocos2dx_Sprite(tolua_S); lua_register_cocos2dx_TransitionSlideInT(tolua_S); lua_register_cocos2dx_ProgressTo(tolua_S); lua_register_cocos2dx_TransitionProgressOutIn(tolua_S); diff --git a/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp b/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp index facd9cb94e..2bcb64b12d 100644 --- a/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -2325,6 +2325,10 @@ int register_all_cocos2dx(lua_State* tolua_S); + + + + diff --git a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp index 1b86e03172..03a32b70be 100644 --- a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp +++ b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp @@ -957,7 +957,7 @@ void ActionCallFunction::callback3(Node* sender, int32_t data) label->setPosition(s.width/4*3,s.height/2); addChild(label); - CCLOG("target is: %p, data is: %ld", sender, data); + CCLOG("target is: %p, data is: %d", sender, data); } std::string ActionCallFunction::subtitle() const diff --git a/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp b/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp index 9f03e2456d..a833ad3fb8 100644 --- a/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp +++ b/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp @@ -900,7 +900,7 @@ void CameraCullingDemo::addSpriteCallback(Ref* sender) // update sprite number char szText[16]; - sprintf(szText,"%ld sprits", static_cast(_layer3D->getChildrenCount())); + sprintf(szText,"%d sprits", static_cast(_layer3D->getChildrenCount())); _labelSprite3DCount->setString(szText); } @@ -928,7 +928,7 @@ void CameraCullingDemo::delSpriteCallback(Ref* sender) // update sprite number char szText[16]; - sprintf(szText,"%ld sprits", static_cast(_layer3D->getChildrenCount())); + sprintf(szText,"%l sprits", static_cast(_layer3D->getChildrenCount())); _labelSprite3DCount->setString(szText); } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp index 6db8a02f3c..ced3c807ae 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp @@ -71,7 +71,7 @@ bool TableViewTest::init() void TableViewTest::tableCellTouched(TableView* table, TableViewCell* cell) { - CCLOG("cell touched at index: %ld", static_cast(cell->getIdx())); + CCLOG("cell touched at index: %d", static_cast(cell->getIdx())); } Size TableViewTest::tableCellSizeForIndex(TableView *table, ssize_t idx) @@ -84,7 +84,7 @@ Size TableViewTest::tableCellSizeForIndex(TableView *table, ssize_t idx) TableViewCell* TableViewTest::tableCellAtIndex(TableView *table, ssize_t idx) { - auto string = StringUtils::format("%ld", static_cast(idx)); + auto string = StringUtils::format("%d", static_cast(idx)); TableViewCell *cell = table->dequeueCell(); if (!cell) { cell = new (std::nothrow) CustomTableViewCell(); diff --git a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp index a16ff5af97..831a1e2cdc 100644 --- a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp +++ b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp @@ -374,7 +374,7 @@ void TestFileFuncs::onEnter() // getFileSize Test int32_t size = sharedFileUtils->getFileSize(filepath); - msg = StringUtils::format("getFileSize: Test file size equals %ld", size); + msg = StringUtils::format("getFileSize: Test file size equals %d", size); label = Label::createWithSystemFont(msg, "", 20); label->setPosition(x, y * 3); this->addChild(label); @@ -1161,7 +1161,7 @@ void TestFileFuncsAsync::onEnter() this->addChild(label); sharedFileUtils->getFileSize(filepath, [=](int32_t size) { - auto msg = StringUtils::format("getFileSize: Test file size equals %ld", size); + auto msg = StringUtils::format("getFileSize: Test file size equals %d", size); auto label = Label::createWithSystemFont(msg, "", 20); label->setPosition(x, y * 3); this->addChild(label); diff --git a/tests/cpp-tests/Classes/NetworkTest/HttpClientTest/HttpClientTest.cpp b/tests/cpp-tests/Classes/NetworkTest/HttpClientTest/HttpClientTest.cpp index 0494cf5281..9891b415c1 100644 --- a/tests/cpp-tests/Classes/NetworkTest/HttpClientTest/HttpClientTest.cpp +++ b/tests/cpp-tests/Classes/NetworkTest/HttpClientTest/HttpClientTest.cpp @@ -313,9 +313,9 @@ void HttpClientTest::onHttpRequestCompleted(HttpClient *sender, HttpResponse *re int32_t statusCode = response->getResponseCode(); char statusString[64] = {}; - sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag()); + sprintf(statusString, "HTTP Status Code: %d, tag = %s", statusCode, response->getHttpRequest()->getTag()); _labelStatusCode->setString(statusString); - log("response code: %ld", statusCode); + log("response code: %d", statusCode); if (response->getResponseCode() != 200) { @@ -462,9 +462,9 @@ void HttpClientClearRequestsTest::onHttpRequestCompleted(HttpClient *sender, Htt int32_t statusCode = response->getResponseCode(); char statusString[64] = {}; - sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag()); + sprintf(statusString, "HTTP Status Code: %d, tag = %s", statusCode, response->getHttpRequest()->getTag()); _labelStatusCode->setString(statusString); - log("response code: %ld", statusCode); + log("response code: %d", statusCode); _totalProcessedRequests++; sprintf(statusString, "Got %d of %d expected http requests", _totalProcessedRequests, _totalExpectedRequests); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp index 18e62bb436..d0657f013c 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp @@ -129,7 +129,7 @@ void UIPageViewTest::pageViewEvent(Ref *pSender, PageView::EventType type) { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); + _displayValueLabel->setString(StringUtils::format("page = %d", static_cast(pageView->getCurrentPageIndex() + 1))); } break; @@ -241,7 +241,7 @@ void UIPageViewButtonTest::pageViewEvent(Ref *pSender, PageView::EventType type) { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); + _displayValueLabel->setString(StringUtils::format("page = %d", static_cast(pageView->getCurrentPageIndex() + 1))); } break; @@ -438,7 +438,7 @@ void UIPageViewTouchPropagationTest::pageViewEvent(Ref *pSender, PageView::Event { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); + _displayValueLabel->setString(StringUtils::format("page = %d", static_cast(pageView->getCurrentPageIndex() + 1))); } break; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp index 2def10a868..e30ad08900 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp @@ -67,12 +67,12 @@ bool UIRichTextTest::init() std::string str1 = config->getValue("Chinese").asString(); std::string str2 = config->getValue("Japanese").asString(); - CCLOG("str1:%s ascii length = %ld, utf8 length = %ld, substr = %s", + CCLOG("str1:%s ascii length = %d, utf8 length = %d, substr = %s", str1.c_str(), static_cast(str1.length()), StringUtils::getCharacterCountInUTF8String(str1), Helper::getSubStringOfUTF8String(str1, 0, 5).c_str()); - CCLOG("str2:%s ascii length = %ld, utf8 length = %ld, substr = %s", + CCLOG("str2:%s ascii length = %d, utf8 length = %d, substr = %s", str2.c_str(), static_cast(str2.length()), StringUtils::getCharacterCountInUTF8String(str2), From 78236079e86a489635c657acbc86b4217685f952 Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 17:54:13 +1000 Subject: [PATCH 12/19] More %ld to %d changes --- .../UIPageViewTest/UIPageViewTest.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp index d0657f013c..1513af4265 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp @@ -558,7 +558,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init() } pageView->pushBackCustomItem(outerBox); - _displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast(pageView->getItems().size()))); + _displayValueLabel->setString(StringUtils::format("page count = %d", static_cast(pageView->getItems().size()))); CCLOG("current page index = %zd", pageView->getCurrentPageIndex()); }); _uiLayer->addChild(button); @@ -579,7 +579,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init() { CCLOG("There is no page to remove!"); } - _displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast(pageView->getItems().size()))); + _displayValueLabel->setString(StringUtils::format("page count = %d", static_cast(pageView->getItems().size()))); CCLOG("current page index = %zd", pageView->getCurrentPageIndex()); }); @@ -594,7 +594,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init() button3->addClickEventListener([=](Ref* sender) { pageView->removeAllItems(); - _displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast(pageView->getItems().size()))); + _displayValueLabel->setString(StringUtils::format("page count = %d", static_cast(pageView->getItems().size()))); CCLOG("current page index = %zd", pageView->getCurrentPageIndex()); }); @@ -623,7 +623,7 @@ void UIPageViewDynamicAddAndRemoveTest::pageViewEvent(Ref *pSender, PageView::Ev { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast((pageView->getCurrentPageIndex() + 1)))); + _displayValueLabel->setString(StringUtils::format("page = %d", static_cast((pageView->getCurrentPageIndex() + 1)))); } break; @@ -825,7 +825,7 @@ void UIPageViewVerticalTest::pageViewEvent(Ref *pSender, PageView::EventType typ { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); + _displayValueLabel->setString(StringUtils::format("page = %d", static_cast(pageView->getCurrentPageIndex() + 1))); } break; @@ -984,7 +984,7 @@ void UIPageViewChildSizeTest::pageViewEvent(Ref *pSender, PageView::EventType ty { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); + _displayValueLabel->setString(StringUtils::format("page = %d", static_cast(pageView->getCurrentPageIndex() + 1))); } break; From 568e3612bdafd6f508e8a7aa589b5f29143ad56f Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 20:30:20 +1000 Subject: [PATCH 13/19] Remove getLong() method Change %du to %u, and %lx to %x Use "stdint.h" instead of for TGAlib.h --- cocos/base/CCProfiling.cpp | 2 +- cocos/base/CCProperties.cpp | 19 ------------------- cocos/base/CCProperties.h | 12 ------------ cocos/base/TGAlib.h | 2 +- cocos/renderer/CCTexture2D.cpp | 2 +- 5 files changed, 3 insertions(+), 34 deletions(-) diff --git a/cocos/base/CCProfiling.cpp b/cocos/base/CCProfiling.cpp index de7e90fd8f..2092be2dae 100644 --- a/cocos/base/CCProfiling.cpp +++ b/cocos/base/CCProfiling.cpp @@ -115,7 +115,7 @@ std::string ProfilingTimer::getDescription() const { static char s_description[512] = {0}; - sprintf(s_description, "%s ::\tavg1: %du,\tavg2: %du,\tmin: %du,\tmax: %du,\ttotal: %.2fs,\tnr calls: %d", _nameStr.c_str(), _averageTime1, _averageTime2, minTime, maxTime, totalTime/1000000., numberOfCalls); + sprintf(s_description, "%s ::\tavg1: %u,\tavg2: %u,\tmin: %u,\tmax: %u,\ttotal: %.2fs,\tnr calls: %d", _nameStr.c_str(), _averageTime1, _averageTime2, minTime, maxTime, totalTime/1000000., numberOfCalls); return s_description; } diff --git a/cocos/base/CCProperties.cpp b/cocos/base/CCProperties.cpp index 6a5d8f4a26..6c81237b44 100644 --- a/cocos/base/CCProperties.cpp +++ b/cocos/base/CCProperties.cpp @@ -895,25 +895,6 @@ float Properties::getFloat(const char* name) const return 0.0f; } -int32_t Properties::getLong(const char* name) const -{ - const char* valueString = getString(name); - if (valueString) - { - int32_t value; - int scanned; - scanned = sscanf(valueString, "%d", &value); - if (scanned != 1) - { - CCLOGERROR("Error attempting to parse property '%s' as a long integer.", name); - return 0L; - } - return value; - } - - return 0L; -} - bool Properties::getMat4(const char* name, Mat4* out) const { CCASSERT(out, "Invalid out"); diff --git a/cocos/base/CCProperties.h b/cocos/base/CCProperties.h index ccbe5c3959..6994beed0e 100644 --- a/cocos/base/CCProperties.h +++ b/cocos/base/CCProperties.h @@ -327,18 +327,6 @@ public: */ float getFloat(const char* name = NULL) const; - /** - * Interpret the value of the given property as a long integer. - * If the property does not exist, zero will be returned. - * If the property exists but could not be scanned, an error will be logged and zero will be returned. - * - * @param name The name of the property to interpret, or NULL to return the current property's value. - * - * @return The value of the given property interpreted as a long. - * Zero if the property does not exist or could not be scanned. - */ - int32_t getLong(const char* name = NULL) const; - /** * Interpret the value of the given property as a Matrix. * If the property does not exist, out will be set to the identity matrix. diff --git a/cocos/base/TGAlib.h b/cocos/base/TGAlib.h index 2471802e18..294f5b307e 100644 --- a/cocos/base/TGAlib.h +++ b/cocos/base/TGAlib.h @@ -28,7 +28,7 @@ THE SOFTWARE. #define __SUPPORT_DATA_SUPPORT_TGALIB_H__ /// @cond DO_NOT_SHOW -#include +#include "stdint.h" namespace cocos2d { diff --git a/cocos/renderer/CCTexture2D.cpp b/cocos/renderer/CCTexture2D.cpp index 1a0088eb8c..eee94c8b2f 100644 --- a/cocos/renderer/CCTexture2D.cpp +++ b/cocos/renderer/CCTexture2D.cpp @@ -284,7 +284,7 @@ bool Texture2D::updateWithMipmaps(MipmapInfo* mipmaps, int mipmapsNum, backend:: auto& pfd = backend::PixelFormatUtils::getFormatDescriptor(pixelFormat); if (!pfd.bpp) { - CCLOG("cocos2d: WARNING: unsupported pixelformat: %lx", (uint32_t)pixelFormat); + CCLOG("cocos2d: WARNING: unsupported pixelformat: %x", (uint32_t)pixelFormat); #ifdef CC_USE_METAL CCASSERT(false, "pixeformat not found in _pixelFormatInfoTables, register required!"); #endif From 9cfc16ee38d1df4b1520f69452f900686f471c93 Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 20:43:37 +1000 Subject: [PATCH 14/19] Support 64 bit versions of posix lseek --- cocos/platform/CCPosixFileStream.cpp | 2 +- cocos/platform/CCPosixFileStream.h | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cocos/platform/CCPosixFileStream.cpp b/cocos/platform/CCPosixFileStream.cpp index cfff079c1a..a893c0f1e5 100644 --- a/cocos/platform/CCPosixFileStream.cpp +++ b/cocos/platform/CCPosixFileStream.cpp @@ -41,7 +41,7 @@ static int pfs_posix_open(const std::string& path, FileStream::Mode mode, PXFile // posix standard wrappers static int pfs_posix_read(PXFileHandle& handle, void* buf, unsigned int size) { return static_cast(posix_read(handle._fd, buf, size)); } -static off_t pfs_posix_seek(PXFileHandle& handle, off_t offst, int origin) { return posix_lseek(handle._fd, offst, origin); } +static off_t pfs_posix_seek(PXFileHandle& handle, off_t offst, int origin) { return posix_lseek64(handle._fd, offst, origin); } static int pfs_posix_close(PXFileHandle& handle) { int fd = handle._fd; if (fd != -1) { diff --git a/cocos/platform/CCPosixFileStream.h b/cocos/platform/CCPosixFileStream.h index f3624aaced..8fc06e22b7 100644 --- a/cocos/platform/CCPosixFileStream.h +++ b/cocos/platform/CCPosixFileStream.h @@ -36,11 +36,19 @@ #define posix_open(path, ...) ::_wopen(ntcvt::from_chars(path).c_str(), ##__VA_ARGS__) #define posix_close ::_close #define posix_lseek ::_lseek +#define posix_lseek64 ::_lseeki64 #define posix_read ::_read #define posix_write ::_write #define posix_fd2fh(fd) reinterpret_cast(_get_osfhandle(fd)) #define posix_fsetsize(fd, size) ::_chsize(fd, size) #else + +#if defined(__APPLE__) +# define posix_lseek64 ::lseek +#else +# define posix_lseek64 ::lseek64 +#endif + #define O_READ_FLAGS O_RDONLY #define O_WRITE_FLAGS O_CREAT | O_RDWR | O_TRUNC, S_IRWXU #define O_APPEND_FLAGS O_APPEND | O_CREAT | O_RDWR, S_IRWXU From 456d26628c77eb3d02d91868179101d4d1ec7b60 Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 21:18:23 +1000 Subject: [PATCH 15/19] Change off_t to int64_t --- cocos/base/CCUserDefault.cpp | 4 ++-- cocos/platform/CCPosixFileStream.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cocos/base/CCUserDefault.cpp b/cocos/base/CCUserDefault.cpp index d5512acb35..b3c499b832 100644 --- a/cocos/base/CCUserDefault.cpp +++ b/cocos/base/CCUserDefault.cpp @@ -382,8 +382,8 @@ void UserDefault::lazyInit() return; } - int filesize = static_cast(posix_lseek(_fd, 0, SEEK_END)); - posix_lseek(_fd, 0, SEEK_SET); + int filesize = static_cast(posix_lseek64(_fd, 0, SEEK_END)); + posix_lseek64(_fd, 0, SEEK_SET); if (filesize < _curMapSize) { // construct a empty file mapping posix_fsetsize(_fd, _curMapSize); diff --git a/cocos/platform/CCPosixFileStream.cpp b/cocos/platform/CCPosixFileStream.cpp index a893c0f1e5..3a43e95215 100644 --- a/cocos/platform/CCPosixFileStream.cpp +++ b/cocos/platform/CCPosixFileStream.cpp @@ -13,7 +13,7 @@ NS_CC_BEGIN struct PXIoF { int(*read)(PXFileHandle& handle, void*, unsigned int); - off_t(*seek)(PXFileHandle& handle, off_t, int); + int64_t(*seek)(PXFileHandle& handle, int64_t, int); int(*close)(PXFileHandle& handle); long long(*size)(PXFileHandle& handle); }; @@ -41,7 +41,7 @@ static int pfs_posix_open(const std::string& path, FileStream::Mode mode, PXFile // posix standard wrappers static int pfs_posix_read(PXFileHandle& handle, void* buf, unsigned int size) { return static_cast(posix_read(handle._fd, buf, size)); } -static off_t pfs_posix_seek(PXFileHandle& handle, off_t offst, int origin) { return posix_lseek64(handle._fd, offst, origin); } +static int64_t pfs_posix_seek(PXFileHandle& handle, int64_t offst, int origin) { return posix_lseek64(handle._fd, offst, origin); } static int pfs_posix_close(PXFileHandle& handle) { int fd = handle._fd; if (fd != -1) { @@ -74,7 +74,7 @@ static PXIoF pfs_posix_iof = { #if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID // android AssetManager wrappers static int pfs_asset_read(PXFileHandle& handle, void* buf, unsigned int size) { return AAsset_read(handle._asset, buf, size); } -static off_t pfs_asset_seek(PXFileHandle& handle, off_t offst, int origin) { return AAsset_seek(handle._asset, offst, origin); } +static int64_t pfs_asset_seek(PXFileHandle& handle, int64_t offst, int origin) { return AAsset_seek(handle._asset, offst, origin); } static int pfs_asset_close(PXFileHandle& handle) { if (handle._asset != nullptr) { AAsset_close(handle._asset); @@ -95,7 +95,7 @@ static PXIoF pfs_asset_iof = { // android obb static int pfs_obb_read(PXFileHandle& handle, void* buf, unsigned int size) { return FileUtilsAndroid::getObbFile()->zfread(&handle._zfs, buf, size); } -static off_t pfs_obb_seek(PXFileHandle& handle, off_t offset, int origin) { return FileUtilsAndroid::getObbFile()->zfseek(&handle._zfs, offset, origin); } +static int64_t pfs_obb_seek(PXFileHandle& handle, int64_t offset, int origin) { return FileUtilsAndroid::getObbFile()->zfseek(&handle._zfs, offset, origin); } static int pfs_obb_close(PXFileHandle& handle) { FileUtilsAndroid::getObbFile()->zfclose(&handle._zfs); return 0; From bc0a5f42f8d6bb8a068ef7a4b296792efeb09406 Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 21:21:28 +1000 Subject: [PATCH 16/19] Windows callback requires `long` return type --- tests/cpp-tests/Classes/controller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cpp-tests/Classes/controller.cpp b/tests/cpp-tests/Classes/controller.cpp index 7e0647b1b2..9f991eec05 100644 --- a/tests/cpp-tests/Classes/controller.cpp +++ b/tests/cpp-tests/Classes/controller.cpp @@ -494,7 +494,7 @@ bool TestController::blockTouchBegan(Touch* touch, Event* event) #if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 #include -static int32_t __stdcall windowExceptionFilter(_EXCEPTION_POINTERS* excp) +static long __stdcall windowExceptionFilter(_EXCEPTION_POINTERS* excp) { if (s_testController) { From 69d603930645aa8cc0497b2c6de5c1e9f710147f Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 21:24:45 +1000 Subject: [PATCH 17/19] Update lua bindings --- .../lua-bindings/auto/lua_cocos2dx_auto.cpp | 1114 ++++++++--------- .../lua-bindings/auto/lua_cocos2dx_auto.hpp | 1 - 2 files changed, 526 insertions(+), 589 deletions(-) diff --git a/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index 3a0b98fae5..c585703312 100644 --- a/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -29451,7 +29451,7 @@ int lua_register_cocos2dx_ActionFloat(lua_State* tolua_S) return 1; } -int lua_cocos2dx_Properties_getVariable(lua_State* tolua_S) +int lua_cocos2dx_Properties_setVariable(lua_State* tolua_S) { int argc = 0; cocos2d::Properties* cobj = nullptr; @@ -29471,49 +29471,157 @@ int lua_cocos2dx_Properties_getVariable(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_getVariable'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_setVariable'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - const char* arg0; - - std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getVariable"); arg0 = arg0_tmp.c_str(); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getVariable'", nullptr); - return 0; - } - const char* ret = cobj->getVariable(arg0); - tolua_pushstring(tolua_S,(const char*)ret); - return 1; - } if (argc == 2) { const char* arg0; const char* arg1; - std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getVariable"); arg0 = arg0_tmp.c_str(); + std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:setVariable"); arg0 = arg0_tmp.c_str(); - std::string arg1_tmp; ok &= luaval_to_std_string(tolua_S, 3, &arg1_tmp, "cc.Properties:getVariable"); arg1 = arg1_tmp.c_str(); + std::string arg1_tmp; ok &= luaval_to_std_string(tolua_S, 3, &arg1_tmp, "cc.Properties:setVariable"); arg1 = arg1_tmp.c_str(); if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getVariable'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_setVariable'", nullptr); return 0; } - const char* ret = cobj->getVariable(arg0, arg1); - tolua_pushstring(tolua_S,(const char*)ret); + cobj->setVariable(arg0, arg1); + lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:getVariable",argc, 1); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:setVariable",argc, 2); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_getVariable'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_setVariable'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Properties_getFloat(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Properties* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Properties",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Properties*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_getFloat'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getFloat'", nullptr); + return 0; + } + double ret = cobj->getFloat(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + if (argc == 1) + { + const char* arg0; + + std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getFloat"); arg0 = arg0_tmp.c_str(); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getFloat'", nullptr); + return 0; + } + double ret = cobj->getFloat(arg0); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:getFloat",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_getFloat'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Properties_getType(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Properties* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Properties",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Properties*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_getType'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getType'", nullptr); + return 0; + } + int ret = (int)cobj->getType(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + if (argc == 1) + { + const char* arg0; + + std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getType"); arg0 = arg0_tmp.c_str(); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getType'", nullptr); + return 0; + } + int ret = (int)cobj->getType(arg0); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:getType",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_getType'.",&tolua_err); #endif return 0; @@ -29596,7 +29704,7 @@ int lua_cocos2dx_Properties_getString(lua_State* tolua_S) return 0; } -int lua_cocos2dx_Properties_getLong(lua_State* tolua_S) +int lua_cocos2dx_Properties_exists(lua_State* tolua_S) { int argc = 0; cocos2d::Properties* cobj = nullptr; @@ -29616,7 +29724,173 @@ int lua_cocos2dx_Properties_getLong(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_getLong'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_exists'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + const char* arg0; + + std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:exists"); arg0 = arg0_tmp.c_str(); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_exists'", nullptr); + return 0; + } + bool ret = cobj->exists(arg0); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:exists",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_exists'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Properties_getColor(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Properties* cobj = nullptr; + bool ok = true; +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Properties",0,&tolua_err)) goto tolua_lerror; +#endif + cobj = (cocos2d::Properties*)tolua_tousertype(tolua_S,1,0); +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_getColor'", nullptr); + return 0; + } +#endif + argc = lua_gettop(tolua_S)-1; + do{ + if (argc == 2) { + const char* arg0; + std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getColor"); arg0 = arg0_tmp.c_str(); + + if (!ok) { break; } + cocos2d::Vec4* arg1; + ok &= luaval_to_object(tolua_S, 3, "cc.Vec4",&arg1, "cc.Properties:getColor"); + + if (!ok) { break; } + bool ret = cobj->getColor(arg0, arg1); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 2) { + const char* arg0; + std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getColor"); arg0 = arg0_tmp.c_str(); + + if (!ok) { break; } + cocos2d::Vec3* arg1; + ok &= luaval_to_object(tolua_S, 3, "cc.Vec3",&arg1, "cc.Properties:getColor"); + + if (!ok) { break; } + bool ret = cobj->getColor(arg0, arg1); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + }while(0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:getColor",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_getColor'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Properties_setString(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Properties* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Properties",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Properties*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_setString'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) + { + const char* arg0; + const char* arg1; + + std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:setString"); arg0 = arg0_tmp.c_str(); + + std::string arg1_tmp; ok &= luaval_to_std_string(tolua_S, 3, &arg1_tmp, "cc.Properties:setString"); arg1 = arg1_tmp.c_str(); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_setString'", nullptr); + return 0; + } + bool ret = cobj->setString(arg0, arg1); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:setString",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_setString'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Properties_getNextProperty(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Properties* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Properties",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Properties*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_getNextProperty'", nullptr); return 0; } #endif @@ -29626,33 +29900,19 @@ int lua_cocos2dx_Properties_getLong(lua_State* tolua_S) { if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getLong'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getNextProperty'", nullptr); return 0; } - int ret = cobj->getLong(); - tolua_pushnumber(tolua_S,(lua_Number)ret); + const char* ret = cobj->getNextProperty(); + tolua_pushstring(tolua_S,(const char*)ret); return 1; } - if (argc == 1) - { - const char* arg0; - - std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getLong"); arg0 = arg0_tmp.c_str(); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getLong'", nullptr); - return 0; - } - int ret = cobj->getLong(arg0); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:getLong",argc, 0); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:getNextProperty",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_getLong'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_getNextProperty'.",&tolua_err); #endif return 0; @@ -29744,216 +30004,6 @@ int lua_cocos2dx_Properties_getNamespace(lua_State* tolua_S) return 0; } -int lua_cocos2dx_Properties_getPath(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Properties* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Properties",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Properties*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_getPath'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 2) - { - const char* arg0; - std::string* arg1; - - std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getPath"); arg0 = arg0_tmp.c_str(); - - #pragma warning NO CONVERSION TO NATIVE FOR basic_string* - ok = false; - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getPath'", nullptr); - return 0; - } - bool ret = cobj->getPath(arg0, arg1); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:getPath",argc, 2); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_getPath'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Properties_getMat4(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Properties* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Properties",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Properties*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_getMat4'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 2) - { - const char* arg0; - cocos2d::Mat4* arg1; - - std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getMat4"); arg0 = arg0_tmp.c_str(); - - ok &= luaval_to_object(tolua_S, 3, "cc.Mat4",&arg1, "cc.Properties:getMat4"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getMat4'", nullptr); - return 0; - } - bool ret = cobj->getMat4(arg0, arg1); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:getMat4",argc, 2); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_getMat4'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Properties_exists(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Properties* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Properties",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Properties*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_exists'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - const char* arg0; - - std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:exists"); arg0 = arg0_tmp.c_str(); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_exists'", nullptr); - return 0; - } - bool ret = cobj->exists(arg0); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:exists",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_exists'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Properties_setString(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Properties* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Properties",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Properties*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_setString'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 2) - { - const char* arg0; - const char* arg1; - - std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:setString"); arg0 = arg0_tmp.c_str(); - - std::string arg1_tmp; ok &= luaval_to_std_string(tolua_S, 3, &arg1_tmp, "cc.Properties:setString"); arg1 = arg1_tmp.c_str(); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_setString'", nullptr); - return 0; - } - bool ret = cobj->setString(arg0, arg1); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:setString",argc, 2); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_setString'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_Properties_getId(lua_State* tolua_S) { int argc = 0; @@ -30001,308 +30051,6 @@ int lua_cocos2dx_Properties_getId(lua_State* tolua_S) return 0; } -int lua_cocos2dx_Properties_rewind(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Properties* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Properties",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Properties*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_rewind'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_rewind'", nullptr); - return 0; - } - cobj->rewind(); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:rewind",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_rewind'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Properties_setVariable(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Properties* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Properties",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Properties*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_setVariable'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 2) - { - const char* arg0; - const char* arg1; - - std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:setVariable"); arg0 = arg0_tmp.c_str(); - - std::string arg1_tmp; ok &= luaval_to_std_string(tolua_S, 3, &arg1_tmp, "cc.Properties:setVariable"); arg1 = arg1_tmp.c_str(); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_setVariable'", nullptr); - return 0; - } - cobj->setVariable(arg0, arg1); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:setVariable",argc, 2); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_setVariable'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Properties_getBool(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Properties* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Properties",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Properties*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_getBool'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getBool'", nullptr); - return 0; - } - bool ret = cobj->getBool(); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - if (argc == 1) - { - const char* arg0; - - std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getBool"); arg0 = arg0_tmp.c_str(); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getBool'", nullptr); - return 0; - } - bool ret = cobj->getBool(arg0); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - if (argc == 2) - { - const char* arg0; - bool arg1; - - std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getBool"); arg0 = arg0_tmp.c_str(); - - ok &= luaval_to_boolean(tolua_S, 3,&arg1, "cc.Properties:getBool"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getBool'", nullptr); - return 0; - } - bool ret = cobj->getBool(arg0, arg1); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:getBool",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_getBool'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Properties_getColor(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Properties* cobj = nullptr; - bool ok = true; -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Properties",0,&tolua_err)) goto tolua_lerror; -#endif - cobj = (cocos2d::Properties*)tolua_tousertype(tolua_S,1,0); -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_getColor'", nullptr); - return 0; - } -#endif - argc = lua_gettop(tolua_S)-1; - do{ - if (argc == 2) { - const char* arg0; - std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getColor"); arg0 = arg0_tmp.c_str(); - - if (!ok) { break; } - cocos2d::Vec4* arg1; - ok &= luaval_to_object(tolua_S, 3, "cc.Vec4",&arg1, "cc.Properties:getColor"); - - if (!ok) { break; } - bool ret = cobj->getColor(arg0, arg1); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - }while(0); - ok = true; - do{ - if (argc == 2) { - const char* arg0; - std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getColor"); arg0 = arg0_tmp.c_str(); - - if (!ok) { break; } - cocos2d::Vec3* arg1; - ok &= luaval_to_object(tolua_S, 3, "cc.Vec3",&arg1, "cc.Properties:getColor"); - - if (!ok) { break; } - bool ret = cobj->getColor(arg0, arg1); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - }while(0); - ok = true; - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:getColor",argc, 2); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_getColor'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Properties_getType(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Properties* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Properties",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Properties*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_getType'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getType'", nullptr); - return 0; - } - int ret = (int)cobj->getType(); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; - } - if (argc == 1) - { - const char* arg0; - - std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getType"); arg0 = arg0_tmp.c_str(); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getType'", nullptr); - return 0; - } - int ret = (int)cobj->getType(arg0); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:getType",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_getType'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_Properties_getNextNamespace(lua_State* tolua_S) { int argc = 0; @@ -30570,7 +30318,7 @@ int lua_cocos2dx_Properties_getVec4(lua_State* tolua_S) return 0; } -int lua_cocos2dx_Properties_getNextProperty(lua_State* tolua_S) +int lua_cocos2dx_Properties_rewind(lua_State* tolua_S) { int argc = 0; cocos2d::Properties* cobj = nullptr; @@ -30590,7 +30338,7 @@ int lua_cocos2dx_Properties_getNextProperty(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_getNextProperty'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_rewind'", nullptr); return 0; } #endif @@ -30600,24 +30348,24 @@ int lua_cocos2dx_Properties_getNextProperty(lua_State* tolua_S) { if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getNextProperty'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_rewind'", nullptr); return 0; } - const char* ret = cobj->getNextProperty(); - tolua_pushstring(tolua_S,(const char*)ret); + cobj->rewind(); + lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:getNextProperty",argc, 0); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:rewind",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_getNextProperty'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_rewind'.",&tolua_err); #endif return 0; } -int lua_cocos2dx_Properties_getFloat(lua_State* tolua_S) +int lua_cocos2dx_Properties_getBool(lua_State* tolua_S) { int argc = 0; cocos2d::Properties* cobj = nullptr; @@ -30637,7 +30385,7 @@ int lua_cocos2dx_Properties_getFloat(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_getFloat'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_getBool'", nullptr); return 0; } #endif @@ -30647,33 +30395,117 @@ int lua_cocos2dx_Properties_getFloat(lua_State* tolua_S) { if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getFloat'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getBool'", nullptr); return 0; } - double ret = cobj->getFloat(); - tolua_pushnumber(tolua_S,(lua_Number)ret); + bool ret = cobj->getBool(); + tolua_pushboolean(tolua_S,(bool)ret); return 1; } if (argc == 1) { const char* arg0; - std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getFloat"); arg0 = arg0_tmp.c_str(); + std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getBool"); arg0 = arg0_tmp.c_str(); if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getFloat'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getBool'", nullptr); return 0; } - double ret = cobj->getFloat(arg0); - tolua_pushnumber(tolua_S,(lua_Number)ret); + bool ret = cobj->getBool(arg0); + tolua_pushboolean(tolua_S,(bool)ret); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:getFloat",argc, 0); + if (argc == 2) + { + const char* arg0; + bool arg1; + + std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getBool"); arg0 = arg0_tmp.c_str(); + + ok &= luaval_to_boolean(tolua_S, 3,&arg1, "cc.Properties:getBool"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getBool'", nullptr); + return 0; + } + bool ret = cobj->getBool(arg0, arg1); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:getBool",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_getFloat'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_getBool'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Properties_getVariable(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Properties* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Properties",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Properties*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_getVariable'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + const char* arg0; + + std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getVariable"); arg0 = arg0_tmp.c_str(); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getVariable'", nullptr); + return 0; + } + const char* ret = cobj->getVariable(arg0); + tolua_pushstring(tolua_S,(const char*)ret); + return 1; + } + if (argc == 2) + { + const char* arg0; + const char* arg1; + + std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getVariable"); arg0 = arg0_tmp.c_str(); + + std::string arg1_tmp; ok &= luaval_to_std_string(tolua_S, 3, &arg1_tmp, "cc.Properties:getVariable"); arg1 = arg1_tmp.c_str(); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getVariable'", nullptr); + return 0; + } + const char* ret = cobj->getVariable(arg0, arg1); + tolua_pushstring(tolua_S,(const char*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:getVariable",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_getVariable'.",&tolua_err); #endif return 0; @@ -30731,6 +30563,113 @@ int lua_cocos2dx_Properties_getQuaternionFromAxisAngle(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Properties_getPath(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Properties* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Properties",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Properties*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_getPath'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) + { + const char* arg0; + std::string* arg1; + + std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getPath"); arg0 = arg0_tmp.c_str(); + + #pragma warning NO CONVERSION TO NATIVE FOR basic_string* + ok = false; + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getPath'", nullptr); + return 0; + } + bool ret = cobj->getPath(arg0, arg1); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:getPath",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_getPath'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Properties_getMat4(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Properties* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Properties",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Properties*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Properties_getMat4'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) + { + const char* arg0; + cocos2d::Mat4* arg1; + + std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Properties:getMat4"); arg0 = arg0_tmp.c_str(); + + ok &= luaval_to_object(tolua_S, 3, "cc.Mat4",&arg1, "cc.Properties:getMat4"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Properties_getMat4'", nullptr); + return 0; + } + bool ret = cobj->getMat4(arg0, arg1); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Properties:getMat4",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Properties_getMat4'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_Properties_parseColor(lua_State* tolua_S) { int argc = 0; @@ -30949,28 +30888,27 @@ int lua_register_cocos2dx_Properties(lua_State* tolua_S) tolua_cclass(tolua_S,"Properties","cc.Properties","",nullptr); tolua_beginmodule(tolua_S,"Properties"); - tolua_function(tolua_S,"getVariable",lua_cocos2dx_Properties_getVariable); - tolua_function(tolua_S,"getString",lua_cocos2dx_Properties_getString); - tolua_function(tolua_S,"getLong",lua_cocos2dx_Properties_getLong); - tolua_function(tolua_S,"getNamespace",lua_cocos2dx_Properties_getNamespace); - tolua_function(tolua_S,"getPath",lua_cocos2dx_Properties_getPath); - tolua_function(tolua_S,"getMat4",lua_cocos2dx_Properties_getMat4); - tolua_function(tolua_S,"exists",lua_cocos2dx_Properties_exists); - tolua_function(tolua_S,"setString",lua_cocos2dx_Properties_setString); - tolua_function(tolua_S,"getId",lua_cocos2dx_Properties_getId); - tolua_function(tolua_S,"rewind",lua_cocos2dx_Properties_rewind); tolua_function(tolua_S,"setVariable",lua_cocos2dx_Properties_setVariable); - tolua_function(tolua_S,"getBool",lua_cocos2dx_Properties_getBool); - tolua_function(tolua_S,"getColor",lua_cocos2dx_Properties_getColor); + tolua_function(tolua_S,"getFloat",lua_cocos2dx_Properties_getFloat); tolua_function(tolua_S,"getType",lua_cocos2dx_Properties_getType); + tolua_function(tolua_S,"getString",lua_cocos2dx_Properties_getString); + tolua_function(tolua_S,"exists",lua_cocos2dx_Properties_exists); + tolua_function(tolua_S,"getColor",lua_cocos2dx_Properties_getColor); + tolua_function(tolua_S,"setString",lua_cocos2dx_Properties_setString); + tolua_function(tolua_S,"getNextProperty",lua_cocos2dx_Properties_getNextProperty); + tolua_function(tolua_S,"getNamespace",lua_cocos2dx_Properties_getNamespace); + tolua_function(tolua_S,"getId",lua_cocos2dx_Properties_getId); tolua_function(tolua_S,"getNextNamespace",lua_cocos2dx_Properties_getNextNamespace); tolua_function(tolua_S,"getInt",lua_cocos2dx_Properties_getInt); tolua_function(tolua_S,"getVec3",lua_cocos2dx_Properties_getVec3); tolua_function(tolua_S,"getVec2",lua_cocos2dx_Properties_getVec2); tolua_function(tolua_S,"getVec4",lua_cocos2dx_Properties_getVec4); - tolua_function(tolua_S,"getNextProperty",lua_cocos2dx_Properties_getNextProperty); - tolua_function(tolua_S,"getFloat",lua_cocos2dx_Properties_getFloat); + tolua_function(tolua_S,"rewind",lua_cocos2dx_Properties_rewind); + tolua_function(tolua_S,"getBool",lua_cocos2dx_Properties_getBool); + tolua_function(tolua_S,"getVariable",lua_cocos2dx_Properties_getVariable); tolua_function(tolua_S,"getQuaternionFromAxisAngle",lua_cocos2dx_Properties_getQuaternionFromAxisAngle); + tolua_function(tolua_S,"getPath",lua_cocos2dx_Properties_getPath); + tolua_function(tolua_S,"getMat4",lua_cocos2dx_Properties_getMat4); tolua_function(tolua_S,"parseColor", lua_cocos2dx_Properties_parseColor); tolua_function(tolua_S,"parseVec3", lua_cocos2dx_Properties_parseVec3); tolua_function(tolua_S,"parseAxisAngle", lua_cocos2dx_Properties_parseAxisAngle); diff --git a/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp b/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp index 2bcb64b12d..3e1cc6c6fe 100644 --- a/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -2331,7 +2331,6 @@ int register_all_cocos2dx(lua_State* tolua_S); - #endif // __cocos2dx_h__ From ab2aa262420bc21fdf6e3820c2d660188300fae2 Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 22:43:10 +1000 Subject: [PATCH 18/19] Change %lu to %u --- cocos/renderer/CCTextureCache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/renderer/CCTextureCache.cpp b/cocos/renderer/CCTextureCache.cpp index 8ce35c4d25..d406992227 100644 --- a/cocos/renderer/CCTextureCache.cpp +++ b/cocos/renderer/CCTextureCache.cpp @@ -652,7 +652,7 @@ std::string TextureCache::getCachedTextureInfo() const auto bytes = tex->getPixelsWide() * tex->getPixelsHigh() * bpp / 8; totalBytes += bytes; count++; - snprintf(buftmp, sizeof(buftmp) - 1, "\"%s\" rc=%lu id=%p %lu x %lu @ %d bpp => %lu KB\n", + snprintf(buftmp, sizeof(buftmp) - 1, "\"%s\" rc=%u id=%p %u x %u @ %d bpp => %u KB\n", texture.first.c_str(), (int32_t)tex->getReferenceCount(), tex->getBackendTexture(), From ea4b212d1f8f64cd8c2c0e21a919158112bf2838 Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 22:45:59 +1000 Subject: [PATCH 19/19] Use %d for int32_t --- cocos/renderer/CCTextureCache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/renderer/CCTextureCache.cpp b/cocos/renderer/CCTextureCache.cpp index d406992227..09bf55a91a 100644 --- a/cocos/renderer/CCTextureCache.cpp +++ b/cocos/renderer/CCTextureCache.cpp @@ -652,7 +652,7 @@ std::string TextureCache::getCachedTextureInfo() const auto bytes = tex->getPixelsWide() * tex->getPixelsHigh() * bpp / 8; totalBytes += bytes; count++; - snprintf(buftmp, sizeof(buftmp) - 1, "\"%s\" rc=%u id=%p %u x %u @ %d bpp => %u KB\n", + snprintf(buftmp, sizeof(buftmp) - 1, "\"%s\" rc=%d id=%p %d x %d @ %d bpp => %d KB\n", texture.first.c_str(), (int32_t)tex->getReferenceCount(), tex->getBackendTexture(),