mirror of https://github.com/axmolengine/axmol.git
Merge: f5663f279c
d73d937894
Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
parent
0aff165959
commit
35b658c90e
|
@ -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;
|
||||
|
|
|
@ -229,13 +229,13 @@ std::set<unsigned int>* BMFontConfiguration::parseConfigFile(const std::string&
|
|||
return validCharsString;
|
||||
}
|
||||
|
||||
std::set<unsigned int>* BMFontConfiguration::parseBinaryConfigFile(unsigned char* pData, unsigned long size, const std::string& controlFile)
|
||||
std::set<unsigned int>* 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<unsigned int> *validCharsString = new (std::nothrow) std::set<unsigned int>();
|
||||
|
||||
unsigned long remains = size;
|
||||
uint32_t remains = size;
|
||||
|
||||
CCASSERT(pData[3] == 3, "Only version 3 is supported");
|
||||
|
||||
|
@ -324,9 +324,9 @@ std::set<unsigned int>* 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<unsigned int>* 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);
|
||||
|
|
|
@ -123,7 +123,7 @@ public:
|
|||
|
||||
protected:
|
||||
virtual std::set<unsigned int>* parseConfigFile(const std::string& controlFile);
|
||||
virtual std::set<unsigned int>* parseBinaryConfigFile(unsigned char* pData, unsigned long size, const std::string& controlFile);
|
||||
virtual std::set<unsigned int>* parseBinaryConfigFile(unsigned char* pData, uint32_t size, const std::string& controlFile);
|
||||
|
||||
private:
|
||||
unsigned int parseCharacterDefinition(const char* line);
|
||||
|
|
|
@ -63,9 +63,9 @@ static std::unordered_map<std::string, DataRef> 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)
|
||||
unsigned long offset,
|
||||
unsigned char* buf,
|
||||
unsigned long 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<FT_OutlineGlyph>(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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -725,7 +725,7 @@ LayerMultiplex::~LayerMultiplex()
|
|||
}
|
||||
}
|
||||
|
||||
LayerMultiplex * LayerMultiplex::create(Layer * layer, ...)
|
||||
LayerMultiplex* LayerMultiplex::create(Node* layer, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args,layer);
|
||||
|
@ -742,7 +742,7 @@ LayerMultiplex * LayerMultiplex::create(Layer * layer, ...)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
LayerMultiplex * LayerMultiplex::createWithLayer(Layer* layer)
|
||||
LayerMultiplex* LayerMultiplex::createWithLayer(Node* layer)
|
||||
{
|
||||
return LayerMultiplex::create(layer, nullptr);
|
||||
}
|
||||
|
@ -761,7 +761,7 @@ LayerMultiplex* LayerMultiplex::create()
|
|||
return ret;
|
||||
}
|
||||
|
||||
LayerMultiplex* LayerMultiplex::createWithArray(const Vector<Layer*>& arrayOfLayers)
|
||||
LayerMultiplex* LayerMultiplex::createWithArray(const Vector<Node*>& arrayOfLayers)
|
||||
{
|
||||
LayerMultiplex* ret = new (std::nothrow) LayerMultiplex();
|
||||
if (ret && ret->initWithArray(arrayOfLayers))
|
||||
|
@ -775,7 +775,7 @@ LayerMultiplex* LayerMultiplex::createWithArray(const Vector<Layer*>& arrayOfLay
|
|||
return ret;
|
||||
}
|
||||
|
||||
void LayerMultiplex::addLayer(Layer* layer)
|
||||
void LayerMultiplex::addLayer(Node* layer)
|
||||
{
|
||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||
|
@ -797,7 +797,7 @@ bool LayerMultiplex::init()
|
|||
return false;
|
||||
}
|
||||
|
||||
bool LayerMultiplex::initWithLayers(Layer *layer, va_list params)
|
||||
bool LayerMultiplex::initWithLayers(Node* layer, va_list params)
|
||||
{
|
||||
if (Layer::init())
|
||||
{
|
||||
|
@ -831,7 +831,7 @@ bool LayerMultiplex::initWithLayers(Layer *layer, va_list params)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool LayerMultiplex::initWithArray(const Vector<Layer*>& arrayOfLayers)
|
||||
bool LayerMultiplex::initWithArray(const Vector<Node*>& arrayOfLayers)
|
||||
{
|
||||
if (Layer::init())
|
||||
{
|
||||
|
|
|
@ -41,15 +41,6 @@ NS_CC_BEGIN
|
|||
* @{
|
||||
*/
|
||||
|
||||
class __Set;
|
||||
class TouchScriptHandlerEntry;
|
||||
|
||||
class EventListenerTouch;
|
||||
class EventListenerKeyboard;
|
||||
class EventListenerAcceleration;
|
||||
|
||||
class Touch;
|
||||
|
||||
//
|
||||
// Layer
|
||||
//
|
||||
|
@ -435,7 +426,7 @@ public:
|
|||
* @param arrayOfLayers An array of layers.
|
||||
* @return An autoreleased LayerMultiplex object.
|
||||
*/
|
||||
static LayerMultiplex* createWithArray(const Vector<Layer*>& arrayOfLayers);
|
||||
static LayerMultiplex* createWithArray(const Vector<Node*>& arrayOfLayers);
|
||||
|
||||
/** Creates a LayerMultiplex with one or more layers using a variable argument list.
|
||||
* @code
|
||||
|
@ -444,7 +435,7 @@ public:
|
|||
* In lua:local create(...)
|
||||
* @endcode
|
||||
*/
|
||||
static LayerMultiplex * create(Layer* layer, ... );
|
||||
static LayerMultiplex* create(Node* layer, ...);
|
||||
|
||||
/** Creates a LayerMultiplex with one layer.
|
||||
* Lua script can not init with undetermined number of variables
|
||||
|
@ -455,14 +446,14 @@ public:
|
|||
* @param layer A certain layer.
|
||||
* @return An autoreleased LayerMultiplex object.
|
||||
*/
|
||||
static LayerMultiplex * createWithLayer(Layer* layer);
|
||||
static LayerMultiplex* createWithLayer(Node* layer);
|
||||
|
||||
|
||||
/** Add a certain layer to LayerMultiplex.
|
||||
*
|
||||
* @param layer A layer need to be added to the LayerMultiplex.
|
||||
*/
|
||||
void addLayer(Layer* layer);
|
||||
void addLayer(Node* layer);
|
||||
|
||||
/** Switches to a certain layer indexed by n.
|
||||
The current (old) layer will be removed from it's parent with 'cleanup=true'.
|
||||
|
@ -498,16 +489,16 @@ CC_CONSTRUCTOR_ACCESS:
|
|||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
bool initWithLayers(Layer* layer, va_list params);
|
||||
bool initWithLayers(Node* layer, va_list params);
|
||||
|
||||
/** initializes a MultiplexLayer with an array of layers
|
||||
@since v2.1
|
||||
*/
|
||||
bool initWithArray(const Vector<Layer*>& arrayOfLayers);
|
||||
bool initWithArray(const Vector<Node*>& arrayOfLayers);
|
||||
|
||||
protected:
|
||||
unsigned int _enabledLayer;
|
||||
Vector<Layer*> _layers;
|
||||
Vector<Node*> _layers;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(LayerMultiplex);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -6,7 +6,7 @@ Copyright (c) 2013-2016 Chukong Technologies Inc.
|
|||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
Copyright (c) 2021 Bytedance Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
https://adxe.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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: %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;
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ void ProfilingEndTimingBlock(const char *timerName)
|
|||
CCASSERT(timer, "CCProfilingTimer not found");
|
||||
|
||||
|
||||
long duration = static_cast<long>(chrono::duration_cast<chrono::microseconds>(now - timer->_startTime).count());
|
||||
int32_t duration = static_cast<int32_t>(chrono::duration_cast<chrono::microseconds>(now - timer->_startTime).count());
|
||||
|
||||
timer->totalTime += duration;
|
||||
timer->_averageTime1 = (timer->_averageTime1 + duration) / 2.0f;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -895,25 +895,6 @@ float Properties::getFloat(const char* name) const
|
|||
return 0.0f;
|
||||
}
|
||||
|
||||
long Properties::getLong(const char* name) const
|
||||
{
|
||||
const char* valueString = getString(name);
|
||||
if (valueString)
|
||||
{
|
||||
long value;
|
||||
int scanned;
|
||||
scanned = sscanf(valueString, "%ld", &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");
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
long 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.
|
||||
|
|
|
@ -382,8 +382,8 @@ void UserDefault::lazyInit()
|
|||
return;
|
||||
}
|
||||
|
||||
int filesize = static_cast<int>(posix_lseek(_fd, 0, SEEK_END));
|
||||
posix_lseek(_fd, 0, SEEK_SET);
|
||||
int filesize = static_cast<int>(posix_lseek64(_fd, 0, SEEK_END));
|
||||
posix_lseek64(_fd, 0, SEEK_SET);
|
||||
|
||||
if (filesize < _curMapSize) { // construct a empty file mapping
|
||||
posix_fsetsize(_fd, _curMapSize);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -28,6 +28,8 @@ THE SOFTWARE.
|
|||
#define __SUPPORT_DATA_SUPPORT_TGALIB_H__
|
||||
/// @cond DO_NOT_SHOW
|
||||
|
||||
#include "stdint.h"
|
||||
|
||||
namespace cocos2d {
|
||||
|
||||
enum {
|
||||
|
@ -56,13 +58,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);
|
||||
|
|
|
@ -543,7 +543,7 @@ struct ZipFilePrivate
|
|||
|
||||
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:;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -351,7 +351,7 @@ std::vector<char16_t> getChar16VectorFromUTF16String(const std::u16string& utf16
|
|||
return std::vector<char16_t>(utf16.begin(), utf16.end());
|
||||
}
|
||||
|
||||
long getCharacterCountInUTF8String(const std::string& utf8) {
|
||||
int32_t getCharacterCountInUTF8String(const std::string& utf8) {
|
||||
return getUTF8StringLength((const UTF8*) utf8.c_str());
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -636,7 +636,7 @@ std::vector<int> 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());
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -141,7 +141,7 @@ std::shared_ptr<DownloadTask> 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;
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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: %d error", static_cast<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<long>(id));
|
||||
CCLOG("Ending touches with id: %d error", static_cast<int32_t>(id));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -13,7 +13,7 @@ NS_CC_BEGIN
|
|||
|
||||
struct PXIoF {
|
||||
int(*read)(PXFileHandle& handle, void*, unsigned int);
|
||||
long(*seek)(PXFileHandle& handle, long, 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<int>(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 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 long pfs_asset_seek(PXFileHandle& handle, long 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 long pfs_obb_seek(PXFileHandle& handle, long 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;
|
||||
|
@ -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<int32_t>(offset), origin); // this returns -1 for error, and resulting offset on success
|
||||
return result < 0 ? -1 : 0; // return 0 for success
|
||||
|
|
|
@ -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<HANDLE>(_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
|
||||
|
@ -109,7 +117,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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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: %x", (uint32_t)pixelFormat);
|
||||
#ifdef CC_USE_METAL
|
||||
CCASSERT(false, "pixeformat not found in _pixelFormatInfoTables, register required!");
|
||||
#endif
|
||||
|
|
|
@ -652,14 +652,14 @@ 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=%d id=%p %d x %d @ %d bpp => %d 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;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (c) 2014-2020 Simdsoft Limited - All Rights Reserved
|
||||
//
|
||||
#include "ui/LayoutHelper.h"
|
||||
|
@ -12,7 +12,7 @@ void LayoutHelper::setDesignSizeFixedEdge(const Size& designSize)
|
|||
{
|
||||
LayoutHelper::s_designSize = designSize;
|
||||
|
||||
// Set the design resolution//分辨率的大小
|
||||
// Set the design resolution//分辨率的大小
|
||||
GLView* pEGLView = Director::getInstance()->getOpenGLView();
|
||||
const Size& frameSize = pEGLView->getFrameSize();
|
||||
|
||||
|
@ -37,7 +37,7 @@ void LayoutHelper::setDesignSizeNoBorder(const cocos2d::Size& designSize)
|
|||
// save smart size
|
||||
LayoutHelper::s_designSize = designSize;
|
||||
|
||||
// Set the design resolution//分辨率的大小
|
||||
// Set the design resolution//分辨率的大小
|
||||
GLView* pEGLView = Director::getInstance()->getOpenGLView();
|
||||
const cocos2d::Size& frameSize = pEGLView->getFrameSize();
|
||||
|
||||
|
@ -335,7 +335,7 @@ void LayoutHelper::moveNodeGroupVertically(const std::vector<Node*>& nodes, floa
|
|||
** @remark:
|
||||
*/
|
||||
/// <summary>
|
||||
/// 水平居中
|
||||
/// 水平居中
|
||||
/// </summary>
|
||||
/// <param name="nodes"></param>
|
||||
void LayoutHelper::centerHorizontally(const std::vector<Node*>& nodes)
|
||||
|
@ -393,7 +393,7 @@ void LayoutHelper::centerHorizontally(const std::vector<Node*>& nodes)
|
|||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// 垂直居中
|
||||
/// 垂直居中
|
||||
/// </summary>
|
||||
/// <param name="nodes"></param>
|
||||
void LayoutHelper::centerVertically(const std::vector<Node*>& nodes)
|
||||
|
@ -437,7 +437,7 @@ void LayoutHelper::centerVertically(const std::vector<Node*>& nodes)
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 居中
|
||||
/// 居中
|
||||
/// </summary>
|
||||
/// <param name="nodes"></param>
|
||||
void LayoutHelper::centerToParent(const std::vector<Node*>& nodes)
|
||||
|
@ -492,7 +492,7 @@ void LayoutHelper::centerToParent(const std::vector<Node*>& nodes)
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 左对齐
|
||||
/// 左对齐
|
||||
/// </summary>
|
||||
/// <param name="nodes"></param>
|
||||
void LayoutHelper::alignLefts(const std::vector<Node*>& nodes)
|
||||
|
@ -518,7 +518,7 @@ void LayoutHelper::alignLefts(const std::vector<Node*>& nodes)
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 右对齐
|
||||
/// 右对齐
|
||||
/// </summary>
|
||||
/// <param name="nodes"></param>
|
||||
void LayoutHelper::alignRights(const std::vector<Node*>& nodes)
|
||||
|
@ -545,7 +545,7 @@ void LayoutHelper::alignRights(const std::vector<Node*>& nodes)
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 顶端对齐
|
||||
/// 顶端对齐
|
||||
/// </summary>
|
||||
/// <param name="nodes"></param>
|
||||
void LayoutHelper::alignTops(const std::vector<Node*>& nodes)
|
||||
|
@ -571,7 +571,7 @@ void LayoutHelper::alignTops(const std::vector<Node*>& nodes)
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 底端对齐
|
||||
/// 底端对齐
|
||||
/// </summary>
|
||||
/// <param name="nodes"></param>
|
||||
void LayoutHelper::alignBottoms(const std::vector<Node*>& nodes)
|
||||
|
@ -597,7 +597,7 @@ void LayoutHelper::alignBottoms(const std::vector<Node*>& nodes)
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 水平对齐
|
||||
/// 水平对齐
|
||||
/// </summary>
|
||||
/// <param name="nodes"></param>
|
||||
void LayoutHelper::alignHorizontals(const std::vector<Node*>& nodes)
|
||||
|
@ -630,7 +630,7 @@ void LayoutHelper::alignHorizontals(const std::vector<Node*>& nodes)
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 垂直对齐
|
||||
/// 垂直对齐
|
||||
/// </summary>
|
||||
/// <param name="nodes"></param>
|
||||
void LayoutHelper::alignVerticals(const std::vector<Node*>& nodes)
|
||||
|
@ -663,7 +663,7 @@ void LayoutHelper::alignVerticals(const std::vector<Node*>& nodes)
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 中心原点对齐
|
||||
/// 中心原点对齐
|
||||
/// </summary>
|
||||
/// <param name="nodes"></param>
|
||||
void LayoutHelper::alignCenters(const std::vector<Node*>& nodes)
|
||||
|
@ -676,7 +676,7 @@ void LayoutHelper::alignCenters(const std::vector<Node*>& nodes)
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使宽度相等
|
||||
/// 使宽度相等
|
||||
/// </summary>
|
||||
/// <param name="nodes"></param>
|
||||
void LayoutHelper::makeSameWidth(const std::vector<Node*>& nodes)
|
||||
|
@ -702,7 +702,7 @@ void LayoutHelper::makeSameWidth(const std::vector<Node*>& nodes)
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使高度相等
|
||||
/// 使高度相等
|
||||
/// </summary>
|
||||
/// <param name="nodes"></param>
|
||||
void LayoutHelper::makeSameHeight(const std::vector<Node*>& nodes)
|
||||
|
@ -728,7 +728,7 @@ void LayoutHelper::makeSameHeight(const std::vector<Node*>& nodes)
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使得大小相等
|
||||
/// 使得大小相等
|
||||
/// </summary>
|
||||
/// <param name="nodes"></param>
|
||||
void LayoutHelper::makeSameSize(const std::vector<Node*>& nodes)
|
||||
|
@ -741,7 +741,7 @@ void LayoutHelper::makeSameSize(const std::vector<Node*>& nodes)
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使水平间距相等
|
||||
/// 使水平间距相等
|
||||
/// </summary>
|
||||
/// <param name="nodes"></param>
|
||||
void LayoutHelper::makeHorizontalSpacingEqual(std::vector<Node*>& nodes)
|
||||
|
@ -775,7 +775,7 @@ void LayoutHelper::makeHorizontalSpacingEqual(std::vector<Node*>& nodes)
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使水平间距相等
|
||||
/// 使水平间距相等
|
||||
/// </summary>
|
||||
/// <param name="nodes"></param>
|
||||
void LayoutHelper::makeHorizontalSpacingEqual(const std::vector<Node*>& nodes, float theSpacing)
|
||||
|
@ -790,7 +790,7 @@ void LayoutHelper::makeHorizontalSpacingEqual(const std::vector<Node*>& nodes, f
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使垂直间距相等
|
||||
/// 使垂直间距相等
|
||||
/// </summary>
|
||||
/// <param name="nodes"></param>
|
||||
void LayoutHelper::makeVerticalSpacingEqual(std::vector<Node*>& nodes)
|
||||
|
@ -876,7 +876,7 @@ void LayoutHelper::removeVerticalSpacing(const std::vector<Node*>& nodes)
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使垂直间距相等
|
||||
/// 使垂直间距相等
|
||||
/// </summary>
|
||||
/// <param name="nodes"></param>
|
||||
void LayoutHelper::makeVerticalSpacingEqual(const std::vector<Node*>& nodes, float theSpacing)
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
Copyright (c) 2021 Bytedance Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
https://adxe.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
Copyright (c) 2021 Bytedance Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
https://adxe.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<long>(start), str.c_str());
|
||||
CCLOGERROR("'start' is out of range: %d, %s", static_cast<int32_t>(start), str.c_str());
|
||||
return "";
|
||||
}
|
||||
std::string result;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
Copyright (c) 2021 Bytedance Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
https://adxe.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
Copyright (c) 2021 Bytedance Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
https://adxe.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -431,6 +432,8 @@ void Scale9Sprite::copyTo(Scale9Sprite* copy) const
|
|||
|
||||
copy->setRenderingType(_renderingType);
|
||||
copy->setScale9Enabled(isScale9Enabled());
|
||||
// setStretchEnabled after setScale9Enabled, fix issue: https://github.com/adxeproject/adxe/issues/491
|
||||
copy->setStretchEnabled(isStretchEnabled());
|
||||
copy->_isPatch9 = _isPatch9;
|
||||
copy->_brightState = _brightState;
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
Copyright (c) 2021 Bytedance Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
https://adxe.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
Copyright (c) 2021 Bytedance Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
https://adxe.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
Copyright (c) 2020 c4games.com.
|
||||
Copyright (c) 2021 Bytedance Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
https://adxe.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2326,6 +2326,9 @@ int register_all_cocos2dx(lua_State* tolua_S);
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
Copyright (c) 2021 Bytedance Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
https://adxe.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -3362,7 +3363,7 @@ static int tolua_cocos2dx_LayerMultiplex_create(lua_State* tolua_S)
|
|||
return 0;
|
||||
|
||||
int argc = 0;
|
||||
Vector<Layer*> arg0;
|
||||
Vector<Node*> arg0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
|
|
|
@ -529,6 +529,10 @@ target_include_directories(${APP_NAME}
|
|||
PRIVATE Classes
|
||||
)
|
||||
|
||||
if(WIN64)
|
||||
target_link_options(${APP_NAME} PRIVATE "/STACK:4194304")
|
||||
endif()
|
||||
|
||||
# mark app resources
|
||||
setup_cocos_app_config(${APP_NAME})
|
||||
if(APPLE)
|
||||
|
|
|
@ -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,14 +950,14 @@ 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);
|
||||
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
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -900,7 +900,7 @@ void CameraCullingDemo::addSpriteCallback(Ref* sender)
|
|||
|
||||
// update sprite number
|
||||
char szText[16];
|
||||
sprintf(szText,"%ld sprits", static_cast<long>(_layer3D->getChildrenCount()));
|
||||
sprintf(szText,"%d sprits", static_cast<int32_t>(_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<long>(_layer3D->getChildrenCount()));
|
||||
sprintf(szText,"%l sprits", static_cast<int32_t>(_layer3D->getChildrenCount()));
|
||||
_labelSprite3DCount->setString(szText);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ bool TableViewTest::init()
|
|||
|
||||
void TableViewTest::tableCellTouched(TableView* table, TableViewCell* cell)
|
||||
{
|
||||
CCLOG("cell touched at index: %ld", static_cast<long>(cell->getIdx()));
|
||||
CCLOG("cell touched at index: %d", static_cast<int32_t>(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<long>(idx));
|
||||
auto string = StringUtils::format("%d", static_cast<int32_t>(idx));
|
||||
TableViewCell *cell = table->dequeueCell();
|
||||
if (!cell) {
|
||||
cell = new (std::nothrow) CustomTableViewCell();
|
||||
|
|
|
@ -373,8 +373,8 @@ void TestFileFuncs::onEnter()
|
|||
this->addChild(label);
|
||||
|
||||
// getFileSize Test
|
||||
long size = sharedFileUtils->getFileSize(filepath);
|
||||
msg = StringUtils::format("getFileSize: Test file size equals %ld", size);
|
||||
int32_t size = sharedFileUtils->getFileSize(filepath);
|
||||
msg = StringUtils::format("getFileSize: Test file size equals %d", size);
|
||||
label = Label::createWithSystemFont(msg, "", 20);
|
||||
label->setPosition(x, y * 3);
|
||||
this->addChild(label);
|
||||
|
@ -1160,8 +1160,8 @@ void TestFileFuncsAsync::onEnter()
|
|||
label->setPosition(x, y * 4);
|
||||
this->addChild(label);
|
||||
|
||||
sharedFileUtils->getFileSize(filepath, [=](long size) {
|
||||
auto msg = StringUtils::format("getFileSize: Test file size equals %ld", size);
|
||||
sharedFileUtils->getFileSize(filepath, [=](int32_t 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);
|
||||
|
|
|
@ -311,11 +311,11 @@ 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());
|
||||
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)
|
||||
{
|
||||
|
@ -460,11 +460,11 @@ 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());
|
||||
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);
|
||||
|
|
|
@ -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 = static_cast<int>((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)
|
||||
{
|
||||
long index = (long)(((MenuItemLabel*)sender)->getUserData());
|
||||
auto index = static_cast<int>((uintptr_t)(((MenuItemLabel*)sender)->getUserData()));
|
||||
if (index < (int)SkinType::MAX_TYPE)
|
||||
{
|
||||
_curSkin[index] = (_curSkin[index] + 1) % _skins[index].size();
|
||||
|
|
|
@ -129,7 +129,7 @@ void UIPageViewTest::pageViewEvent(Ref *pSender, PageView::EventType type)
|
|||
{
|
||||
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
||||
|
||||
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<long>(pageView->getCurrentPageIndex() + 1)));
|
||||
_displayValueLabel->setString(StringUtils::format("page = %d", static_cast<int32_t>(pageView->getCurrentPageIndex() + 1)));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -241,7 +241,7 @@ void UIPageViewButtonTest::pageViewEvent(Ref *pSender, PageView::EventType type)
|
|||
{
|
||||
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
||||
|
||||
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<long>(pageView->getCurrentPageIndex() + 1)));
|
||||
_displayValueLabel->setString(StringUtils::format("page = %d", static_cast<int32_t>(pageView->getCurrentPageIndex() + 1)));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -438,7 +438,7 @@ void UIPageViewTouchPropagationTest::pageViewEvent(Ref *pSender, PageView::Event
|
|||
{
|
||||
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
||||
|
||||
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<long>(pageView->getCurrentPageIndex() + 1)));
|
||||
_displayValueLabel->setString(StringUtils::format("page = %d", static_cast<int32_t>(pageView->getCurrentPageIndex() + 1)));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -558,7 +558,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init()
|
|||
}
|
||||
|
||||
pageView->pushBackCustomItem(outerBox);
|
||||
_displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast<long>(pageView->getItems().size())));
|
||||
_displayValueLabel->setString(StringUtils::format("page count = %d", static_cast<int32_t>(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<long>(pageView->getItems().size())));
|
||||
_displayValueLabel->setString(StringUtils::format("page count = %d", static_cast<int32_t>(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<long>(pageView->getItems().size())));
|
||||
_displayValueLabel->setString(StringUtils::format("page count = %d", static_cast<int32_t>(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<PageView*>(pSender);
|
||||
|
||||
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<long>((pageView->getCurrentPageIndex() + 1))));
|
||||
_displayValueLabel->setString(StringUtils::format("page = %d", static_cast<int32_t>((pageView->getCurrentPageIndex() + 1))));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -825,7 +825,7 @@ void UIPageViewVerticalTest::pageViewEvent(Ref *pSender, PageView::EventType typ
|
|||
{
|
||||
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
||||
|
||||
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<long>(pageView->getCurrentPageIndex() + 1)));
|
||||
_displayValueLabel->setString(StringUtils::format("page = %d", static_cast<int32_t>(pageView->getCurrentPageIndex() + 1)));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -984,7 +984,7 @@ void UIPageViewChildSizeTest::pageViewEvent(Ref *pSender, PageView::EventType ty
|
|||
{
|
||||
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
||||
|
||||
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<long>(pageView->getCurrentPageIndex() + 1)));
|
||||
_displayValueLabel->setString(StringUtils::format("page = %d", static_cast<int32_t>(pageView->getCurrentPageIndex() + 1)));
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -67,14 +67,14 @@ 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<long>(str1.length()),
|
||||
static_cast<int32_t>(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<long>(str2.length()),
|
||||
static_cast<int32_t>(str2.length()),
|
||||
StringUtils::getCharacterCountInUTF8String(str2),
|
||||
Helper::getSubStringOfUTF8String(str2, 0, 2).c_str());
|
||||
|
||||
|
|
|
@ -963,7 +963,7 @@ void ParseUriTest::onEnter()
|
|||
EXPECT_EQ("", u.getUserName());
|
||||
EXPECT_EQ("", u.getPassword());
|
||||
EXPECT_EQ("www.facebook.com", u.getHost());
|
||||
EXPECT_EQ(0, u.getPort());
|
||||
EXPECT_EQ(80, u.getPort());
|
||||
EXPECT_EQ("www.facebook.com", u.getAuthority());
|
||||
EXPECT_EQ("/hello/world", u.getPath());
|
||||
EXPECT_EQ("query", u.getQuery());
|
||||
|
@ -1041,7 +1041,7 @@ void ParseUriTest::onEnter()
|
|||
EXPECT_EQ("", u.getPassword());
|
||||
EXPECT_EQ("[2401:db00:20:7004:face:0:29:0]", u.getHost());
|
||||
EXPECT_EQ("2401:db00:20:7004:face:0:29:0", u.getHostName());
|
||||
EXPECT_EQ(0, u.getPort());
|
||||
EXPECT_EQ(80, u.getPort());
|
||||
EXPECT_EQ("[2401:db00:20:7004:face:0:29:0]", u.getAuthority());
|
||||
EXPECT_EQ("/hello/world", u.getPath());
|
||||
EXPECT_EQ("query", u.getQuery());
|
||||
|
@ -1056,7 +1056,7 @@ void ParseUriTest::onEnter()
|
|||
EXPECT_EQ("user", u.getUserName());
|
||||
EXPECT_EQ("pass", u.getPassword());
|
||||
EXPECT_EQ("host.com", u.getHost());
|
||||
EXPECT_EQ(0, u.getPort());
|
||||
EXPECT_EQ(80, u.getPort());
|
||||
EXPECT_EQ("user:pass@host.com", u.getAuthority());
|
||||
EXPECT_EQ("/", u.getPath());
|
||||
EXPECT_EQ("", u.getQuery());
|
||||
|
@ -1071,7 +1071,7 @@ void ParseUriTest::onEnter()
|
|||
EXPECT_EQ("user", u.getUserName());
|
||||
EXPECT_EQ("", u.getPassword());
|
||||
EXPECT_EQ("host.com", u.getHost());
|
||||
EXPECT_EQ(0, u.getPort());
|
||||
EXPECT_EQ(80, u.getPort());
|
||||
EXPECT_EQ("user@host.com", u.getAuthority());
|
||||
EXPECT_EQ("/", u.getPath());
|
||||
EXPECT_EQ("", u.getQuery());
|
||||
|
@ -1086,7 +1086,7 @@ void ParseUriTest::onEnter()
|
|||
EXPECT_EQ("user", u.getUserName());
|
||||
EXPECT_EQ("", u.getPassword());
|
||||
EXPECT_EQ("host.com", u.getHost());
|
||||
EXPECT_EQ(0, u.getPort());
|
||||
EXPECT_EQ(80, u.getPort());
|
||||
EXPECT_EQ("user@host.com", u.getAuthority());
|
||||
EXPECT_EQ("/", u.getPath());
|
||||
EXPECT_EQ("", u.getQuery());
|
||||
|
@ -1101,7 +1101,7 @@ void ParseUriTest::onEnter()
|
|||
EXPECT_EQ("", u.getUserName());
|
||||
EXPECT_EQ("pass", u.getPassword());
|
||||
EXPECT_EQ("host.com", u.getHost());
|
||||
EXPECT_EQ(0, u.getPort());
|
||||
EXPECT_EQ(80, u.getPort());
|
||||
EXPECT_EQ(":pass@host.com", u.getAuthority());
|
||||
EXPECT_EQ("/", u.getPath());
|
||||
EXPECT_EQ("", u.getQuery());
|
||||
|
@ -1116,7 +1116,7 @@ void ParseUriTest::onEnter()
|
|||
EXPECT_EQ("", u.getUserName());
|
||||
EXPECT_EQ("", u.getPassword());
|
||||
EXPECT_EQ("host.com", u.getHost());
|
||||
EXPECT_EQ(0, u.getPort());
|
||||
EXPECT_EQ(80, u.getPort());
|
||||
EXPECT_EQ("host.com", u.getAuthority());
|
||||
EXPECT_EQ("/", u.getPath());
|
||||
EXPECT_EQ("", u.getQuery());
|
||||
|
@ -1131,7 +1131,7 @@ void ParseUriTest::onEnter()
|
|||
EXPECT_EQ("", u.getUserName());
|
||||
EXPECT_EQ("", u.getPassword());
|
||||
EXPECT_EQ("host.com", u.getHost());
|
||||
EXPECT_EQ(0, u.getPort());
|
||||
EXPECT_EQ(80, u.getPort());
|
||||
EXPECT_EQ("host.com", u.getAuthority());
|
||||
EXPECT_EQ("/", u.getPath());
|
||||
EXPECT_EQ("", u.getQuery());
|
||||
|
@ -1361,7 +1361,7 @@ void ParseUriTest::onEnter()
|
|||
Uri ipv6query = Uri::parse("http://[2001::7334:a]:90/foo/bar?foo=bar");
|
||||
|
||||
EXPECT_EQ(http.getScheme(), "http");
|
||||
EXPECT_EQ(http.getPort(), 0);
|
||||
EXPECT_EQ(http.getPort(), 80);
|
||||
EXPECT_EQ(http.getHost(), "google.com");
|
||||
EXPECT_EQ(https.getScheme(), "https");
|
||||
EXPECT_EQ(https.getPort(), 90);
|
||||
|
@ -1373,16 +1373,16 @@ void ParseUriTest::onEnter()
|
|||
EXPECT_EQ(localhost.getPort(), 8080);
|
||||
EXPECT_EQ(ipv6.getScheme(), "https");
|
||||
EXPECT_EQ(ipv6.getHostName(), "2001:0db8:85a3:0042:1000:8a2e:0370:7334");
|
||||
EXPECT_EQ(ipv6.getPort(), 0);
|
||||
EXPECT_EQ(ipv6.getPort(), 443);
|
||||
EXPECT_EQ(ipv6short.getScheme(), "http");
|
||||
EXPECT_EQ(ipv6short.getHostName(), "2001:db8:85a3:42:1000:8a2e:370:7334");
|
||||
EXPECT_EQ(ipv6short.getPort(), 0);
|
||||
EXPECT_EQ(ipv6short.getPort(), 80);
|
||||
EXPECT_EQ(ipv6port.getScheme(), "http");
|
||||
EXPECT_EQ(ipv6port.getHostName(), "2001:db8:85a3:42:1000:8a2e:370:7334");
|
||||
EXPECT_EQ(ipv6port.getPort(), 90);
|
||||
EXPECT_EQ(ipv6abbrev.getScheme(), "http");
|
||||
EXPECT_EQ(ipv6abbrev.getHostName(), "2001::7334:a:90");
|
||||
EXPECT_EQ(ipv6abbrev.getPort(), 0);
|
||||
EXPECT_EQ(ipv6abbrev.getPort(), 80);
|
||||
EXPECT_EQ(ipv6http.getScheme(), "http");
|
||||
EXPECT_EQ(ipv6http.getPort(), 90);
|
||||
EXPECT_EQ(ipv6http.getHostName(), "2001::7334:a");
|
||||
|
@ -1414,7 +1414,7 @@ void ParseUriTest::onEnter()
|
|||
|
||||
EXPECT_EQ(u2.getScheme(), "ws");
|
||||
EXPECT_EQ(u2.getHost(), "localhost");
|
||||
EXPECT_EQ(u2.getPort(), 0);
|
||||
EXPECT_EQ(u2.getPort(), 80);
|
||||
EXPECT_EQ(u2.getPath(), "/foo");
|
||||
|
||||
EXPECT_EQ(u3.getScheme(), "");
|
||||
|
|
Loading…
Reference in New Issue