mirror of https://github.com/axmolengine/axmol.git
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into add-master-build
This commit is contained in:
commit
3db3a12318
|
@ -1 +1 @@
|
|||
936b6bad063ed7529710ca0edf9290b051097b23
|
||||
3840d977454e06d4afa20ec009eee081f988ee03
|
|
@ -1 +1 @@
|
|||
b8986c04c89d3861f82fb99b0df633ac2cc4a13c
|
||||
044fbe06a7419f54a1da5bd5e597fe75024b6b88
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1 +1 @@
|
|||
2c5a07d179e9514618036dfb7cfedd3f9cf4c506
|
||||
59cab787aa72667424fc666730a33ab58d8e42cb
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -1491,12 +1491,22 @@ ScaleTo* ScaleTo::create(float duration, float sx, float sy)
|
|||
return scaleTo;
|
||||
}
|
||||
|
||||
ScaleTo* ScaleTo::create(float duration, float sx, float sy, float sz)
|
||||
{
|
||||
ScaleTo *scaleTo = new ScaleTo();
|
||||
scaleTo->initWithDuration(duration, sx, sy, sz);
|
||||
scaleTo->autorelease();
|
||||
|
||||
return scaleTo;
|
||||
}
|
||||
|
||||
bool ScaleTo::initWithDuration(float duration, float s)
|
||||
{
|
||||
if (ActionInterval::initWithDuration(duration))
|
||||
{
|
||||
_endScaleX = s;
|
||||
_endScaleY = s;
|
||||
_endScaleZ = s;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1510,6 +1520,21 @@ bool ScaleTo::initWithDuration(float duration, float sx, float sy)
|
|||
{
|
||||
_endScaleX = sx;
|
||||
_endScaleY = sy;
|
||||
_endScaleZ = 1.f;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ScaleTo::initWithDuration(float duration, float sx, float sy, float sz)
|
||||
{
|
||||
if (ActionInterval::initWithDuration(duration))
|
||||
{
|
||||
_endScaleX = sx;
|
||||
_endScaleY = sy;
|
||||
_endScaleZ = sz;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1521,7 +1546,7 @@ ScaleTo* ScaleTo::clone(void) const
|
|||
{
|
||||
// no copy constructor
|
||||
auto a = new ScaleTo();
|
||||
a->initWithDuration(_duration, _endScaleX, _endScaleY);
|
||||
a->initWithDuration(_duration, _endScaleX, _endScaleY, _endScaleZ);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -1538,8 +1563,10 @@ void ScaleTo::startWithTarget(Node *target)
|
|||
ActionInterval::startWithTarget(target);
|
||||
_startScaleX = target->getScaleX();
|
||||
_startScaleY = target->getScaleY();
|
||||
_startScaleZ = target->getScaleZ();
|
||||
_deltaX = _endScaleX - _startScaleX;
|
||||
_deltaY = _endScaleY - _startScaleY;
|
||||
_deltaZ = _endScaleZ - _startScaleZ;
|
||||
}
|
||||
|
||||
void ScaleTo::update(float time)
|
||||
|
@ -1548,6 +1575,7 @@ void ScaleTo::update(float time)
|
|||
{
|
||||
_target->setScaleX(_startScaleX + _deltaX * time);
|
||||
_target->setScaleY(_startScaleY + _deltaY * time);
|
||||
_target->setScaleZ(_startScaleZ + _deltaZ * time);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1567,7 +1595,16 @@ ScaleBy* ScaleBy::create(float duration, float s)
|
|||
ScaleBy* ScaleBy::create(float duration, float sx, float sy)
|
||||
{
|
||||
ScaleBy *scaleBy = new ScaleBy();
|
||||
scaleBy->initWithDuration(duration, sx, sy);
|
||||
scaleBy->initWithDuration(duration, sx, sy, 1.f);
|
||||
scaleBy->autorelease();
|
||||
|
||||
return scaleBy;
|
||||
}
|
||||
|
||||
ScaleBy* ScaleBy::create(float duration, float sx, float sy, float sz)
|
||||
{
|
||||
ScaleBy *scaleBy = new ScaleBy();
|
||||
scaleBy->initWithDuration(duration, sx, sy, sz);
|
||||
scaleBy->autorelease();
|
||||
|
||||
return scaleBy;
|
||||
|
@ -1577,7 +1614,7 @@ ScaleBy* ScaleBy::clone(void) const
|
|||
{
|
||||
// no copy constructor
|
||||
auto a = new ScaleBy();
|
||||
a->initWithDuration(_duration, _endScaleX, _endScaleY);
|
||||
a->initWithDuration(_duration, _endScaleX, _endScaleY, _endScaleZ);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -1587,11 +1624,12 @@ void ScaleBy::startWithTarget(Node *target)
|
|||
ScaleTo::startWithTarget(target);
|
||||
_deltaX = _startScaleX * _endScaleX - _startScaleX;
|
||||
_deltaY = _startScaleY * _endScaleY - _startScaleY;
|
||||
_deltaZ = _startScaleZ * _endScaleZ - _startScaleZ;
|
||||
}
|
||||
|
||||
ScaleBy* ScaleBy::reverse() const
|
||||
{
|
||||
return ScaleBy::create(_duration, 1 / _endScaleX, 1 / _endScaleY);
|
||||
return ScaleBy::create(_duration, 1 / _endScaleX, 1 / _endScaleY, 1/ _endScaleZ);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -622,6 +622,9 @@ public:
|
|||
/** creates the action with and X factor and a Y factor */
|
||||
static ScaleTo* create(float duration, float sx, float sy);
|
||||
|
||||
/** creates the action with X Y Z factor */
|
||||
static ScaleTo* create(float duration, float sx, float sy, float sz);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -637,15 +640,21 @@ protected:
|
|||
bool initWithDuration(float duration, float s);
|
||||
/** initializes the action with and X factor and a Y factor */
|
||||
bool initWithDuration(float duration, float sx, float sy);
|
||||
/** initializes the action with X Y Z factor */
|
||||
bool initWithDuration(float duration, float sx, float sy, float sz);
|
||||
|
||||
float _scaleX;
|
||||
float _scaleY;
|
||||
float _scaleZ;
|
||||
float _startScaleX;
|
||||
float _startScaleY;
|
||||
float _startScaleZ;
|
||||
float _endScaleX;
|
||||
float _endScaleY;
|
||||
float _endScaleZ;
|
||||
float _deltaX;
|
||||
float _deltaY;
|
||||
float _deltaZ;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ScaleTo);
|
||||
|
@ -662,6 +671,9 @@ public:
|
|||
/** creates the action with and X factor and a Y factor */
|
||||
static ScaleBy* create(float duration, float sx, float sy);
|
||||
|
||||
/** creates the action with X Y Z factor */
|
||||
static ScaleBy* create(float duration, float sx, float sy, float sz);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
|
|
@ -44,7 +44,6 @@ public:
|
|||
virtual int* getHorizontalKerningForTextUTF16(unsigned short *text, int &outNumLetters) const = 0;
|
||||
virtual const char* getCurrentGlyphCollection() const;
|
||||
|
||||
virtual unsigned char * getGlyphBitmap(unsigned short theChar, int &outWidth, int &outHeight) const { return 0; }
|
||||
|
||||
virtual int getFontMaxHeight() const { return 0; }
|
||||
|
||||
|
|
|
@ -221,8 +221,8 @@ bool FontAtlas::prepareLetterDefinitions(unsigned short *utf16String)
|
|||
int length = cc_wcslen(utf16String);
|
||||
|
||||
float offsetAdjust = _letterPadding / 2;
|
||||
int bitmapWidth;
|
||||
int bitmapHeight;
|
||||
long bitmapWidth;
|
||||
long bitmapHeight;
|
||||
Rect tempRect;
|
||||
FontLetterDefinition tempDef;
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <unordered_map>
|
||||
#include "CCPlatformMacros.h"
|
||||
#include "CCRef.h"
|
||||
#include "CCStdC.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -72,7 +73,7 @@ public:
|
|||
|
||||
bool prepareLetterDefinitions(unsigned short *utf16String);
|
||||
|
||||
inline const std::unordered_map<int, Texture2D*>& getTextures() const{ return _atlasTextures;}
|
||||
inline const std::unordered_map<ssize_t, Texture2D*>& getTextures() const{ return _atlasTextures;}
|
||||
void addTexture(Texture2D *texture, int slot);
|
||||
float getCommonLineHeight() const;
|
||||
void setCommonLineHeight(float newHeight);
|
||||
|
@ -98,7 +99,7 @@ public:
|
|||
private:
|
||||
|
||||
void relaseTextures();
|
||||
std::unordered_map<int, Texture2D*> _atlasTextures;
|
||||
std::unordered_map<ssize_t, Texture2D*> _atlasTextures;
|
||||
std::unordered_map<unsigned short, FontLetterDefinition> _fontLetterDefinitions;
|
||||
float _commonLineHeight;
|
||||
Font * _font;
|
||||
|
|
|
@ -219,7 +219,7 @@ int FontFreeType::getFontAscender() const
|
|||
return (static_cast<int>(_fontRef->size->metrics.ascender >> 6));
|
||||
}
|
||||
|
||||
unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, int &outWidth, int &outHeight, Rect &outRect,int &xAdvance)
|
||||
unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, long &outWidth, long &outHeight, Rect &outRect,int &xAdvance)
|
||||
{
|
||||
bool invalidChar = true;
|
||||
unsigned char * ret = nullptr;
|
||||
|
@ -260,8 +260,8 @@ unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, int &outWidt
|
|||
auto copyBitmap = new unsigned char[outWidth * outHeight];
|
||||
memcpy(copyBitmap,ret,outWidth * outHeight * sizeof(unsigned char));
|
||||
|
||||
int bitmapWidth;
|
||||
int bitmapHeight;
|
||||
long bitmapWidth;
|
||||
long bitmapHeight;
|
||||
FT_BBox bbox;
|
||||
auto outlineBitmap = getGlyphBitmapWithOutline(theChar,bbox);
|
||||
if(outlineBitmap == nullptr)
|
||||
|
@ -274,7 +274,7 @@ unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, int &outWidt
|
|||
bitmapWidth = (bbox.xMax - bbox.xMin)>>6;
|
||||
bitmapHeight = (bbox.yMax - bbox.yMin)>>6;
|
||||
|
||||
int index;
|
||||
long index;
|
||||
auto blendImage = new unsigned char[bitmapWidth * bitmapHeight * 2];
|
||||
memset(blendImage, 0, bitmapWidth * bitmapHeight * 2);
|
||||
for (int x = 0; x < bitmapWidth; ++x)
|
||||
|
@ -286,8 +286,8 @@ unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, int &outWidt
|
|||
}
|
||||
}
|
||||
|
||||
int maxX = outWidth + _outlineSize;
|
||||
int maxY = outHeight + _outlineSize;
|
||||
long maxX = outWidth + _outlineSize;
|
||||
long maxY = outHeight + _outlineSize;
|
||||
for (int x = _outlineSize; x < maxX; ++x)
|
||||
{
|
||||
for (int y = _outlineSize; y < maxY; ++y)
|
||||
|
@ -347,15 +347,15 @@ unsigned char * FontFreeType::getGlyphBitmapWithOutline(unsigned short theChar,
|
|||
{
|
||||
FT_Outline *outline = &reinterpret_cast<FT_OutlineGlyph>(glyph)->outline;
|
||||
FT_Glyph_Get_CBox(glyph,FT_GLYPH_BBOX_GRIDFIT,&bbox);
|
||||
int width = (bbox.xMax - bbox.xMin)>>6;
|
||||
int rows = (bbox.yMax - bbox.yMin)>>6;
|
||||
long width = (bbox.xMax - bbox.xMin)>>6;
|
||||
long rows = (bbox.yMax - bbox.yMin)>>6;
|
||||
|
||||
FT_Bitmap bmp;
|
||||
bmp.buffer = new unsigned char[width * rows];
|
||||
memset(bmp.buffer, 0, width * rows);
|
||||
bmp.width = width;
|
||||
bmp.rows = rows;
|
||||
bmp.pitch = width;
|
||||
bmp.width = (int)width;
|
||||
bmp.rows = (int)rows;
|
||||
bmp.pitch = (int)width;
|
||||
bmp.pixel_mode = FT_PIXEL_MODE_GRAY;
|
||||
bmp.num_grays = 256;
|
||||
|
||||
|
@ -377,9 +377,9 @@ unsigned char * FontFreeType::getGlyphBitmapWithOutline(unsigned short theChar,
|
|||
return ret;
|
||||
}
|
||||
|
||||
unsigned char * makeDistanceMap( unsigned char *img, unsigned int width, unsigned int height)
|
||||
unsigned char * makeDistanceMap( unsigned char *img, long width, long height)
|
||||
{
|
||||
unsigned int pixelAmount = (width + 2 * FontFreeType::DistanceMapSpread) * (height + 2 * FontFreeType::DistanceMapSpread);
|
||||
long pixelAmount = (width + 2 * FontFreeType::DistanceMapSpread) * (height + 2 * FontFreeType::DistanceMapSpread);
|
||||
|
||||
short * xdist = (short *) malloc( pixelAmount * sizeof(short) );
|
||||
short * ydist = (short *) malloc( pixelAmount * sizeof(short) );
|
||||
|
@ -391,7 +391,7 @@ unsigned char * makeDistanceMap( unsigned char *img, unsigned int width, unsigne
|
|||
unsigned int i,j;
|
||||
|
||||
// Convert img into double (data) rescale image levels between 0 and 1
|
||||
unsigned int outWidth = width + 2 * FontFreeType::DistanceMapSpread;
|
||||
long outWidth = width + 2 * FontFreeType::DistanceMapSpread;
|
||||
for (i = 0; i < width; ++i)
|
||||
{
|
||||
for (j = 0; j < height; ++j)
|
||||
|
@ -404,8 +404,8 @@ unsigned char * makeDistanceMap( unsigned char *img, unsigned int width, unsigne
|
|||
height += 2 * FontFreeType::DistanceMapSpread;
|
||||
|
||||
// Transform background (outside contour, in areas of 0's)
|
||||
computegradient( data, width, height, gx, gy);
|
||||
edtaa3(data, gx, gy, width, height, xdist, ydist, outside);
|
||||
computegradient( data, (int)width, (int)height, gx, gy);
|
||||
edtaa3(data, gx, gy, (int)width, (int)height, xdist, ydist, outside);
|
||||
for( i=0; i< pixelAmount; i++)
|
||||
if( outside[i] < 0.0 )
|
||||
outside[i] = 0.0;
|
||||
|
@ -413,8 +413,8 @@ unsigned char * makeDistanceMap( unsigned char *img, unsigned int width, unsigne
|
|||
// Transform foreground (inside contour, in areas of 1's)
|
||||
for( i=0; i< pixelAmount; i++)
|
||||
data[i] = 1 - data[i];
|
||||
computegradient( data, width, height, gx, gy);
|
||||
edtaa3(data, gx, gy, width, height, xdist, ydist, inside);
|
||||
computegradient( data, (int)width, (int)height, gx, gy);
|
||||
edtaa3(data, gx, gy, (int)width, (int)height, xdist, ydist, inside);
|
||||
for( i=0; i< pixelAmount; i++)
|
||||
if( inside[i] < 0.0 )
|
||||
inside[i] = 0.0;
|
||||
|
@ -458,7 +458,7 @@ unsigned char * makeDistanceMap( unsigned char *img, unsigned int width, unsigne
|
|||
return out;
|
||||
}
|
||||
|
||||
void FontFreeType::renderCharAt(unsigned char *dest,int posX, int posY, unsigned char* bitmap,int bitmapWidth,int bitmapHeight)
|
||||
void FontFreeType::renderCharAt(unsigned char *dest,int posX, int posY, unsigned char* bitmap,long bitmapWidth,long bitmapHeight)
|
||||
{
|
||||
int iX = posX;
|
||||
int iY = posY;
|
||||
|
@ -470,9 +470,9 @@ void FontFreeType::renderCharAt(unsigned char *dest,int posX, int posY, unsigned
|
|||
bitmapWidth += 2 * DistanceMapSpread;
|
||||
bitmapHeight += 2 * DistanceMapSpread;
|
||||
|
||||
for (int y = 0; y < bitmapHeight; ++y)
|
||||
for (long y = 0; y < bitmapHeight; ++y)
|
||||
{
|
||||
int bitmap_y = y * bitmapWidth;
|
||||
long bitmap_y = y * bitmapWidth;
|
||||
|
||||
for (int x = 0; x < bitmapWidth; ++x)
|
||||
{
|
||||
|
@ -497,9 +497,9 @@ void FontFreeType::renderCharAt(unsigned char *dest,int posX, int posY, unsigned
|
|||
else if(_outlineSize > 0)
|
||||
{
|
||||
unsigned char tempChar;
|
||||
for (int y = 0; y < bitmapHeight; ++y)
|
||||
for (long y = 0; y < bitmapHeight; ++y)
|
||||
{
|
||||
int bitmap_y = y * bitmapWidth;
|
||||
long bitmap_y = y * bitmapWidth;
|
||||
|
||||
for (int x = 0; x < bitmapWidth; ++x)
|
||||
{
|
||||
|
@ -518,9 +518,9 @@ void FontFreeType::renderCharAt(unsigned char *dest,int posX, int posY, unsigned
|
|||
}
|
||||
else
|
||||
{
|
||||
for (int y = 0; y < bitmapHeight; ++y)
|
||||
for (long y = 0; y < bitmapHeight; ++y)
|
||||
{
|
||||
int bitmap_y = y * bitmapWidth;
|
||||
long bitmap_y = y * bitmapWidth;
|
||||
|
||||
for (int x = 0; x < bitmapWidth; ++x)
|
||||
{
|
||||
|
|
|
@ -48,12 +48,12 @@ public:
|
|||
|
||||
bool isDistanceFieldEnabled() const { return _distanceFieldEnabled;}
|
||||
int getOutlineSize() const { return _outlineSize; }
|
||||
void renderCharAt(unsigned char *dest,int posX, int posY, unsigned char* bitmap,int bitmapWidth,int bitmapHeight);
|
||||
void renderCharAt(unsigned char *dest,int posX, int posY, unsigned char* bitmap,long bitmapWidth,long bitmapHeight);
|
||||
|
||||
virtual FontAtlas * createFontAtlas() override;
|
||||
virtual int * getHorizontalKerningForTextUTF16(unsigned short *text, int &outNumLetters) const override;
|
||||
|
||||
unsigned char * getGlyphBitmap(unsigned short theChar, int &outWidth, int &outHeight, Rect &outRect,int &xAdvance);
|
||||
unsigned char * getGlyphBitmap(unsigned short theChar, long &outWidth, long &outHeight, Rect &outRect,int &xAdvance);
|
||||
|
||||
virtual int getFontMaxHeight() const override;
|
||||
virtual int getFontAscender() const;
|
||||
|
|
|
@ -103,7 +103,7 @@ protected:
|
|||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void insertText(const char * text, int len) {CC_UNUSED_PARAM(text);CC_UNUSED_PARAM(len);}
|
||||
virtual void insertText(const char * text, size_t len) {CC_UNUSED_PARAM(text);CC_UNUSED_PARAM(len);}
|
||||
|
||||
/**
|
||||
@brief Called by IMEDispatcher after the user clicks the backward key.
|
||||
|
|
|
@ -214,7 +214,7 @@ void IMEDispatcher::removeDelegate(IMEDelegate* delegate)
|
|||
// dispatch text message
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void IMEDispatcher::dispatchInsertText(const char * text, int len)
|
||||
void IMEDispatcher::dispatchInsertText(const char * text, size_t len)
|
||||
{
|
||||
do
|
||||
{
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
void dispatchInsertText(const char * text, int len);
|
||||
void dispatchInsertText(const char * text, size_t len);
|
||||
|
||||
/**
|
||||
@brief Dispatches the delete-backward operation.
|
||||
|
|
|
@ -446,7 +446,7 @@ bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Point& im
|
|||
reset();
|
||||
return false;
|
||||
}
|
||||
|
||||
_bmFontPath = bmfontFilePath;
|
||||
setFontAtlas(newAtlas);
|
||||
_currentLabelType = LabelType::BMFONT;
|
||||
|
||||
|
@ -457,6 +457,17 @@ void Label::setFontDefinition(const FontDefinition& textDefinition)
|
|||
{
|
||||
reset();
|
||||
_fontDefinition = textDefinition;
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID) && (CC_TARGET_PLATFORM != CC_PLATFORM_IOS)
|
||||
setColor(_fontDefinition._fontFillColor);
|
||||
_fontDefinition._fontFillColor = Color3B::WHITE;
|
||||
#else
|
||||
if ( !textDefinition._shadow._shadowEnabled && !textDefinition._stroke._strokeEnabled)
|
||||
{
|
||||
setColor(_fontDefinition._fontFillColor);
|
||||
_fontDefinition._fontFillColor = Color3B::WHITE;
|
||||
}
|
||||
#endif
|
||||
|
||||
_fontName = textDefinition._fontName;
|
||||
_fontSize = textDefinition._fontSize;
|
||||
_contentDirty = true;
|
||||
|
@ -624,17 +635,7 @@ void Label::alignText()
|
|||
}
|
||||
}
|
||||
|
||||
int index;
|
||||
for (int ctr = 0; ctr < _limitShowCount; ++ctr)
|
||||
{
|
||||
if (_lettersInfo[ctr].def.validDefinition)
|
||||
{
|
||||
updateSpriteWithLetterDefinition(_lettersInfo[ctr].def,textures[_lettersInfo[ctr].def.textureID]);
|
||||
_reusedLetter->setPosition(_lettersInfo[ctr].position);
|
||||
index = _batchNodes[_lettersInfo[ctr].def.textureID]->getTextureAtlas()->getTotalQuads();
|
||||
_batchNodes[_lettersInfo[ctr].def.textureID]->insertQuadFromSprite(_reusedLetter,index);
|
||||
}
|
||||
}
|
||||
updateQuads();
|
||||
|
||||
updateColor();
|
||||
}
|
||||
|
@ -691,16 +692,30 @@ bool Label::setCurrentString(unsigned short *stringToSet)
|
|||
return true;
|
||||
}
|
||||
|
||||
void Label::updateSpriteWithLetterDefinition(const FontLetterDefinition &theDefinition, Texture2D *theTexture)
|
||||
void Label::updateQuads()
|
||||
{
|
||||
_reusedRect.size.height = theDefinition.height;
|
||||
_reusedRect.size.width = theDefinition.width;
|
||||
_reusedRect.origin.x = theDefinition.U;
|
||||
_reusedRect.origin.y = theDefinition.V;
|
||||
int index;
|
||||
for (int ctr = 0; ctr < _limitShowCount; ++ctr)
|
||||
{
|
||||
auto &letterDef = _lettersInfo[ctr].def;
|
||||
|
||||
if(_reusedLetter->getBatchNode() != _batchNodes[theDefinition.textureID])
|
||||
_reusedLetter->setBatchNode(_batchNodes[theDefinition.textureID]);
|
||||
if (letterDef.validDefinition)
|
||||
{
|
||||
_reusedRect.size.height = letterDef.height;
|
||||
_reusedRect.size.width = letterDef.width;
|
||||
_reusedRect.origin.x = letterDef.U;
|
||||
_reusedRect.origin.y = letterDef.V;
|
||||
|
||||
if(_reusedLetter->getBatchNode() != _batchNodes[letterDef.textureID])
|
||||
_reusedLetter->setBatchNode(_batchNodes[letterDef.textureID]);
|
||||
_reusedLetter->setTextureRect(_reusedRect,false,_reusedRect.size);
|
||||
|
||||
_reusedLetter->setPosition(_lettersInfo[ctr].position);
|
||||
index = static_cast<int>(_batchNodes[letterDef.textureID]->getTextureAtlas()->getTotalQuads());
|
||||
_lettersInfo[ctr].atlasIndex = index;
|
||||
_batchNodes[letterDef.textureID]->insertQuadFromSprite(_reusedLetter,index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Label::recordLetterInfo(const cocos2d::Point& point,const FontLetterDefinition& letterDef, int spriteIndex)
|
||||
|
@ -1039,7 +1054,7 @@ const std::string& Label::getFontName() const
|
|||
return _fontName;
|
||||
}
|
||||
|
||||
void Label::setFontSize(int fontSize)
|
||||
void Label::setFontSize(float fontSize)
|
||||
{
|
||||
if (_fontSize != fontSize)
|
||||
{
|
||||
|
@ -1048,41 +1063,47 @@ void Label::setFontSize(int fontSize)
|
|||
}
|
||||
}
|
||||
|
||||
int Label::getFontSize() const
|
||||
float Label::getFontSize() const
|
||||
{
|
||||
return _fontSize;
|
||||
}
|
||||
|
||||
///// PROTOCOL STUFF
|
||||
Sprite * Label::getLetter(int lettetIndex)
|
||||
Sprite * Label::getLetter(int letterIndex)
|
||||
{
|
||||
if (_fontDirty)
|
||||
{
|
||||
updateFont();
|
||||
}
|
||||
if (_contentDirty)
|
||||
{
|
||||
updateContent();
|
||||
}
|
||||
|
||||
if (! _textSprite && lettetIndex < _limitShowCount)
|
||||
if (! _textSprite && letterIndex < _limitShowCount)
|
||||
{
|
||||
if(! _lettersInfo[lettetIndex].def.validDefinition)
|
||||
const auto &letter = _lettersInfo[letterIndex];
|
||||
|
||||
if(! letter.def.validDefinition)
|
||||
return nullptr;
|
||||
|
||||
Sprite* sp = static_cast<Sprite*>(this->getChildByTag(lettetIndex));
|
||||
Sprite* sp = static_cast<Sprite*>(this->getChildByTag(letterIndex));
|
||||
|
||||
if (!sp)
|
||||
{
|
||||
Rect uvRect;
|
||||
uvRect.size.height = _lettersInfo[lettetIndex].def.height;
|
||||
uvRect.size.width = _lettersInfo[lettetIndex].def.width;
|
||||
uvRect.origin.x = _lettersInfo[lettetIndex].def.U;
|
||||
uvRect.origin.y = _lettersInfo[lettetIndex].def.V;
|
||||
uvRect.size.height = letter.def.height;
|
||||
uvRect.size.width = letter.def.width;
|
||||
uvRect.origin.x = letter.def.U;
|
||||
uvRect.origin.y = letter.def.V;
|
||||
|
||||
sp = Sprite::createWithTexture(_fontAtlas->getTexture(_lettersInfo[lettetIndex].def.textureID),uvRect);
|
||||
sp->setBatchNode(this);
|
||||
sp->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
sp->setPosition(Point(_lettersInfo[lettetIndex].position.x+uvRect.size.width/2,_lettersInfo[lettetIndex].position.y-uvRect.size.height/2));
|
||||
sp = Sprite::createWithTexture(_fontAtlas->getTexture(letter.def.textureID),uvRect);
|
||||
sp->setBatchNode(_batchNodes[letter.def.textureID]);
|
||||
sp->setPosition(Point(letter.position.x + uvRect.size.width / 2,
|
||||
letter.position.y - uvRect.size.height / 2));
|
||||
sp->setOpacity(_realOpacity);
|
||||
|
||||
this->addSpriteWithoutQuad(sp, lettetIndex, lettetIndex);
|
||||
_batchNodes[letter.def.textureID]->addSpriteWithoutQuad(sp, letter.atlasIndex, letterIndex);
|
||||
}
|
||||
return sp;
|
||||
}
|
||||
|
@ -1120,7 +1141,7 @@ void Label::computeStringNumLines()
|
|||
|
||||
int Label::getStringLength() const
|
||||
{
|
||||
return _currentUTF16String ? cc_wcslen(_currentUTF16String) : 0;
|
||||
return _currentUTF16String ? cc_wcslen(_currentUTF16String) : (int)_originalUTF8String.length();
|
||||
}
|
||||
|
||||
// RGBA protocol
|
||||
|
@ -1140,34 +1161,28 @@ void Label::setOpacityModifyRGB(bool isOpacityModifyRGB)
|
|||
_reusedLetter->setOpacityModifyRGB(true);
|
||||
}
|
||||
|
||||
void Label::setColor(const Color3B& color)
|
||||
void Label::updateDisplayedColor(const Color3B& parentColor)
|
||||
{
|
||||
_fontDefinition._fontFillColor = color;
|
||||
_displayedColor.r = _realColor.r * parentColor.r/255.0;
|
||||
_displayedColor.g = _realColor.g * parentColor.g/255.0;
|
||||
_displayedColor.b = _realColor.b * parentColor.b/255.0;
|
||||
updateColor();
|
||||
|
||||
if (_textSprite)
|
||||
{
|
||||
updateContent();
|
||||
_textSprite->updateDisplayedColor(_displayedColor);
|
||||
}
|
||||
if (_reusedLetter)
|
||||
{
|
||||
_reusedLetter->setColor(color);
|
||||
}
|
||||
SpriteBatchNode::setColor(color);
|
||||
}
|
||||
|
||||
void Label::updateColor()
|
||||
{
|
||||
Color4B color4( _displayedColor.r, _displayedColor.g, _displayedColor.b, _displayedOpacity );
|
||||
if (_textSprite)
|
||||
{
|
||||
_textSprite->setColor(_displayedColor);
|
||||
_textSprite->setOpacity(_displayedOpacity);
|
||||
}
|
||||
|
||||
if (nullptr == _textureAtlas)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Color4B color4( _displayedColor.r, _displayedColor.g, _displayedColor.b, _displayedOpacity );
|
||||
|
||||
// special opacity for premultiplied textures
|
||||
if (_isOpacityModifyRGB)
|
||||
{
|
||||
|
|
|
@ -116,6 +116,7 @@ public:
|
|||
virtual bool setTTFConfig(const TTFConfig& ttfConfig);
|
||||
|
||||
virtual bool setBMFontFilePath(const std::string& bmfontFilePath, const Point& imageOffset = Point::ZERO);
|
||||
const std::string& getBMFontFilePath() const { return _bmFontPath;}
|
||||
|
||||
virtual bool setCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap);
|
||||
virtual bool setCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap);
|
||||
|
@ -199,12 +200,12 @@ public:
|
|||
virtual void setFontName(const std::string& fontName);
|
||||
virtual const std::string& getFontName() const;
|
||||
|
||||
virtual void setFontSize(int fontSize);
|
||||
virtual int getFontSize() const;
|
||||
virtual void setFontSize(float fontSize);
|
||||
virtual float getFontSize() const;
|
||||
|
||||
virtual bool isOpacityModifyRGB() const override;
|
||||
virtual void setOpacityModifyRGB(bool isOpacityModifyRGB) override;
|
||||
virtual void setColor(const Color3B& color) override;
|
||||
virtual void updateDisplayedColor(const Color3B& parentColor) override;
|
||||
|
||||
virtual Sprite * getLetter(int lettetIndex);
|
||||
|
||||
|
@ -248,6 +249,7 @@ protected:
|
|||
|
||||
Point position;
|
||||
Size contentSize;
|
||||
int atlasIndex;
|
||||
};
|
||||
enum class LabelType {
|
||||
|
||||
|
@ -282,7 +284,7 @@ protected:
|
|||
bool setOriginalString(unsigned short *stringToSet);
|
||||
void computeStringNumLines();
|
||||
|
||||
void updateSpriteWithLetterDefinition(const FontLetterDefinition &theDefinition, Texture2D *theTexture);
|
||||
void updateQuads();
|
||||
|
||||
virtual void updateColor() override;
|
||||
|
||||
|
@ -295,11 +297,13 @@ protected:
|
|||
void updateFont();
|
||||
void reset();
|
||||
|
||||
std::string _bmFontPath;
|
||||
|
||||
bool _isOpacityModifyRGB;
|
||||
bool _contentDirty;
|
||||
bool _fontDirty;
|
||||
std::string _fontName;
|
||||
int _fontSize;
|
||||
float _fontSize;
|
||||
LabelType _currentLabelType;
|
||||
|
||||
std::vector<SpriteBatchNode*> _batchNodes;
|
||||
|
|
|
@ -120,7 +120,7 @@ const std::string& LabelTTF::getString() const
|
|||
|
||||
std::string LabelTTF::getDescription() const
|
||||
{
|
||||
return StringUtils::format("<LabelTTF | FontName = %s, FontSize = %.1f, Label = '%s'>", _renderLabel->getFontName().c_str(), _renderLabel->getFontSize(), _renderLabel->getString().c_str());
|
||||
return StringUtils::format("<LabelTTF | FontName = %s, FontSize = %f, Label = '%s'>", _renderLabel->getFontName().c_str(), _renderLabel->getFontSize(), _renderLabel->getString().c_str());
|
||||
}
|
||||
|
||||
TextHAlignment LabelTTF::getHorizontalAlignment() const
|
||||
|
|
|
@ -172,16 +172,16 @@ public:
|
|||
For example: a tile map (TMXMap) or a label with lots of characters (LabelBMFont)
|
||||
*/
|
||||
void insertQuadFromSprite(Sprite *sprite, ssize_t index);
|
||||
/* This is the opposite of "addQuadFromSprite.
|
||||
It add the sprite to the children and descendants array, but it doesn't update add it to the texture atlas
|
||||
*/
|
||||
SpriteBatchNode * addSpriteWithoutQuad(Sprite *child, int z, int aTag);
|
||||
protected:
|
||||
/** Updates a quad at a certain index into the texture atlas. The Sprite won't be added into the children array.
|
||||
This method should be called only when you are dealing with very big AtlasSrite and when most of the Sprite won't be updated.
|
||||
For example: a tile map (TMXMap) or a label with lots of characters (LabelBMFont)
|
||||
*/
|
||||
void updateQuadFromSprite(Sprite *sprite, ssize_t index);
|
||||
/* This is the opposite of "addQuadFromSprite.
|
||||
It add the sprite to the children and descendants array, but it doesn't update add it to the texture atlas
|
||||
*/
|
||||
SpriteBatchNode * addSpriteWithoutQuad(Sprite *child, int z, int aTag);
|
||||
|
||||
void updateAtlasIndex(Sprite* sprite, ssize_t* curIndex);
|
||||
void swap(ssize_t oldIndex, ssize_t newIndex);
|
||||
|
|
|
@ -160,7 +160,7 @@ bool TextFieldTTF::canDetachWithIME()
|
|||
return (_delegate) ? (! _delegate->onTextFieldDetachWithIME(this)) : true;
|
||||
}
|
||||
|
||||
void TextFieldTTF::insertText(const char * text, int len)
|
||||
void TextFieldTTF::insertText(const char * text, size_t len)
|
||||
{
|
||||
std::string insert(text, len);
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
/**
|
||||
@brief If the sender doesn't want to insert the text, return true;
|
||||
*/
|
||||
virtual bool onTextFieldInsertText(TextFieldTTF * sender, const char * text, int nLen)
|
||||
virtual bool onTextFieldInsertText(TextFieldTTF * sender, const char * text, size_t nLen)
|
||||
{
|
||||
CC_UNUSED_PARAM(sender);
|
||||
CC_UNUSED_PARAM(text);
|
||||
|
@ -181,7 +181,7 @@ protected:
|
|||
|
||||
virtual bool canAttachWithIME() override;
|
||||
virtual bool canDetachWithIME() override;
|
||||
virtual void insertText(const char * text, int len) override;
|
||||
virtual void insertText(const char * text, size_t len) override;
|
||||
virtual void deleteBackward() override;
|
||||
virtual const std::string& getContentText() override;
|
||||
private:
|
||||
|
|
|
@ -742,7 +742,11 @@ void FileUtils::setSearchResolutionsOrder(const std::vector<std::string>& search
|
|||
|
||||
void FileUtils::addSearchResolutionsOrder(const std::string &order)
|
||||
{
|
||||
_searchResolutionsOrderArray.push_back(order);
|
||||
std::string resOrder = order;
|
||||
if (!resOrder.empty() && resOrder[resOrder.length()-1] != '/')
|
||||
resOrder.append("/");
|
||||
|
||||
_searchResolutionsOrderArray.push_back(resOrder);
|
||||
}
|
||||
|
||||
const std::vector<std::string>& FileUtils::getSearchResolutionsOrder()
|
||||
|
|
|
@ -529,9 +529,9 @@ void GLView::onGLFWMouseCallBack(GLFWwindow* window, int button, int action, int
|
|||
}
|
||||
else if(GLFW_RELEASE == action)
|
||||
{
|
||||
_captured = false;
|
||||
if (this->getViewPortRect().equals(Rect::ZERO) || this->getViewPortRect().containsPoint(Point(_mouseX,_mouseY)))
|
||||
if (_captured)
|
||||
{
|
||||
_captured = false;
|
||||
int id = 0;
|
||||
this->handleTouchesEnd(1, &id, &_mouseX, &_mouseY);
|
||||
}
|
||||
|
@ -574,13 +574,10 @@ void GLView::onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y)
|
|||
}
|
||||
|
||||
if (_captured)
|
||||
{
|
||||
if (this->getViewPortRect().equals(Rect::ZERO) || this->getViewPortRect().containsPoint(Point(_mouseX, _mouseY)))
|
||||
{
|
||||
int id = 0;
|
||||
this->handleTouchesMove(1, &id, &_mouseX, &_mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
EventMouse event(EventMouse::MouseEventType::MOUSE_MOVE);
|
||||
//Because OpenGL and cocos2d-x uses different Y axis, we need to convert the coordinate here
|
||||
|
|
|
@ -34,7 +34,7 @@ static id s_sharedDirectorCaller;
|
|||
@interface NSObject(CADisplayLink)
|
||||
+(id) displayLinkWithTarget: (id)arg1 selector:(SEL)arg2;
|
||||
-(void) addToRunLoop: (id)arg1 forMode: (id)arg2;
|
||||
-(void) setFrameInterval: (int)interval;
|
||||
-(void) setFrameInterval: (NSInteger)interval;
|
||||
-(void) invalidate;
|
||||
@end
|
||||
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2008 Otto Chrons at Seastringo Oy.
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.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
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCPlatformConfig.h"
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS
|
||||
|
||||
#import <TargetConditionals.h>
|
||||
|
||||
// when compiling to ARM (iPhone device), hide everything and use system defaults
|
||||
// if you wish to use simulation mode even on the device, remove the #if/#endif
|
||||
#if !TARGET_CPU_ARM
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
// this is exactly the same as UIAcceleration, but we can modify the member variables
|
||||
@interface UIAccelerationSimulation: NSObject
|
||||
{
|
||||
NSTimeInterval timestamp;
|
||||
UIAccelerationValue x, y, z;
|
||||
}
|
||||
@property(nonatomic, readonly) NSTimeInterval timestamp;
|
||||
@property(nonatomic, readonly) UIAccelerationValue x, y, z;
|
||||
|
||||
@end
|
||||
|
||||
// override UIAccelerometer behavior
|
||||
@interface UIAccelerometer (Simulation)
|
||||
+ (UIAccelerometer *)sharedAccelerometer;
|
||||
@end
|
||||
|
||||
// our own version of the Accelerometer
|
||||
@interface CCAccelerometerSimulation : UIAccelerometer <NSMachPortDelegate>
|
||||
{
|
||||
|
||||
//CFSocketRef udpSocket;
|
||||
int udpSocket;
|
||||
NSThread *thread;
|
||||
BOOL isExiting;
|
||||
id<UIAccelerometerDelegate> accelDelegate;
|
||||
UIAccelerationSimulation *accObject;
|
||||
// Threaded notification support
|
||||
NSMutableArray *notifications;
|
||||
NSThread *notificationThread;
|
||||
NSLock *notificationLock;
|
||||
NSMachPort *notificationPort;
|
||||
}
|
||||
|
||||
@property(nonatomic, assign) id<UIAccelerometerDelegate> delegate;
|
||||
|
||||
- (void) setUpThreadingSupport;
|
||||
- (void) handleMachMessage:(void *) msg;
|
||||
- (void) processNotification:(NSNotification *) notification;
|
||||
+ (CCAccelerometerSimulation *)getAccelerometer;
|
||||
- (CCAccelerometerSimulation *)initialize;
|
||||
|
||||
@end
|
||||
|
||||
#endif // !TARGET_CPU_ARM
|
||||
|
||||
#endif // CC_PLATFORM_IOS
|
|
@ -1,270 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2008 Otto Chrons at Seastringo Oy.
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.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
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#import "AccelerometerSimulation.h"
|
||||
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS
|
||||
|
||||
// when compiling to ARM (iPhone device), hide everything and use system defaults
|
||||
// if you wish to use simulation mode even on the device, remove the #if/#endif
|
||||
#if !TARGET_CPU_ARM
|
||||
|
||||
#import <netdb.h>
|
||||
|
||||
#define kAccelerometerSimulationPort 10552
|
||||
|
||||
@implementation UIAccelerationSimulation
|
||||
|
||||
@synthesize timestamp;
|
||||
@synthesize x;
|
||||
@synthesize y;
|
||||
@synthesize z;
|
||||
|
||||
-(UIAccelerationSimulation*)initWithTimestamp:(NSTimeInterval)aTimeStamp
|
||||
X:(UIAccelerationValue)ax
|
||||
Y:(UIAccelerationValue)ay
|
||||
Z:(UIAccelerationValue)az
|
||||
{
|
||||
timestamp = aTimeStamp;
|
||||
x = ax;
|
||||
y = ay;
|
||||
z = az;
|
||||
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation UIAccelerometer (Simulation)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"
|
||||
// override the static method and return our simulated version instead
|
||||
+ (UIAccelerometer *)sharedAccelerometer
|
||||
{
|
||||
return [CCAccelerometerSimulation getAccelerometer];
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
@end
|
||||
/*
|
||||
// callback that never got called with CFSocket UDP...
|
||||
|
||||
void mySocketCallBack( CFSocketRef s,
|
||||
CFSocketCallBackType callbackType,
|
||||
CFDataRef address,
|
||||
const void *data,
|
||||
void *info)
|
||||
{
|
||||
AccelerometerSimulation *accSim = (AccelerometerSimulation*)info;
|
||||
|
||||
NSLog(@"Data %s received", (char*)data);
|
||||
}
|
||||
*/
|
||||
|
||||
// singleton
|
||||
static CCAccelerometerSimulation *sharedAccelerometer = NULL;
|
||||
|
||||
@implementation CCAccelerometerSimulation
|
||||
|
||||
- (void) dealloc {
|
||||
if (sharedAccelerometer) {
|
||||
[sharedAccelerometer release];
|
||||
sharedAccelerometer = NULL;
|
||||
}
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
// this is straight from developer guide example for multi-threaded notifications
|
||||
- (void) setUpThreadingSupport {
|
||||
if ( notifications ) return;
|
||||
|
||||
notifications = [[NSMutableArray alloc] init];
|
||||
notificationLock = [[NSLock alloc] init];
|
||||
notificationThread = [[NSThread currentThread] retain];
|
||||
|
||||
notificationPort = [[NSMachPort alloc] init];
|
||||
[notificationPort setDelegate:self];
|
||||
[[NSRunLoop currentRunLoop] addPort:notificationPort
|
||||
forMode:(NSString *) kCFRunLoopCommonModes];
|
||||
}
|
||||
|
||||
// this is straight from developer guide example
|
||||
|
||||
- (void) processNotification:(NSNotification *) notification {
|
||||
if( [NSThread currentThread] != notificationThread ) {
|
||||
// Forward the notification to the correct thread, this is the socket thread
|
||||
NSDate* date = [[NSDate alloc] init];
|
||||
[notificationLock lock];
|
||||
[notifications addObject:notification];
|
||||
[notificationLock unlock];
|
||||
[notificationPort sendBeforeDate:date
|
||||
components:nil
|
||||
from:nil
|
||||
reserved:0];
|
||||
[date release];
|
||||
}
|
||||
else {
|
||||
// now we are in the main thread
|
||||
// Process the notification here;
|
||||
NSString *data = (NSString*)[notification object];
|
||||
|
||||
// parse the data, no error handling!
|
||||
NSArray *components = [data componentsSeparatedByString:@","];
|
||||
|
||||
// create our own acceleration object
|
||||
[accObject initWithTimestamp:[[components objectAtIndex:1] doubleValue]
|
||||
X:[[components objectAtIndex:2] doubleValue]
|
||||
Y:[[components objectAtIndex:3] doubleValue]
|
||||
Z:[[components objectAtIndex:4] doubleValue]];
|
||||
[accelDelegate accelerometer:self didAccelerate:(UIAcceleration*)accObject];
|
||||
}
|
||||
}
|
||||
|
||||
// this is straight from developer guide example
|
||||
- (void) handleMachMessage:(void *) msg {
|
||||
[notificationLock lock];
|
||||
while ( [notifications count] ) {
|
||||
NSNotification *notification = [[notifications objectAtIndex:0] retain];
|
||||
[notifications removeObjectAtIndex:0];
|
||||
[notificationLock unlock];
|
||||
[self processNotification:notification];
|
||||
[notification release];
|
||||
[notificationLock lock];
|
||||
};
|
||||
[notificationLock unlock];
|
||||
}
|
||||
#ifndef __clang_analyzer__
|
||||
+ (CCAccelerometerSimulation *)getAccelerometer
|
||||
{
|
||||
if( sharedAccelerometer == NULL )
|
||||
sharedAccelerometer = [[CCAccelerometerSimulation alloc] initialize];
|
||||
|
||||
return sharedAccelerometer;
|
||||
}
|
||||
#endif
|
||||
- (void)threadLoop:(id)object
|
||||
{
|
||||
char buffer[1024];
|
||||
// we never exit...
|
||||
while(1) {
|
||||
int count = recv( udpSocket, buffer, sizeof(buffer), 0 );
|
||||
if( count > 0 )
|
||||
{
|
||||
// got data, let's pass it on
|
||||
buffer[count] = 0;
|
||||
NSString *str = [[NSString alloc] initWithUTF8String:buffer];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"ThreadAccelNotification" object:str];
|
||||
[str release];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// initialize our version of the accelerometer
|
||||
- (CCAccelerometerSimulation *)initialize
|
||||
{
|
||||
accObject = [UIAccelerationSimulation alloc];
|
||||
isExiting = false;
|
||||
|
||||
// couldn't get the CFSocket version to work with UDP and runloop, so used Berkeley sockets and a thread instead
|
||||
|
||||
udpSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
struct sockaddr_in sin;
|
||||
memset(&sin, 0, sizeof(sin));
|
||||
// listen on all interfaces
|
||||
sin.sin_addr.s_addr = INADDR_ANY;
|
||||
sin.sin_len = sizeof(struct sockaddr_in);
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_port = htons(kAccelerometerSimulationPort);
|
||||
|
||||
bind(udpSocket, (const struct sockaddr*)&sin, sizeof(sin));
|
||||
|
||||
// create a separate thread for receiving UDP packets
|
||||
thread = [[NSThread alloc] initWithTarget:self
|
||||
selector:@selector(threadLoop:)
|
||||
object:nil];
|
||||
[thread start];
|
||||
|
||||
// cross-thread communication setup
|
||||
[self setUpThreadingSupport];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(processNotification:)
|
||||
name:@"ThreadAccelNotification"
|
||||
object:nil];
|
||||
/*
|
||||
// create and initialize a socket
|
||||
CFSocketContext ctx;
|
||||
|
||||
ctx.info = self;
|
||||
ctx.version = 0;
|
||||
ctx.retain = NULL;
|
||||
ctx.release = NULL;
|
||||
ctx.copyDescription = NULL;
|
||||
udpSocket = CFSocketCreate(NULL, PF_INET, SOCK_DGRAM, IPPROTO_UDP, kCFSocketDataCallBack | 0xF, mySocketCallBack, NULL);
|
||||
|
||||
CFRunLoopSourceRef source;
|
||||
CFDataRef addr;
|
||||
CFSocketError theErr;
|
||||
struct sockaddr_in sin;
|
||||
memset(&sin, 0, sizeof(sin));
|
||||
sin.sin_addr.s_addr = INADDR_ANY;
|
||||
sin.sin_len = sizeof(struct sockaddr_in);
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_port = htons(10552);
|
||||
addr = CFDataCreate(NULL, (unsigned char *)&sin, sizeof(sin));
|
||||
theErr = CFSocketConnectToAddress(udpSocket, addr, 0);
|
||||
switch (theErr) {
|
||||
case kCFSocketSuccess:
|
||||
NSLog(@"UDP Logged in");
|
||||
source = CFSocketCreateRunLoopSource(NULL, udpSocket, 0);
|
||||
CFRunLoopAddSource(CFRunLoopGetMain(), source,
|
||||
kCFRunLoopDefaultMode);
|
||||
break;
|
||||
case kCFSocketError:
|
||||
NSLog(@"UDP Error");
|
||||
break;
|
||||
default:
|
||||
NSLog(@"UDP Networking Error");
|
||||
break;
|
||||
}
|
||||
*/
|
||||
return self;
|
||||
}
|
||||
|
||||
// we grab the delegate setting action
|
||||
- (void)setDelegate:(id<UIAccelerometerDelegate>)delegate
|
||||
{
|
||||
accelDelegate = delegate;
|
||||
}
|
||||
|
||||
- (id<UIAccelerometerDelegate>)delegate
|
||||
{
|
||||
return accelDelegate;
|
||||
}
|
||||
@end
|
||||
|
||||
#endif // !TARGET_CPU_ARM
|
||||
|
||||
#endif // CC_PLATFORM_IOS
|
|
@ -293,7 +293,7 @@ string FileUtilsWin32::getWritablePath() const
|
|||
// Create directory
|
||||
if (SUCCEEDED(SHCreateDirectoryExA(NULL, ret.c_str(), NULL)))
|
||||
{
|
||||
return ret;
|
||||
return convertPathFormatToUnixStyle(ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
#include "CCConfiguration.h"
|
||||
#include "CCTextureCache.h"
|
||||
#include "CCGLView.h"
|
||||
|
||||
#include "base64.h"
|
||||
NS_CC_BEGIN
|
||||
|
||||
//TODO: these general utils should be in a seperate class
|
||||
|
@ -252,8 +252,6 @@ Console::Console()
|
|||
, _running(false)
|
||||
, _endThread(false)
|
||||
, _sendDebugStrings(false)
|
||||
,_fileUploading(false)
|
||||
,_uploadFileSize(0)
|
||||
{
|
||||
// VS2012 doesn't support initializer list, so we create a new array and assign its elements to '_command'.
|
||||
Command commands[] = {
|
||||
|
@ -284,13 +282,13 @@ Console::Console()
|
|||
{ "texture", "Flush or print the TextureCache info. Args: [flush | ] ", std::bind(&Console::commandTextures, this, std::placeholders::_1, std::placeholders::_2) },
|
||||
{ "director", "director commands, type -h or [director help] to list supported directives", std::bind(&Console::commandDirector, this, std::placeholders::_1, std::placeholders::_2) },
|
||||
{ "touch", "simulate touch event via console, type -h or [touch help] to list supported directives", std::bind(&Console::commandTouch, this, std::placeholders::_1, std::placeholders::_2) },
|
||||
{ "upload", "upload file. Args: [filename filesize]", std::bind(&Console::commandUpload, this, std::placeholders::_1, std::placeholders::_2) },
|
||||
{ "upload", "upload file. Args: [filename base64_encoded_data]", std::bind(&Console::commandUpload, this, std::placeholders::_1) },
|
||||
};
|
||||
|
||||
;
|
||||
for (int i = 0; i < sizeof(commands)/sizeof(commands[0]); ++i)
|
||||
{
|
||||
_commands.insert ( std::pair<std::string,Command>(commands[i].name,commands[i]) );
|
||||
_commands[commands[i].name] = commands[i];
|
||||
}
|
||||
_writablePath = FileUtils::getInstance()->getWritablePath();
|
||||
}
|
||||
|
@ -300,10 +298,9 @@ Console::~Console()
|
|||
stop();
|
||||
}
|
||||
|
||||
|
||||
bool Console::listenOnTCP(int port)
|
||||
{
|
||||
int listenfd, n;
|
||||
int listenfd = -1, n;
|
||||
const int on = 1;
|
||||
struct addrinfo hints, *res, *ressave;
|
||||
char serv[30];
|
||||
|
@ -370,7 +367,6 @@ bool Console::listenOnTCP(int port)
|
|||
|
||||
|
||||
freeaddrinfo(ressave);
|
||||
|
||||
return listenOnFileDescriptor(listenfd);
|
||||
}
|
||||
|
||||
|
@ -642,7 +638,7 @@ void Console::commandTouch(int fd, const std::string& args)
|
|||
float x = std::atof(argv[1].c_str());
|
||||
float y = std::atof(argv[2].c_str());
|
||||
|
||||
srand (time(NULL));
|
||||
srand ((unsigned)time(NULL));
|
||||
_touchId = rand();
|
||||
Scheduler *sched = Director::getInstance()->getScheduler();
|
||||
sched->performFunctionInCocosThread( [&](){
|
||||
|
@ -670,7 +666,7 @@ void Console::commandTouch(int fd, const std::string& args)
|
|||
float x2 = std::atof(argv[3].c_str());
|
||||
float y2 = std::atof(argv[4].c_str());
|
||||
|
||||
srand (time(NULL));
|
||||
srand ((unsigned)time(NULL));
|
||||
_touchId = rand();
|
||||
|
||||
Scheduler *sched = Director::getInstance()->getScheduler();
|
||||
|
@ -757,33 +753,139 @@ void Console::commandTouch(int fd, const std::string& args)
|
|||
}
|
||||
}
|
||||
|
||||
void Console::commandUpload(int fd, const std::string& args)
|
||||
void Console::commandUpload(int fd)
|
||||
{
|
||||
auto argv = split(args,' ');
|
||||
if(argv.size() == 2)
|
||||
ssize_t n, rc;
|
||||
char buf[512], c;
|
||||
char *ptr = buf;
|
||||
//read file name
|
||||
for( n = 0; n < sizeof(buf) - 1; n++ )
|
||||
{
|
||||
_uploadFileName = argv[0];
|
||||
_uploadFileSize = std::atoi(argv[1].c_str());
|
||||
_fileUploading = true;
|
||||
if( (rc = recv(fd, &c, 1, 0)) ==1 )
|
||||
{
|
||||
*ptr++ = c;
|
||||
if(c == ' ')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( rc == 0 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if( errno == EINTR )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
const char msg[] = "upload: invalid arguments.\n";
|
||||
send(fd, msg, sizeof(msg) - 1, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
*ptr = 0;
|
||||
|
||||
std::string filepath = _writablePath + std::string(buf);
|
||||
|
||||
FILE* fp = fopen(filepath.c_str(), "wb");
|
||||
if(!fp)
|
||||
{
|
||||
const char err[] = "can't create file!\n";
|
||||
send(fd, err, sizeof(err),0);
|
||||
return;
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
char data[4];
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
data[i] = '=';
|
||||
}
|
||||
bool more_data;
|
||||
readBytes(fd, data, 4, &more_data);
|
||||
if(!more_data)
|
||||
{
|
||||
break;
|
||||
}
|
||||
unsigned char *decode;
|
||||
unsigned char *in = (unsigned char *)data;
|
||||
int dt = base64Decode(in, 4, &decode);
|
||||
for(int i = 0; i < dt; i++)
|
||||
{
|
||||
fwrite(decode+i, 1, 1, fp);
|
||||
}
|
||||
free(decode);
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
ssize_t Console::readBytes(int fd, char* buffer, size_t maxlen, bool* more)
|
||||
{
|
||||
ssize_t n, rc;
|
||||
char c, *ptr = buffer;
|
||||
*more = false;
|
||||
for( n = 0; n < maxlen; n++ ) {
|
||||
if( (rc = recv(fd, &c, 1, 0)) ==1 ) {
|
||||
*ptr++ = c;
|
||||
if(c == '\n') {
|
||||
return n;
|
||||
}
|
||||
} else if( rc == 0 ) {
|
||||
return 0;
|
||||
} else if( errno == EINTR ) {
|
||||
continue;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
*more = true;
|
||||
return n;
|
||||
}
|
||||
|
||||
bool Console::parseCommand(int fd)
|
||||
{
|
||||
char buf[512];
|
||||
auto r = readline(fd, buf, sizeof(buf)-1);
|
||||
if(r < 1)
|
||||
bool more_data;
|
||||
auto h = readBytes(fd, buf, 6, &more_data);
|
||||
if( h < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(strncmp(buf, "upload", 6) == 0)
|
||||
{
|
||||
char c = '\0';
|
||||
recv(fd, &c, 1, 0);
|
||||
if(c == ' ')
|
||||
{
|
||||
commandUpload(fd);
|
||||
sendPrompt(fd);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
const char err[] = "Unknown Command!\n";
|
||||
sendPrompt(fd);
|
||||
send(fd, err, sizeof(err),0);
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
if(!more_data)
|
||||
{
|
||||
buf[h] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *pb = buf + 6;
|
||||
auto r = readline(fd, pb, sizeof(buf)-6);
|
||||
if(r < 0)
|
||||
{
|
||||
const char err[] = "Unknown error!\n";
|
||||
sendPrompt(fd);
|
||||
send(fd, err, sizeof(err),0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
std::string cmdLine;
|
||||
|
||||
std::vector<std::string> args;
|
||||
|
@ -827,12 +929,12 @@ bool Console::parseCommand(int fd)
|
|||
//
|
||||
|
||||
|
||||
ssize_t Console::readline(int fd, char* ptr, int maxlen)
|
||||
ssize_t Console::readline(int fd, char* ptr, size_t maxlen)
|
||||
{
|
||||
ssize_t n, rc;
|
||||
char c;
|
||||
|
||||
for( n=1; n<maxlen-1; n++ ) {
|
||||
for( n = 0; n < maxlen - 1; n++ ) {
|
||||
if( (rc = recv(fd, &c, 1, 0)) ==1 ) {
|
||||
*ptr++ = c;
|
||||
if(c == '\n') {
|
||||
|
@ -851,44 +953,6 @@ ssize_t Console::readline(int fd, char* ptr, int maxlen)
|
|||
return n;
|
||||
}
|
||||
|
||||
ssize_t Console::readfile(int fd, std::string& file_name, int file_size)
|
||||
{
|
||||
ssize_t n, rc;
|
||||
char c;
|
||||
|
||||
std::string fileName = _writablePath+file_name;
|
||||
|
||||
FILE* fp = fopen(fileName.c_str(), "wb");
|
||||
if(!fp)
|
||||
{
|
||||
const char err[] = "can't create file!\n";
|
||||
send(fd, err, sizeof(err),0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// if (fp)
|
||||
// {
|
||||
// size_t ret = fwrite(szBuf, 1, strl6en(szBuf), fp);
|
||||
// CCASSERT(ret != 0, "fwrite function returned zero value");
|
||||
// fclose(fp);
|
||||
// if (ret != 0)
|
||||
// log("Writing file to writable path succeed.");
|
||||
// }
|
||||
|
||||
for( n=0; n<file_size; n++ ) {
|
||||
if( (rc = recv(fd, &c, 1, 0)) ==1 ) {
|
||||
fwrite(&c, 1, 1, fp);
|
||||
} else if( rc == 0 ) {
|
||||
return 0;
|
||||
} else if( errno == EINTR ) {
|
||||
continue;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
return n;
|
||||
}
|
||||
|
||||
void Console::addClient()
|
||||
{
|
||||
|
@ -921,7 +985,6 @@ void Console::log(const char* buf)
|
|||
//
|
||||
// Main Loop
|
||||
//
|
||||
|
||||
void Console::loop()
|
||||
{
|
||||
fd_set copy_set;
|
||||
|
@ -969,20 +1032,11 @@ void Console::loop()
|
|||
std::vector<int> to_remove;
|
||||
for(const auto &fd: _fds) {
|
||||
if(FD_ISSET(fd,©_set))
|
||||
{
|
||||
if(!_fileUploading)
|
||||
{
|
||||
if( ! parseCommand(fd) )
|
||||
{
|
||||
to_remove.push_back(fd);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
readfile(fd, _uploadFileName, _uploadFileSize);
|
||||
_fileUploading = false;
|
||||
|
||||
}
|
||||
if(--nready <= 0)
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -72,8 +72,8 @@ class CC_DLL Console
|
|||
{
|
||||
public:
|
||||
struct Command {
|
||||
const char *name;
|
||||
const char *help;
|
||||
const char* name;
|
||||
const char* help;
|
||||
std::function<void(int, const std::string&)> callback;
|
||||
};
|
||||
|
||||
|
@ -99,8 +99,8 @@ public:
|
|||
|
||||
protected:
|
||||
void loop();
|
||||
ssize_t readline(int fd, char *buf, int maxlen);
|
||||
ssize_t readfile(int fd, std::string &file_name, int file_size);
|
||||
ssize_t readline(int fd, char *buf, size_t maxlen);
|
||||
ssize_t readBytes(int fd, char* buffer, size_t maxlen, bool* more);
|
||||
bool parseCommand(int fd);
|
||||
|
||||
void addClient();
|
||||
|
@ -116,7 +116,7 @@ protected:
|
|||
void commandProjection(int fd, const std::string &args);
|
||||
void commandDirector(int fd, const std::string &args);
|
||||
void commandTouch(int fd, const std::string &args);
|
||||
void commandUpload(int fd, const std::string &args);
|
||||
void commandUpload(int fd);
|
||||
// file descriptor: socket, console, etc.
|
||||
int _listenfd;
|
||||
int _maxfd;
|
||||
|
@ -128,9 +128,6 @@ protected:
|
|||
bool _running;
|
||||
bool _endThread;
|
||||
|
||||
bool _fileUploading;
|
||||
ssize_t _uploadFileSize;
|
||||
std::string _uploadFileName;
|
||||
std::string _writablePath;
|
||||
|
||||
std::map<std::string, Command> _commands;
|
||||
|
|
|
@ -84,7 +84,7 @@ void NodeLoader::parseProperties(Node * pNode, Node * pParent, CCBReader * ccbRe
|
|||
bool bFound = false;
|
||||
CCARRAY_FOREACH(extraPropsNames, pObj)
|
||||
{
|
||||
String* pStr = static_cast<String*>(pObj);
|
||||
__String* pStr = static_cast<__String*>(pObj);
|
||||
if (0 == pStr->compare(propertyName.c_str()))
|
||||
{
|
||||
bFound = true;
|
||||
|
@ -96,7 +96,7 @@ void NodeLoader::parseProperties(Node * pNode, Node * pParent, CCBReader * ccbRe
|
|||
}
|
||||
else if (isExtraProp && pNode == ccbReader->getAnimationManager()->getRootNode())
|
||||
{
|
||||
Array *extraPropsNames = static_cast<Array*>(pNode->getUserObject());
|
||||
__Array *extraPropsNames = static_cast<__Array*>(pNode->getUserObject());
|
||||
if (! extraPropsNames)
|
||||
{
|
||||
extraPropsNames = Array::create();
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module Action
|
||||
-- @extend Ref
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Action] startWithTarget
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ActionCamera
|
||||
-- @extend ActionInterval
|
||||
|
||||
--------------------------------
|
||||
-- overload function: setEye(float, float, float)
|
||||
--
|
||||
|
@ -37,6 +39,21 @@
|
|||
-- @param self
|
||||
-- @return kmVec3#kmVec3 ret (return value: kmVec3)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionCamera] startWithTarget
|
||||
-- @param self
|
||||
-- @param #cc.Node node
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionCamera] clone
|
||||
-- @param self
|
||||
-- @return ActionCamera#ActionCamera ret (return value: cc.ActionCamera)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionCamera] reverse
|
||||
-- @param self
|
||||
-- @return ActionCamera#ActionCamera ret (return value: cc.ActionCamera)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionCamera] ActionCamera
|
||||
-- @param self
|
||||
|
|
|
@ -1,9 +1,35 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ActionEase
|
||||
-- @extend ActionInterval
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionEase] getInnerAction
|
||||
-- @param self
|
||||
-- @return ActionInterval#ActionInterval ret (return value: cc.ActionInterval)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionEase] startWithTarget
|
||||
-- @param self
|
||||
-- @param #cc.Node node
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionEase] clone
|
||||
-- @param self
|
||||
-- @return ActionEase#ActionEase ret (return value: cc.ActionEase)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionEase] stop
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionEase] reverse
|
||||
-- @param self
|
||||
-- @return ActionEase#ActionEase ret (return value: cc.ActionEase)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionEase] update
|
||||
-- @param self
|
||||
-- @param #float float
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,4 +1,31 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ActionInstant
|
||||
-- @extend FiniteTimeAction
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionInstant] step
|
||||
-- @param self
|
||||
-- @param #float float
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionInstant] clone
|
||||
-- @param self
|
||||
-- @return ActionInstant#ActionInstant ret (return value: cc.ActionInstant)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionInstant] reverse
|
||||
-- @param self
|
||||
-- @return ActionInstant#ActionInstant ret (return value: cc.ActionInstant)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionInstant] isDone
|
||||
-- @param self
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionInstant] update
|
||||
-- @param self
|
||||
-- @param #float float
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ActionInterval
|
||||
-- @extend FiniteTimeAction
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionInterval] getAmplitudeRate
|
||||
-- @param self
|
||||
|
@ -16,4 +18,29 @@
|
|||
-- @param self
|
||||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionInterval] startWithTarget
|
||||
-- @param self
|
||||
-- @param #cc.Node node
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionInterval] step
|
||||
-- @param self
|
||||
-- @param #float float
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionInterval] clone
|
||||
-- @param self
|
||||
-- @return ActionInterval#ActionInterval ret (return value: cc.ActionInterval)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionInterval] reverse
|
||||
-- @param self
|
||||
-- @return ActionInterval#ActionInterval ret (return value: cc.ActionInterval)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionInterval] isDone
|
||||
-- @param self
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ActionManager
|
||||
-- @extend Ref
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionManager] getActionByTag
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ActionManagerEx
|
||||
|
||||
--------------------------------
|
||||
-- overload function: playActionByName(char, char, cc.CallFunc)
|
||||
--
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ActionObject
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionObject] setCurrentTime
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ActionTween
|
||||
-- @extend ActionInterval
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionTween] initWithDuration
|
||||
-- @param self
|
||||
|
@ -19,4 +21,24 @@
|
|||
-- @param #float float
|
||||
-- @return ActionTween#ActionTween ret (return value: cc.ActionTween)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionTween] startWithTarget
|
||||
-- @param self
|
||||
-- @param #cc.Node node
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionTween] clone
|
||||
-- @param self
|
||||
-- @return ActionTween#ActionTween ret (return value: cc.ActionTween)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionTween] update
|
||||
-- @param self
|
||||
-- @param #float float
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ActionTween] reverse
|
||||
-- @param self
|
||||
-- @return ActionTween#ActionTween ret (return value: cc.ActionTween)
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module Animate
|
||||
-- @extend ActionInterval
|
||||
|
||||
--------------------------------
|
||||
-- overload function: getAnimation()
|
||||
--
|
||||
|
@ -21,4 +23,28 @@
|
|||
-- @param #cc.Animation animation
|
||||
-- @return Animate#Animate ret (return value: cc.Animate)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Animate] startWithTarget
|
||||
-- @param self
|
||||
-- @param #cc.Node node
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Animate] clone
|
||||
-- @param self
|
||||
-- @return Animate#Animate ret (return value: cc.Animate)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Animate] stop
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Animate] reverse
|
||||
-- @param self
|
||||
-- @return Animate#Animate ret (return value: cc.Animate)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Animate] update
|
||||
-- @param self
|
||||
-- @param #float float
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module Animation
|
||||
-- @extend Ref
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Animation] getLoops
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module AnimationCache
|
||||
-- @extend Ref
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#AnimationCache] getAnimation
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module AnimationData
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#AnimationData] getMovement
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module AnimationFrame
|
||||
-- @extend Ref
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#AnimationFrame] setSpriteFrame
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module Application
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Application] getTargetPlatform
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module Armature
|
||||
-- @extend Node,BlendProtocol,
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Armature] getBone
|
||||
-- @param self
|
||||
|
@ -136,6 +138,38 @@
|
|||
-- @param #ccs.Bone bone
|
||||
-- @return Armature#Armature ret (retunr value: ccs.Armature)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Armature] setAnchorPoint
|
||||
-- @param self
|
||||
-- @param #point_table point
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Armature] draw
|
||||
-- @param self
|
||||
-- @param #cc.Renderer renderer
|
||||
-- @param #kmMat4 kmmat4
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Armature] getAnchorPointInPoints
|
||||
-- @param self
|
||||
-- @return point_table#point_table ret (return value: point_table)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Armature] update
|
||||
-- @param self
|
||||
-- @param #float float
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Armature] getNodeToParentTransform
|
||||
-- @param self
|
||||
-- @return kmMat4#kmMat4 ret (return value: kmMat4)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Armature] getBoundingBox
|
||||
-- @param self
|
||||
-- @return rect_table#rect_table ret (return value: rect_table)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Armature] Armature
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ArmatureAnimation
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ArmatureAnimation] getSpeedScale
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ArmatureData
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ArmatureData] addBoneData
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ArmatureDataManager
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ArmatureDataManager] getAnimationDatas
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ArmatureDisplayData
|
||||
-- @extend DisplayData
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ArmatureDisplayData] create
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module AssetsManager
|
||||
-- @extend Node
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#AssetsManager] setStoragePath
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module AtlasNode
|
||||
-- @extend Node,TextureProtocol,
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#AtlasNode] updateAtlasValues
|
||||
-- @param self
|
||||
|
@ -44,4 +46,36 @@
|
|||
-- @param #int int
|
||||
-- @return AtlasNode#AtlasNode ret (return value: cc.AtlasNode)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#AtlasNode] draw
|
||||
-- @param self
|
||||
-- @param #cc.Renderer renderer
|
||||
-- @param #kmMat4 kmmat4
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#AtlasNode] isOpacityModifyRGB
|
||||
-- @param self
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#AtlasNode] setColor
|
||||
-- @param self
|
||||
-- @param #color3B_table color3b
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#AtlasNode] getColor
|
||||
-- @param self
|
||||
-- @return color3B_table#color3B_table ret (return value: color3B_table)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#AtlasNode] setOpacityModifyRGB
|
||||
-- @param self
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#AtlasNode] setOpacity
|
||||
-- @param self
|
||||
-- @param #unsigned char char
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module BaseData
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#BaseData] getColor
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module BatchNode
|
||||
-- @extend Node
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#BatchNode] init
|
||||
-- @param self
|
||||
|
@ -11,4 +13,30 @@
|
|||
-- @param self
|
||||
-- @return BatchNode#BatchNode ret (return value: ccs.BatchNode)
|
||||
|
||||
--------------------------------
|
||||
-- overload function: addChild(cc.Node, int)
|
||||
--
|
||||
-- overload function: addChild(cc.Node)
|
||||
--
|
||||
-- overload function: addChild(cc.Node, int, int)
|
||||
--
|
||||
-- @function [parent=#BatchNode] addChild
|
||||
-- @param self
|
||||
-- @param #cc.Node node
|
||||
-- @param #int int
|
||||
-- @param #int int
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#BatchNode] draw
|
||||
-- @param self
|
||||
-- @param #cc.Renderer renderer
|
||||
-- @param #kmMat4 kmmat4
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#BatchNode] removeChild
|
||||
-- @param self
|
||||
-- @param #cc.Node node
|
||||
-- @param #bool bool
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,4 +1,26 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module BezierBy
|
||||
-- @extend ActionInterval
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#BezierBy] startWithTarget
|
||||
-- @param self
|
||||
-- @param #cc.Node node
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#BezierBy] clone
|
||||
-- @param self
|
||||
-- @return BezierBy#BezierBy ret (return value: cc.BezierBy)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#BezierBy] reverse
|
||||
-- @param self
|
||||
-- @return BezierBy#BezierBy ret (return value: cc.BezierBy)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#BezierBy] update
|
||||
-- @param self
|
||||
-- @param #float float
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,4 +1,21 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module BezierTo
|
||||
-- @extend BezierBy
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#BezierTo] startWithTarget
|
||||
-- @param self
|
||||
-- @param #cc.Node node
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#BezierTo] clone
|
||||
-- @param self
|
||||
-- @return BezierTo#BezierTo ret (return value: cc.BezierTo)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#BezierTo] reverse
|
||||
-- @param self
|
||||
-- @return BezierTo#BezierTo ret (return value: cc.BezierTo)
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module Blink
|
||||
-- @extend ActionInterval
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Blink] create
|
||||
-- @param self
|
||||
|
@ -8,4 +10,28 @@
|
|||
-- @param #int int
|
||||
-- @return Blink#Blink ret (return value: cc.Blink)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Blink] startWithTarget
|
||||
-- @param self
|
||||
-- @param #cc.Node node
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Blink] clone
|
||||
-- @param self
|
||||
-- @return Blink#Blink ret (return value: cc.Blink)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Blink] stop
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Blink] reverse
|
||||
-- @param self
|
||||
-- @return Blink#Blink ret (return value: cc.Blink)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Blink] update
|
||||
-- @param self
|
||||
-- @param #float float
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module Bone
|
||||
-- @extend Node
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Bone] isTransformDirty
|
||||
-- @param self
|
||||
|
@ -187,6 +189,31 @@
|
|||
-- @param #string str
|
||||
-- @return Bone#Bone ret (retunr value: ccs.Bone)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Bone] updateDisplayedColor
|
||||
-- @param self
|
||||
-- @param #color3B_table color3b
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Bone] setLocalZOrder
|
||||
-- @param self
|
||||
-- @param #int int
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Bone] getNodeToWorldTransform
|
||||
-- @param self
|
||||
-- @return kmMat4#kmMat4 ret (return value: kmMat4)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Bone] update
|
||||
-- @param self
|
||||
-- @param #float float
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Bone] updateDisplayedOpacity
|
||||
-- @param self
|
||||
-- @param #unsigned char char
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Bone] Bone
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module BoneData
|
||||
-- @extend BaseData
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#BoneData] getDisplayData
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module Button
|
||||
-- @extend Widget
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Button] getTitleText
|
||||
-- @param self
|
||||
|
@ -127,6 +129,31 @@
|
|||
-- @param self
|
||||
-- @return Ref#Ref ret (return value: cc.Ref)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Button] setAnchorPoint
|
||||
-- @param self
|
||||
-- @param #point_table point
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Button] getVirtualRenderer
|
||||
-- @param self
|
||||
-- @return Node#Node ret (return value: cc.Node)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Button] getDescription
|
||||
-- @param self
|
||||
-- @return string#string ret (return value: string)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Button] getContentSize
|
||||
-- @param self
|
||||
-- @return size_table#size_table ret (return value: size_table)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Button] ignoreContentAdaptWithSize
|
||||
-- @param self
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Button] Button
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module CCBAnimationManager
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CCBAnimationManager] moveAnimationsFromNode
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module CCBReader
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CCBReader] addOwnerOutletName
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module CallFunc
|
||||
-- @extend ActionInstant
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CallFunc] execute
|
||||
-- @param self
|
||||
|
@ -15,4 +17,19 @@
|
|||
-- @param self
|
||||
-- @param #cc.Ref ref
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CallFunc] clone
|
||||
-- @param self
|
||||
-- @return CallFunc#CallFunc ret (return value: cc.CallFunc)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CallFunc] update
|
||||
-- @param self
|
||||
-- @param #float float
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CallFunc] reverse
|
||||
-- @param self
|
||||
-- @return CallFunc#CallFunc ret (return value: cc.CallFunc)
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,6 +1,28 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module CardinalSplineBy
|
||||
-- @extend CardinalSplineTo
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CardinalSplineBy] startWithTarget
|
||||
-- @param self
|
||||
-- @param #cc.Node node
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CardinalSplineBy] clone
|
||||
-- @param self
|
||||
-- @return CardinalSplineBy#CardinalSplineBy ret (return value: cc.CardinalSplineBy)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CardinalSplineBy] updatePosition
|
||||
-- @param self
|
||||
-- @param #point_table point
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CardinalSplineBy] reverse
|
||||
-- @param self
|
||||
-- @return CardinalSplineBy#CardinalSplineBy ret (return value: cc.CardinalSplineBy)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CardinalSplineBy] CardinalSplineBy
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module CardinalSplineTo
|
||||
-- @extend ActionInterval
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CardinalSplineTo] getPoints
|
||||
-- @param self
|
||||
|
@ -19,6 +21,26 @@
|
|||
-- @param #float float
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CardinalSplineTo] startWithTarget
|
||||
-- @param self
|
||||
-- @param #cc.Node node
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CardinalSplineTo] clone
|
||||
-- @param self
|
||||
-- @return CardinalSplineTo#CardinalSplineTo ret (return value: cc.CardinalSplineTo)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CardinalSplineTo] reverse
|
||||
-- @param self
|
||||
-- @return CardinalSplineTo#CardinalSplineTo ret (return value: cc.CardinalSplineTo)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CardinalSplineTo] update
|
||||
-- @param self
|
||||
-- @param #float float
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CardinalSplineTo] CardinalSplineTo
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module CatmullRomBy
|
||||
-- @extend CardinalSplineBy
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CatmullRomBy] initWithDuration
|
||||
-- @param self
|
||||
|
@ -8,4 +10,14 @@
|
|||
-- @param #point_table pointarray
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CatmullRomBy] clone
|
||||
-- @param self
|
||||
-- @return CatmullRomBy#CatmullRomBy ret (return value: cc.CatmullRomBy)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CatmullRomBy] reverse
|
||||
-- @param self
|
||||
-- @return CatmullRomBy#CatmullRomBy ret (return value: cc.CatmullRomBy)
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module CatmullRomTo
|
||||
-- @extend CardinalSplineTo
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CatmullRomTo] initWithDuration
|
||||
-- @param self
|
||||
|
@ -8,4 +10,14 @@
|
|||
-- @param #point_table pointarray
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CatmullRomTo] clone
|
||||
-- @param self
|
||||
-- @return CatmullRomTo#CatmullRomTo ret (return value: cc.CatmullRomTo)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CatmullRomTo] reverse
|
||||
-- @param self
|
||||
-- @return CatmullRomTo#CatmullRomTo ret (return value: cc.CatmullRomTo)
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module CheckBox
|
||||
-- @extend Widget
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CheckBox] getSelectedState
|
||||
-- @param self
|
||||
|
@ -61,6 +63,26 @@
|
|||
-- @param self
|
||||
-- @return Ref#Ref ret (return value: cc.Ref)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CheckBox] setAnchorPoint
|
||||
-- @param self
|
||||
-- @param #point_table point
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CheckBox] getVirtualRenderer
|
||||
-- @param self
|
||||
-- @return Node#Node ret (return value: cc.Node)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CheckBox] getDescription
|
||||
-- @param self
|
||||
-- @return string#string ret (return value: string)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CheckBox] getContentSize
|
||||
-- @param self
|
||||
-- @return size_table#size_table ret (return value: size_table)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#CheckBox] CheckBox
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ClippingNode
|
||||
-- @extend Node
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ClippingNode] isInverted
|
||||
-- @param self
|
||||
|
@ -41,4 +43,11 @@
|
|||
-- @param #cc.Node node
|
||||
-- @return ClippingNode#ClippingNode ret (retunr value: cc.ClippingNode)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ClippingNode] visit
|
||||
-- @param self
|
||||
-- @param #cc.Renderer renderer
|
||||
-- @param #kmMat4 kmmat4
|
||||
-- @param #bool bool
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ComAttribute
|
||||
-- @extend Component
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ComAttribute] getFloat
|
||||
-- @param self
|
||||
|
@ -69,4 +71,15 @@
|
|||
-- @param self
|
||||
-- @return Ref#Ref ret (return value: cc.Ref)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ComAttribute] init
|
||||
-- @param self
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ComAttribute] serialize
|
||||
-- @param self
|
||||
-- @param #void void
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ComAudio
|
||||
-- @extend Component
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ComAudio] stopAllEffects
|
||||
-- @param self
|
||||
|
@ -153,4 +155,25 @@
|
|||
-- @param self
|
||||
-- @return Ref#Ref ret (return value: cc.Ref)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ComAudio] setEnabled
|
||||
-- @param self
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ComAudio] isEnabled
|
||||
-- @param self
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ComAudio] serialize
|
||||
-- @param self
|
||||
-- @param #void void
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ComAudio] init
|
||||
-- @param self
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ComController
|
||||
-- @extend Component,InputDelegate,
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ComController] create
|
||||
-- @param self
|
||||
|
@ -11,6 +13,26 @@
|
|||
-- @param self
|
||||
-- @return Ref#Ref ret (return value: cc.Ref)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ComController] setEnabled
|
||||
-- @param self
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ComController] isEnabled
|
||||
-- @param self
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ComController] update
|
||||
-- @param self
|
||||
-- @param #float float
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ComController] init
|
||||
-- @param self
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ComController] ComController
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ComRender
|
||||
-- @extend Component
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ComRender] setNode
|
||||
-- @param self
|
||||
|
@ -27,4 +29,10 @@
|
|||
-- @param self
|
||||
-- @return Ref#Ref ret (return value: cc.Ref)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ComRender] serialize
|
||||
-- @param self
|
||||
-- @param #void void
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module Component
|
||||
-- @extend Ref
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Component] setEnabled
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ContourData
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ContourData] init
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module Control
|
||||
-- @extend Layer
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Control] setEnabled
|
||||
-- @param self
|
||||
|
@ -92,4 +94,14 @@
|
|||
-- @param self
|
||||
-- @return Control#Control ret (return value: cc.Control)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Control] isOpacityModifyRGB
|
||||
-- @param self
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Control] setOpacityModifyRGB
|
||||
-- @param self
|
||||
-- @param #bool bool
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ControlButton
|
||||
-- @extend Control
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlButton] isPushed
|
||||
-- @param self
|
||||
|
@ -231,4 +233,49 @@
|
|||
-- @param #float float
|
||||
-- @return ControlButton#ControlButton ret (retunr value: cc.ControlButton)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlButton] onTouchMoved
|
||||
-- @param self
|
||||
-- @param #cc.Touch touch
|
||||
-- @param #cc.Event event
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlButton] onTouchEnded
|
||||
-- @param self
|
||||
-- @param #cc.Touch touch
|
||||
-- @param #cc.Event event
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlButton] setColor
|
||||
-- @param self
|
||||
-- @param #color3B_table color3b
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlButton] getColor
|
||||
-- @param self
|
||||
-- @return color3B_table#color3B_table ret (return value: color3B_table)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlButton] onTouchCancelled
|
||||
-- @param self
|
||||
-- @param #cc.Touch touch
|
||||
-- @param #cc.Event event
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlButton] setOpacity
|
||||
-- @param self
|
||||
-- @param #unsigned char char
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlButton] getOpacity
|
||||
-- @param self
|
||||
-- @return unsigned char#unsigned char ret (return value: unsigned char)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlButton] onTouchBegan
|
||||
-- @param self
|
||||
-- @param #cc.Touch touch
|
||||
-- @param #cc.Event event
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ControlColourPicker
|
||||
-- @extend Control
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlColourPicker] setEnabled
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ControlHuePicker
|
||||
-- @extend Control
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlHuePicker] setEnabled
|
||||
-- @param self
|
||||
|
@ -65,6 +67,19 @@
|
|||
-- @param #point_table point
|
||||
-- @return ControlHuePicker#ControlHuePicker ret (return value: cc.ControlHuePicker)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlHuePicker] onTouchMoved
|
||||
-- @param self
|
||||
-- @param #cc.Touch touch
|
||||
-- @param #cc.Event event
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlHuePicker] onTouchBegan
|
||||
-- @param self
|
||||
-- @param #cc.Touch touch
|
||||
-- @param #cc.Event event
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlHuePicker] ControlHuePicker
|
||||
-- @param self
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ControlPotentiometer
|
||||
-- @extend Control
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlPotentiometer] setPreviousLocation
|
||||
-- @param self
|
||||
|
@ -108,6 +110,36 @@
|
|||
-- @param #char char
|
||||
-- @return ControlPotentiometer#ControlPotentiometer ret (return value: cc.ControlPotentiometer)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlPotentiometer] isTouchInside
|
||||
-- @param self
|
||||
-- @param #cc.Touch touch
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlPotentiometer] setEnabled
|
||||
-- @param self
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlPotentiometer] onTouchMoved
|
||||
-- @param self
|
||||
-- @param #cc.Touch touch
|
||||
-- @param #cc.Event event
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlPotentiometer] onTouchEnded
|
||||
-- @param self
|
||||
-- @param #cc.Touch touch
|
||||
-- @param #cc.Event event
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlPotentiometer] onTouchBegan
|
||||
-- @param self
|
||||
-- @param #cc.Touch touch
|
||||
-- @param #cc.Event event
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlPotentiometer] ControlPotentiometer
|
||||
-- @param self
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue