mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of github.com:cocos2d/cocos2d-x into hbmemory
Conflicts: tests/js-memory-gc-tests/src/tests-main.js
This commit is contained in:
commit
e2568b3a6f
|
@ -37,4 +37,4 @@ before_install:
|
|||
# whitelist
|
||||
branches:
|
||||
only:
|
||||
- v3.10
|
||||
- v3
|
||||
|
|
|
@ -24,7 +24,7 @@ cocos2d-x is:
|
|||
* Fast
|
||||
* Free
|
||||
* Easy to use
|
||||
* Community Supported
|
||||
* Community supported
|
||||
|
||||
Git user attention
|
||||
-----------------------
|
||||
|
@ -110,7 +110,7 @@ Starting with Cocos2d-x v3.3, you can create Windows 8.1 Universal Apps (Windows
|
|||
Starting with Cocos2d-x v3.8 you can create Windows 10.0 UWP Apps (Windows Store and Windows Phone 10.0).
|
||||
Starting with Cocos2d-x v3.6 there will no longer be support for Windows Phone 8.0.
|
||||
|
||||
See more info on How to install and Create games on Windows RT (Windows and Windows Phone 8.1) at http://msopentech.github.io/cocos2d-x/
|
||||
See more info on how to install and create games on Windows RT (Windows and Windows Phone 8.1) at http://msopentech.github.io/cocos2d-x/
|
||||
|
||||
### Build and run new project for web ###
|
||||
|
||||
|
@ -295,7 +295,7 @@ __cocos2d-x_root/build.__
|
|||
Contributing to the Project
|
||||
--------------------------------
|
||||
|
||||
Cocos2d-x is licensed under the [MIT License](https://opensource.org/licenses/MIT). We welcome paricipation!
|
||||
Cocos2d-x is licensed under the [MIT License](https://opensource.org/licenses/MIT). We welcome participation!
|
||||
|
||||
Did you find a bug? Do you have feature request? Do you want to merge a feature?
|
||||
|
||||
|
|
|
@ -309,7 +309,7 @@ private:
|
|||
* @brief Follow is an action that "follows" a node.
|
||||
* Eg:
|
||||
* @code
|
||||
* layer->runAction(Follow::actionWithTarget(hero));
|
||||
* layer->runAction(Follow::create(hero));
|
||||
* @endcode
|
||||
* Instead of using Camera as a "follower", use this action instead.
|
||||
* @since v0.99.2
|
||||
|
|
|
@ -366,7 +366,9 @@ private:
|
|||
@brief StopGrid action.
|
||||
@warning Don't call this action if another grid action is active.
|
||||
Call if you want to remove the grid effect. Example:
|
||||
Sequence::actions(Lens::action(...), StopGrid::action(...), nullptr);
|
||||
@code
|
||||
Sequence::create(Lens3D::create(...), StopGrid::create(), nullptr);
|
||||
@endcode
|
||||
*/
|
||||
class CC_DLL StopGrid : public ActionInstant
|
||||
{
|
||||
|
|
|
@ -61,7 +61,10 @@ then running it again in Reverse mode.
|
|||
|
||||
Example:
|
||||
|
||||
Action *pingPongAction = Sequence::actions(action, action->reverse(), nullptr);
|
||||
@code
|
||||
auto action = MoveBy::create(1.0f, Vec2::ONE);
|
||||
auto pingPongAction = Sequence::create(action, action->reverse(), nullptr);
|
||||
@endcode
|
||||
*/
|
||||
class CC_DLL ActionInterval : public FiniteTimeAction
|
||||
{
|
||||
|
|
|
@ -266,7 +266,7 @@ void FontAtlasCache::unloadFontAtlasTTF(const std::string& fontFileName)
|
|||
auto item = _atlasMap.begin();
|
||||
while (item != _atlasMap.end())
|
||||
{
|
||||
if (item->first.find(fontFileName) >= 0)
|
||||
if (item->first.find(fontFileName) != std::string::npos)
|
||||
{
|
||||
CC_SAFE_RELEASE_NULL(item->second);
|
||||
item = _atlasMap.erase(item);
|
||||
|
|
|
@ -279,21 +279,37 @@ std::set<unsigned int>* BMFontConfiguration::parseConfigFile(const std::string&
|
|||
CCASSERT((!data.isNull()), "BMFontConfiguration::parseConfigFile | Open file error.");
|
||||
|
||||
if (memcmp("BMF", data.getBytes(), 3) == 0) {
|
||||
// Handle fnt file of binary format
|
||||
std::set<unsigned int>* ret = parseBinaryConfigFile(data.getBytes(), data.getSize(), controlFile);
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto contents = (const char*)data.getBytes();
|
||||
if (contents[0] == 0)
|
||||
if (data.getBytes()[0] == 0)
|
||||
{
|
||||
CCLOG("cocos2d: Error parsing FNTfile %s", controlFile.c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Handle fnt file of string format, allocate one extra byte '\0' at the end since c string needs it.
|
||||
// 'strchr' finds a char until it gets a '\0', if 'contents' self doesn't end with '\0',
|
||||
// 'strchr' will search '\n' out of 'contents' 's buffer size, it will trigger potential and random crashes since
|
||||
// lineLength may bigger than 512 and 'memcpy(line, contents + parseCount, lineLength);' will cause stack buffer overflow.
|
||||
// Please note that 'contents' needs to be freed before this function returns.
|
||||
char* contents = (char*)malloc(data.getSize() + 1);
|
||||
if (contents == nullptr)
|
||||
{
|
||||
CCLOGERROR("BMFontConfiguration::parseConfigFile, out of memory!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
memcpy(contents, data.getBytes(), data.getSize());
|
||||
// Ensure the last byte is '\0'
|
||||
contents[data.getSize()] = '\0';
|
||||
|
||||
std::set<unsigned int> *validCharsString = new (std::nothrow) std::set<unsigned int>();
|
||||
|
||||
auto contentsLen = data.getSize();
|
||||
char line[512];
|
||||
auto contentsLen = strlen(contents);
|
||||
char line[512] = {0};
|
||||
|
||||
auto next = strchr(contents, '\n');
|
||||
auto base = contents;
|
||||
|
@ -357,6 +373,8 @@ std::set<unsigned int>* BMFontConfiguration::parseConfigFile(const std::string&
|
|||
}
|
||||
}
|
||||
|
||||
CC_SAFE_FREE(contents);
|
||||
|
||||
return validCharsString;
|
||||
}
|
||||
|
||||
|
|
|
@ -274,6 +274,14 @@ int FontFreeType::getFontAscender() const
|
|||
return (static_cast<int>(_fontRef->size->metrics.ascender >> 6));
|
||||
}
|
||||
|
||||
const char* FontFreeType::getFontFamily() const
|
||||
{
|
||||
if (!_fontRef)
|
||||
return nullptr;
|
||||
|
||||
return _fontRef->family_name;
|
||||
}
|
||||
|
||||
unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, long &outWidth, long &outHeight, Rect &outRect,int &xAdvance)
|
||||
{
|
||||
bool invalidChar = true;
|
||||
|
@ -639,7 +647,7 @@ void FontFreeType::releaseFont(const std::string &fontName)
|
|||
auto item = s_cacheFontData.begin();
|
||||
while (s_cacheFontData.end() != item)
|
||||
{
|
||||
if (item->first.find(fontName) >= 0)
|
||||
if (item->first.find(fontName) != std::string::npos)
|
||||
item = s_cacheFontData.erase(item);
|
||||
else
|
||||
item++;
|
||||
|
|
|
@ -71,6 +71,7 @@ public:
|
|||
unsigned char* getGlyphBitmap(unsigned short theChar, long &outWidth, long &outHeight, Rect &outRect,int &xAdvance);
|
||||
|
||||
int getFontAscender() const;
|
||||
const char* getFontFamily() const;
|
||||
|
||||
virtual FontAtlas* createFontAtlas() override;
|
||||
virtual int getFontMaxHeight() const override { return _lineHeight; }
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "2d/CCLabel.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "2d/CCFont.h"
|
||||
#include "2d/CCFontAtlasCache.h"
|
||||
#include "2d/CCFontAtlas.h"
|
||||
|
@ -43,6 +46,7 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
static const int UNDERLINE_NODE_TAG = 0xaabbccdd;
|
||||
/**
|
||||
* LabelLetter used to update the quad in texture atlas without SpriteBatchNode.
|
||||
*/
|
||||
|
@ -207,7 +211,6 @@ Label* Label::createWithSystemFont(const std::string& text, const std::string& f
|
|||
return ret;
|
||||
}
|
||||
|
||||
delete ret;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -381,6 +384,9 @@ Label::Label(TextHAlignment hAlignment /* = TextHAlignment::LEFT */,
|
|||
, _fontAtlas(nullptr)
|
||||
, _reusedLetter(nullptr)
|
||||
, _horizontalKernings(nullptr)
|
||||
, _boldEnabled(false)
|
||||
, _underlineNode(nullptr)
|
||||
, _strikethroughEnabled(false)
|
||||
{
|
||||
setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
reset();
|
||||
|
@ -510,7 +516,14 @@ void Label::reset()
|
|||
_bmfontScale = 1.0f;
|
||||
_overflow = Overflow::NONE;
|
||||
_originalFontSize = 0.0f;
|
||||
|
||||
_boldEnabled = false;
|
||||
if (_underlineNode)
|
||||
{
|
||||
removeChild(_underlineNode);
|
||||
_underlineNode = nullptr;
|
||||
}
|
||||
_strikethroughEnabled = false;
|
||||
setRotationSkewX(0); // reverse italics
|
||||
}
|
||||
|
||||
void Label::updateShaderProgram()
|
||||
|
@ -956,6 +969,16 @@ bool Label::setTTFConfigInternal(const TTFConfig& ttfConfig)
|
|||
_currLabelEffect = LabelEffect::NORMAL;
|
||||
updateShaderProgram();
|
||||
}
|
||||
|
||||
if (_fontConfig.italics)
|
||||
this->enableItalics();
|
||||
if (_fontConfig.bold)
|
||||
this->enableBold();
|
||||
if (_fontConfig.underline)
|
||||
this->enableUnderline();
|
||||
if (_fontConfig.strikethrough)
|
||||
this->enableStrikethrough();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1096,11 +1119,46 @@ void Label::enableShadow(const Color4B& shadowColor /* = Color4B::BLACK */,const
|
|||
}
|
||||
}
|
||||
|
||||
void Label::enableItalics()
|
||||
{
|
||||
setRotationSkewX(12);
|
||||
}
|
||||
|
||||
void Label::enableBold()
|
||||
{
|
||||
if (!_boldEnabled)
|
||||
{
|
||||
// bold is implemented with outline
|
||||
enableShadow(Color4B::WHITE, Size(0.9,0), 0);
|
||||
// add one to kerning
|
||||
setAdditionalKerning(_additionalKerning+1);
|
||||
_boldEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Label::enableUnderline()
|
||||
{
|
||||
// remove it, just in case to prevent adding two or more
|
||||
if (!_underlineNode)
|
||||
{
|
||||
_underlineNode = DrawNode::create();
|
||||
addChild(_underlineNode, 100000);
|
||||
_contentDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Label::enableStrikethrough()
|
||||
{
|
||||
if (!_strikethroughEnabled)
|
||||
{
|
||||
enableUnderline();
|
||||
_strikethroughEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Label::disableEffect()
|
||||
{
|
||||
disableEffect(LabelEffect::GLOW);
|
||||
disableEffect(LabelEffect::OUTLINE);
|
||||
disableEffect(LabelEffect::SHADOW);
|
||||
disableEffect(LabelEffect::ALL);
|
||||
}
|
||||
|
||||
void Label::disableEffect(LabelEffect effect)
|
||||
|
@ -1117,7 +1175,6 @@ void Label::disableEffect(LabelEffect effect)
|
|||
_fontConfig.outlineSize = 0;
|
||||
setTTFConfig(_fontConfig);
|
||||
}
|
||||
|
||||
_currLabelEffect = LabelEffect::NORMAL;
|
||||
_contentDirty = true;
|
||||
}
|
||||
|
@ -1127,6 +1184,7 @@ void Label::disableEffect(LabelEffect effect)
|
|||
{
|
||||
_shadowEnabled = false;
|
||||
CC_SAFE_RELEASE_NULL(_shadowNode);
|
||||
updateShaderProgram();
|
||||
}
|
||||
break;
|
||||
case cocos2d::LabelEffect::GLOW:
|
||||
|
@ -1136,11 +1194,34 @@ void Label::disableEffect(LabelEffect effect)
|
|||
updateShaderProgram();
|
||||
}
|
||||
break;
|
||||
case cocos2d::LabelEffect::ITALICS:
|
||||
setRotationSkewX(0);
|
||||
break;
|
||||
case cocos2d::LabelEffect::BOLD:
|
||||
_boldEnabled = false;
|
||||
_additionalKerning -= 1;
|
||||
disableEffect(LabelEffect::SHADOW);
|
||||
break;
|
||||
case cocos2d::LabelEffect::UNDERLINE:
|
||||
if (_underlineNode) {
|
||||
removeChild(_underlineNode);
|
||||
_underlineNode = nullptr;
|
||||
}
|
||||
break;
|
||||
case cocos2d::LabelEffect::STRIKETHROUGH:
|
||||
_strikethroughEnabled = false;
|
||||
// since it is based on underline, disable it as well
|
||||
disableEffect(LabelEffect::UNDERLINE);
|
||||
break;
|
||||
case LabelEffect::ALL:
|
||||
{
|
||||
disableEffect(LabelEffect::SHADOW);
|
||||
disableEffect(LabelEffect::GLOW);
|
||||
disableEffect(LabelEffect::OUTLINE);
|
||||
disableEffect(LabelEffect::ITALICS);
|
||||
disableEffect(LabelEffect::BOLD);
|
||||
disableEffect(LabelEffect::UNDERLINE);
|
||||
disableEffect(LabelEffect::STRIKETHROUGH);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -1299,6 +1380,42 @@ void Label::updateContent()
|
|||
createShadowSpriteForSystemFont(fontDef);
|
||||
}
|
||||
}
|
||||
|
||||
if (_underlineNode)
|
||||
{
|
||||
_underlineNode->clear();
|
||||
|
||||
if (_numberOfLines)
|
||||
{
|
||||
const float charheight = (_textDesiredHeight / _numberOfLines);
|
||||
_underlineNode->setLineWidth(charheight/6);
|
||||
|
||||
// atlas font
|
||||
for (int i=0; i<_numberOfLines; ++i)
|
||||
{
|
||||
float offsety = 0;
|
||||
if (_strikethroughEnabled)
|
||||
offsety += charheight / 2;
|
||||
// FIXME: Might not work with different vertical alignments
|
||||
float y = (_numberOfLines - i - 1) * charheight + offsety;
|
||||
_underlineNode->drawLine(Vec2(_linesOffsetX[i],y), Vec2(_linesWidth[i] + _linesOffsetX[i],y), _textColorF);
|
||||
}
|
||||
}
|
||||
else if (_textSprite)
|
||||
{
|
||||
// system font
|
||||
float y = 0;
|
||||
const auto spriteSize = _textSprite->getContentSize();
|
||||
_underlineNode->setLineWidth(spriteSize.height/6);
|
||||
|
||||
if (_strikethroughEnabled)
|
||||
// FIXME: system fonts don't report the height of the font correctly. only the size of the texture, which is POT
|
||||
y += spriteSize.height / 2;
|
||||
// FIXME: Might not work with different vertical alignments
|
||||
_underlineNode->drawLine(Vec2(0,y), Vec2(spriteSize.width,y), Color4F(_textSprite->getDisplayedColor()));
|
||||
}
|
||||
}
|
||||
|
||||
if(updateFinished){
|
||||
_contentDirty = false;
|
||||
}
|
||||
|
@ -1327,16 +1444,16 @@ float Label::getBMFontSize()const
|
|||
return _bmFontSize;
|
||||
}
|
||||
|
||||
void Label::onDrawShadow(GLProgram* glProgram)
|
||||
void Label::onDrawShadow(GLProgram* glProgram, const Color4F& shadowColor)
|
||||
{
|
||||
if (_currentLabelType == LabelType::TTF)
|
||||
{
|
||||
glProgram->setUniformLocationWith4f(_uniformTextColor,
|
||||
_shadowColor4F.r, _shadowColor4F.g, _shadowColor4F.b, _shadowColor4F.a);
|
||||
shadowColor.r, shadowColor.g, shadowColor.b, shadowColor.a);
|
||||
if (_currLabelEffect == LabelEffect::OUTLINE || _currLabelEffect == LabelEffect::GLOW)
|
||||
{
|
||||
glProgram->setUniformLocationWith4f(_uniformEffectColor,
|
||||
_shadowColor4F.r, _shadowColor4F.g, _shadowColor4F.b, _shadowColor4F.a);
|
||||
shadowColor.r, shadowColor.g, shadowColor.b, shadowColor.a);
|
||||
}
|
||||
|
||||
glProgram->setUniformsForBuiltins(_shadowTransform);
|
||||
|
@ -1353,8 +1470,8 @@ void Label::onDrawShadow(GLProgram* glProgram)
|
|||
{
|
||||
Color3B oldColor = _realColor;
|
||||
GLubyte oldOPacity = _displayedOpacity;
|
||||
_displayedOpacity = _shadowOpacity;
|
||||
setColor(_shadowColor3B);
|
||||
_displayedOpacity = shadowColor.a * 255;
|
||||
setColor(Color3B(shadowColor));
|
||||
|
||||
glProgram->setUniformsForBuiltins(_shadowTransform);
|
||||
for (auto&& it : _letters)
|
||||
|
@ -1379,7 +1496,10 @@ void Label::onDraw(const Mat4& transform, bool transformUpdated)
|
|||
|
||||
if (_shadowEnabled)
|
||||
{
|
||||
onDrawShadow(glprogram);
|
||||
if (_boldEnabled)
|
||||
onDrawShadow(glprogram, _textColorF);
|
||||
else
|
||||
onDrawShadow(glprogram, _shadowColor4F);
|
||||
}
|
||||
|
||||
glprogram->setUniformsForBuiltins(transform);
|
||||
|
@ -1672,18 +1792,21 @@ float Label::getLineSpacing() const
|
|||
|
||||
void Label::setAdditionalKerning(float space)
|
||||
{
|
||||
CCASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!");
|
||||
|
||||
if (_currentLabelType != LabelType::STRING_TEXTURE)
|
||||
{
|
||||
if (_additionalKerning != space)
|
||||
{
|
||||
_additionalKerning = space;
|
||||
_contentDirty = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
CCLOG("Label::setAdditionalKerning not supported on LabelType::STRING_TEXTURE");
|
||||
}
|
||||
|
||||
float Label::getAdditionalKerning() const
|
||||
{
|
||||
CCASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!");
|
||||
|
||||
return _additionalKerning;
|
||||
}
|
||||
|
||||
|
@ -1752,6 +1875,9 @@ void Label::updateDisplayedColor(const Color3B& parentColor)
|
|||
{
|
||||
_shadowNode->updateDisplayedColor(_displayedColor);
|
||||
}
|
||||
|
||||
if (_underlineNode)
|
||||
_contentDirty = true;
|
||||
}
|
||||
|
||||
for (auto&& it : _letters)
|
||||
|
|
|
@ -55,14 +55,24 @@ typedef struct _ttfConfig
|
|||
bool distanceFieldEnabled;
|
||||
int outlineSize;
|
||||
|
||||
bool italics;
|
||||
bool bold;
|
||||
bool underline;
|
||||
bool strikethrough;
|
||||
|
||||
_ttfConfig(const std::string& filePath = "",float size = 12, const GlyphCollection& glyphCollection = GlyphCollection::DYNAMIC,
|
||||
const char *customGlyphCollection = nullptr, bool useDistanceField = false, int outline = 0)
|
||||
const char *customGlyphCollection = nullptr, bool useDistanceField = false, int outline = 0,
|
||||
bool useItalics = false, bool useBold = false, bool useUnderline = false, bool useStrikethrough = false)
|
||||
: fontFilePath(filePath)
|
||||
, fontSize(size)
|
||||
, glyphs(glyphCollection)
|
||||
, customGlyphs(customGlyphCollection)
|
||||
, distanceFieldEnabled(useDistanceField)
|
||||
, outlineSize(outline)
|
||||
, italics(useItalics)
|
||||
, bold(useBold)
|
||||
, underline(useUnderline)
|
||||
, strikethrough(useStrikethrough)
|
||||
{
|
||||
if(outline > 0)
|
||||
{
|
||||
|
@ -336,6 +346,27 @@ public:
|
|||
*/
|
||||
virtual void enableGlow(const Color4B& glowColor);
|
||||
|
||||
/**
|
||||
* Enable italics rendering
|
||||
*/
|
||||
void enableItalics();
|
||||
|
||||
/**
|
||||
* Enable bold rendering
|
||||
*/
|
||||
void enableBold();
|
||||
|
||||
/**
|
||||
* Enable underline
|
||||
*/
|
||||
void enableUnderline();
|
||||
|
||||
/**
|
||||
* Enables strikethrough.
|
||||
* Underline and Strikethrough cannot be enabled at the same time.
|
||||
* Strikethough is like an underline but at the middle of the glyph
|
||||
*/
|
||||
void enableStrikethrough();
|
||||
/**
|
||||
* Disable all effect to Label.
|
||||
* @warning Please use disableEffect(LabelEffect::ALL) instead of this API.
|
||||
|
@ -605,7 +636,7 @@ protected:
|
|||
void computeStringNumLines();
|
||||
|
||||
void onDraw(const Mat4& transform, bool transformUpdated);
|
||||
void onDrawShadow(GLProgram* glProgram);
|
||||
void onDrawShadow(GLProgram* glProgram, const Color4F& shadowColor);
|
||||
void drawSelf(bool visibleByCamera, Renderer* renderer, uint32_t flags);
|
||||
|
||||
bool multilineTextWrapByChar();
|
||||
|
@ -735,6 +766,11 @@ protected:
|
|||
float _bmfontScale;
|
||||
Overflow _overflow;
|
||||
float _originalFontSize;
|
||||
|
||||
bool _boldEnabled;
|
||||
DrawNode* _underlineNode;
|
||||
bool _strikethroughEnabled;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Label);
|
||||
};
|
||||
|
|
|
@ -50,8 +50,10 @@ class Texture2D;
|
|||
|
||||
You can modify the frame of a Sprite by doing:
|
||||
|
||||
SpriteFrame *frame = SpriteFrame::frameWithTexture(texture, rect, offset);
|
||||
sprite->setDisplayFrame(frame);
|
||||
@code
|
||||
SpriteFrame* frame = SpriteFrame::createWithTexture(texture, rect);
|
||||
sprite->setSpriteFrame(frame);
|
||||
@endcode
|
||||
*/
|
||||
class CC_DLL SpriteFrame : public Ref, public Clonable
|
||||
{
|
||||
|
|
|
@ -117,7 +117,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\debug-lib\*.*"
|
|||
<ImportLibrary>$(TargetDir)$(TargetName).lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ModuleDefinitionFile>cocos2d.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>sqlite3.lib;libcurl_imp.lib;websockets.lib;libmpg123.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;OpenAL32.lib;libbullet.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>sqlite3.lib;libcurl_imp.lib;websockets.lib;libmpg123.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;OpenAL32.lib;libbullet.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>
|
||||
|
@ -164,7 +164,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
</Command>
|
||||
</PreLinkEvent>
|
||||
<Link>
|
||||
<AdditionalDependencies>sqlite3.lib;libcurl_imp.lib;websockets.lib;libmpg123.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;OpenAL32.lib;libbullet.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>sqlite3.lib;libcurl_imp.lib;websockets.lib;libmpg123.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;OpenAL32.lib;libbullet.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(ProjectName).dll</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<IgnoreSpecificDefaultLibraries>LIBCMTD.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
|
|
|
@ -162,12 +162,12 @@ void Bundle3D::clear()
|
|||
{
|
||||
if (_isBinary)
|
||||
{
|
||||
CC_SAFE_DELETE(_binaryBuffer);
|
||||
_binaryBuffer.clear();
|
||||
CC_SAFE_DELETE_ARRAY(_references);
|
||||
}
|
||||
else
|
||||
{
|
||||
CC_SAFE_DELETE_ARRAY(_jsonBuffer);
|
||||
_jsonBuffer.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1038,14 +1038,9 @@ bool Bundle3D::loadJson(const std::string& path)
|
|||
{
|
||||
clear();
|
||||
|
||||
Data data = FileUtils::getInstance()->getDataFromFile(path);
|
||||
ssize_t size = data.getSize();
|
||||
_jsonBuffer = FileUtils::getInstance()->getStringFromFile(path);
|
||||
|
||||
// json need null-terminated string.
|
||||
_jsonBuffer = new char[size + 1];
|
||||
memcpy(_jsonBuffer, data.getBytes(), size);
|
||||
_jsonBuffer[size] = '\0';
|
||||
if (_jsonReader.ParseInsitu<0>(_jsonBuffer).HasParseError())
|
||||
if (_jsonReader.ParseInsitu<0>((char*)_jsonBuffer.c_str()).HasParseError())
|
||||
{
|
||||
clear();
|
||||
CCLOG("Parse json failed in Bundle3D::loadJson function");
|
||||
|
@ -1067,10 +1062,9 @@ bool Bundle3D::loadBinary(const std::string& path)
|
|||
clear();
|
||||
|
||||
// get file data
|
||||
CC_SAFE_DELETE(_binaryBuffer);
|
||||
_binaryBuffer = new (std::nothrow) Data();
|
||||
*_binaryBuffer = FileUtils::getInstance()->getDataFromFile(path);
|
||||
if (_binaryBuffer->isNull())
|
||||
_binaryBuffer.clear();
|
||||
_binaryBuffer = FileUtils::getInstance()->getDataFromFile(path);
|
||||
if (_binaryBuffer.isNull())
|
||||
{
|
||||
clear();
|
||||
CCLOG("warning: Failed to read file: %s", path.c_str());
|
||||
|
@ -1078,7 +1072,7 @@ bool Bundle3D::loadBinary(const std::string& path)
|
|||
}
|
||||
|
||||
// Initialise bundle reader
|
||||
_binaryReader.init( (char*)_binaryBuffer->getBytes(), _binaryBuffer->getSize() );
|
||||
_binaryReader.init( (char*)_binaryBuffer.getBytes(), _binaryBuffer.getSize() );
|
||||
|
||||
// Read identifier info
|
||||
char identifier[] = { 'C', '3', 'B', '\0'};
|
||||
|
@ -2199,8 +2193,6 @@ Bundle3D::Bundle3D()
|
|||
: _modelPath(""),
|
||||
_path(""),
|
||||
_version(""),
|
||||
_jsonBuffer(nullptr),
|
||||
_binaryBuffer(nullptr),
|
||||
_referenceCount(0),
|
||||
_references(nullptr),
|
||||
_isBinary(false)
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#ifndef __CCBUNDLE3D_H__
|
||||
#define __CCBUNDLE3D_H__
|
||||
|
||||
#include "base/CCData.h"
|
||||
#include "3d/CCBundle3DData.h"
|
||||
#include "3d/CCBundleReader.h"
|
||||
#include "json/document.h"
|
||||
|
@ -37,7 +38,6 @@ NS_CC_BEGIN
|
|||
*/
|
||||
|
||||
class Animation3D;
|
||||
class Data;
|
||||
|
||||
/**
|
||||
* @brief Defines a bundle file that contains a collection of assets. Mesh, Material, MeshSkin, Animation
|
||||
|
@ -177,11 +177,11 @@ protected:
|
|||
std::string _version;// the c3b or c3t version
|
||||
|
||||
// for json reading
|
||||
char* _jsonBuffer;
|
||||
std::string _jsonBuffer;
|
||||
rapidjson::Document _jsonReader;
|
||||
|
||||
// for binary reading
|
||||
Data* _binaryBuffer;
|
||||
Data _binaryBuffer;
|
||||
BundleReader _binaryReader;
|
||||
unsigned int _referenceCount;
|
||||
Reference* _references;
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "base/CCDirector.h"
|
||||
#include "base/CCScheduler.h"
|
||||
#include "platform/android/CCFileUtils-android.h"
|
||||
#include "platform/android/jni/CocosPlayClient.h"
|
||||
|
||||
using namespace cocos2d;
|
||||
using namespace cocos2d::experimental;
|
||||
|
@ -249,14 +248,12 @@ int AudioEngineImpl::play2d(const std::string &filePath ,bool loop ,float volume
|
|||
|
||||
auto& player = _audioPlayers[currentAudioID];
|
||||
auto fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
|
||||
cocosplay::updateAssets(fullPath);
|
||||
auto initPlayer = player.init(_engineEngine, _outputMixObject, fullPath, volume, loop);
|
||||
if (!initPlayer){
|
||||
_audioPlayers.erase(currentAudioID);
|
||||
log("%s,%d message:create player for %s fail", __func__, __LINE__, filePath.c_str());
|
||||
break;
|
||||
}
|
||||
cocosplay::notifyFileLoaded(fullPath);
|
||||
|
||||
audioId = currentAudioID++;
|
||||
player._audioID = audioId;
|
||||
|
|
|
@ -300,7 +300,7 @@ public:
|
|||
* @param other The vector to be compared.
|
||||
* @return True if two vectors are equal, false if not.
|
||||
*/
|
||||
bool equals(const Vector<T> &other)
|
||||
bool equals(const Vector<T> &other) const
|
||||
{
|
||||
ssize_t s = this->size();
|
||||
if (s != other.size())
|
||||
|
|
|
@ -63,7 +63,7 @@ struct CC_DLL Color3B
|
|||
bool operator!=(const Color4B& right) const;
|
||||
bool operator!=(const Color4F& right) const;
|
||||
|
||||
bool equals(const Color3B& other)
|
||||
bool equals(const Color3B& other) const
|
||||
{
|
||||
return (*this == other);
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ struct CC_DLL Color4F
|
|||
bool operator!=(const Color3B& right) const;
|
||||
bool operator!=(const Color4B& right) const;
|
||||
|
||||
bool equals(const Color4F &other)
|
||||
bool equals(const Color4F &other) const
|
||||
{
|
||||
return (*this == other);
|
||||
}
|
||||
|
@ -570,14 +570,19 @@ public:
|
|||
};
|
||||
|
||||
/**
|
||||
* @brief Possible LabelEffect used by Label.
|
||||
* @brief Effects used by `Label`
|
||||
*
|
||||
*/
|
||||
enum class LabelEffect {
|
||||
// FIXME: Covert them to bitwise. More than one effect should be supported
|
||||
NORMAL,
|
||||
OUTLINE,
|
||||
SHADOW,
|
||||
GLOW,
|
||||
ITALICS,
|
||||
BOLD,
|
||||
UNDERLINE,
|
||||
STRIKETHROUGH,
|
||||
ALL
|
||||
};
|
||||
|
||||
|
|
|
@ -164,6 +164,16 @@ ActionTimeline* ActionTimelineCache::createActionFromJson(const std::string& fil
|
|||
return action->clone();
|
||||
}
|
||||
|
||||
ActionTimeline* ActionTimelineCache::createActionFromContent(const std::string& fileName, const std::string& content)
|
||||
{
|
||||
ActionTimeline* action = _animationActions.at(fileName);
|
||||
if (action == nullptr)
|
||||
{
|
||||
action = loadAnimationActionWithContent(fileName, content);
|
||||
}
|
||||
return action->clone();
|
||||
}
|
||||
|
||||
ActionTimeline* ActionTimelineCache::loadAnimationActionWithFile(const std::string& fileName)
|
||||
{
|
||||
// Read content from file
|
||||
|
@ -414,6 +424,16 @@ ActionTimeline* ActionTimelineCache::createActionWithFlatBuffersFile(const std::
|
|||
return action->clone();
|
||||
}
|
||||
|
||||
ActionTimeline* ActionTimelineCache::createActionWithDataBuffer(Data data, const std::string &fileName)
|
||||
{
|
||||
ActionTimeline* action = _animationActions.at(fileName);
|
||||
if (action == NULL)
|
||||
{
|
||||
action = loadAnimationWithDataBuffer(data, fileName);
|
||||
}
|
||||
return action->clone();
|
||||
}
|
||||
|
||||
ActionTimeline* ActionTimelineCache::loadAnimationActionWithFlatBuffersFile(const std::string &fileName)
|
||||
{
|
||||
// if already exists an action with filename, then return this action
|
||||
|
@ -434,7 +454,7 @@ ActionTimeline* ActionTimelineCache::loadAnimationActionWithFlatBuffersFile(cons
|
|||
return action;
|
||||
}
|
||||
|
||||
ActionTimeline* ActionTimelineCache::loadAnimationWithDataBuffer(const cocos2d::Data data, const std::string fileName)
|
||||
ActionTimeline* ActionTimelineCache::loadAnimationWithDataBuffer(const cocos2d::Data& data, const std::string& fileName)
|
||||
{
|
||||
// if already exists an action with filename, then return this action
|
||||
ActionTimeline* action = _animationActions.at(fileName);
|
||||
|
@ -453,7 +473,7 @@ ActionTimeline* ActionTimelineCache::loadAnimationWithDataBuffer(const cocos2d::
|
|||
return action;
|
||||
}
|
||||
|
||||
inline ActionTimeline* ActionTimelineCache::createActionWithDataBuffer(const cocos2d::Data data)
|
||||
ActionTimeline* ActionTimelineCache::createActionWithDataBuffer(const cocos2d::Data& data)
|
||||
{
|
||||
auto csparsebinary = GetCSParseBinary(data.getBytes());
|
||||
|
||||
|
|
|
@ -78,13 +78,16 @@ public:
|
|||
|
||||
/** Clone a action with the specified name from the container. */
|
||||
ActionTimeline* createActionFromJson(const std::string& fileName);
|
||||
ActionTimeline* createActionFromContent(const std::string& fileName, const std::string& content);
|
||||
|
||||
ActionTimeline* loadAnimationActionWithFile(const std::string& fileName);
|
||||
ActionTimeline* loadAnimationActionWithContent(const std::string&fileName, const std::string& content);
|
||||
|
||||
ActionTimeline* createActionWithFlatBuffersFile(const std::string& fileName);
|
||||
ActionTimeline* createActionWithDataBuffer(cocos2d::Data data, const std::string &fileName);
|
||||
|
||||
ActionTimeline* loadAnimationActionWithFlatBuffersFile(const std::string& fileName);
|
||||
ActionTimeline* loadAnimationWithDataBuffer(const cocos2d::Data data, const std::string fileName);
|
||||
ActionTimeline* loadAnimationWithDataBuffer(const cocos2d::Data& data, const std::string& fileName);
|
||||
|
||||
ActionTimeline* createActionWithFlatBuffersForSimulator(const std::string& fileName);
|
||||
|
||||
|
@ -122,7 +125,7 @@ protected:
|
|||
Frame* loadBlendFrameWithFlatBuffers (const flatbuffers::BlendFrame* flatbuffers);
|
||||
void loadEasingDataWithFlatBuffers(Frame* frame, const flatbuffers::EasingData* flatbuffers);
|
||||
|
||||
inline ActionTimeline* createActionWithDataBuffer(const cocos2d::Data data);
|
||||
inline ActionTimeline* createActionWithDataBuffer(const cocos2d::Data& data);
|
||||
protected:
|
||||
|
||||
typedef std::function<Frame*(const rapidjson::Value& json)> FrameCreateFunc;
|
||||
|
|
|
@ -348,7 +348,7 @@ ActionTimeline* CSLoader::createTimeline(const std::string &filename)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
ActionTimeline* CSLoader::createTimeline(const Data data, const std::string& filename)
|
||||
ActionTimeline* CSLoader::createTimeline(const Data& data, const std::string& filename)
|
||||
{
|
||||
std::string suffix = getExtentionName(filename);
|
||||
|
||||
|
@ -356,12 +356,12 @@ ActionTimeline* CSLoader::createTimeline(const Data data, const std::string& fil
|
|||
|
||||
if (suffix == "csb")
|
||||
{
|
||||
return cache->loadAnimationWithDataBuffer(data, filename);
|
||||
return cache->createActionWithDataBuffer(data, filename);
|
||||
}
|
||||
else if (suffix == "json" || suffix == "ExportJson")
|
||||
{
|
||||
std::string content((char *)data.getBytes(), data.getSize());
|
||||
return cache->loadAnimationActionWithContent(filename, content);
|
||||
return cache->createActionFromContent(filename, content);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -853,12 +853,12 @@ Component* CSLoader::loadComAudio(const rapidjson::Value &json)
|
|||
return audio;
|
||||
}
|
||||
|
||||
cocos2d::Node* CSLoader::createNode(const Data data)
|
||||
cocos2d::Node* CSLoader::createNode(const Data& data)
|
||||
{
|
||||
return createNode(data, nullptr);
|
||||
}
|
||||
|
||||
Node * CSLoader::createNode(const Data data, const ccNodeLoadCallback &callback)
|
||||
Node * CSLoader::createNode(const Data& data, const ccNodeLoadCallback &callback)
|
||||
{
|
||||
CSLoader * loader = CSLoader::getInstance();
|
||||
Node * node = nullptr;
|
||||
|
@ -1016,7 +1016,7 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree, const
|
|||
{
|
||||
Data buf = FileUtils::getInstance()->getDataFromFile(filePath);
|
||||
node = createNode(buf, callback);
|
||||
action = timeline::ActionTimelineCache::getInstance()->loadAnimationWithDataBuffer(buf, filePath);
|
||||
action = createTimeline(buf, filePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -79,13 +79,13 @@ public:
|
|||
|
||||
static cocos2d::Node* createNode(const std::string& filename);
|
||||
static cocos2d::Node* createNode(const std::string& filename, const ccNodeLoadCallback& callback);
|
||||
static cocos2d::Node* createNode(const Data data);
|
||||
static cocos2d::Node* createNode(const Data data, const ccNodeLoadCallback &callback);
|
||||
static cocos2d::Node* createNode(const Data& data);
|
||||
static cocos2d::Node* createNode(const Data& data, const ccNodeLoadCallback &callback);
|
||||
static cocos2d::Node* createNodeWithVisibleSize(const std::string& filename);
|
||||
static cocos2d::Node* createNodeWithVisibleSize(const std::string& filename, const ccNodeLoadCallback& callback);
|
||||
|
||||
static cocostudio::timeline::ActionTimeline* createTimeline(const std::string& filename);
|
||||
static cocostudio::timeline::ActionTimeline* createTimeline(const Data data, const std::string& filename);
|
||||
static cocostudio::timeline::ActionTimeline* createTimeline(const Data& data, const std::string& filename);
|
||||
|
||||
/*
|
||||
static cocostudio::timeline::ActionTimelineNode* createActionTimelineNode(const std::string& filename);
|
||||
|
|
|
@ -1497,6 +1497,9 @@ struct ScrollViewOptions : private flatbuffers::Table {
|
|||
const FlatSize *innerSize() const { return GetStruct<const FlatSize *>(28); }
|
||||
int32_t direction() const { return GetField<int32_t>(30, 0); }
|
||||
uint8_t bounceEnabled() const { return GetField<uint8_t>(32, 0); }
|
||||
uint8_t scrollbarEnabeld() const { return GetField<uint8_t>(34, 1); }
|
||||
uint8_t scrollbarAutoHide() const { return GetField<uint8_t>(36, 1); }
|
||||
float scrollbarAutoHideTime() const { return GetField<float>(38, 0.2); }
|
||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* widgetOptions */) &&
|
||||
|
@ -1516,6 +1519,9 @@ struct ScrollViewOptions : private flatbuffers::Table {
|
|||
VerifyField<FlatSize>(verifier, 28 /* innerSize */) &&
|
||||
VerifyField<int32_t>(verifier, 30 /* direction */) &&
|
||||
VerifyField<uint8_t>(verifier, 32 /* bounceEnabled */) &&
|
||||
VerifyField<uint8_t>(verifier, 34 /* scrollbarEnabeld */) &&
|
||||
VerifyField<uint8_t>(verifier, 36 /* scrollbarAutoHide */) &&
|
||||
VerifyField<float>(verifier, 38 /* scrollbarAutoHideTime */) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
@ -1538,10 +1544,13 @@ struct ScrollViewOptionsBuilder {
|
|||
void add_innerSize(const FlatSize *innerSize) { fbb_.AddStruct(28, innerSize); }
|
||||
void add_direction(int32_t direction) { fbb_.AddElement<int32_t>(30, direction, 0); }
|
||||
void add_bounceEnabled(uint8_t bounceEnabled) { fbb_.AddElement<uint8_t>(32, bounceEnabled, 0); }
|
||||
void add_scrollbarEnabeld(uint8_t scrollbarEnabeld) { fbb_.AddElement<uint8_t>(34, scrollbarEnabeld, 1); }
|
||||
void add_scrollbarAutoHide(uint8_t scrollbarAutoHide) { fbb_.AddElement<uint8_t>(36, scrollbarAutoHide, 1); }
|
||||
void add_scrollbarAutoHideTime(float scrollbarAutoHideTime) { fbb_.AddElement<float>(38, scrollbarAutoHideTime, 0.2); }
|
||||
ScrollViewOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||
ScrollViewOptionsBuilder &operator=(const ScrollViewOptionsBuilder &);
|
||||
flatbuffers::Offset<ScrollViewOptions> Finish() {
|
||||
auto o = flatbuffers::Offset<ScrollViewOptions>(fbb_.EndTable(start_, 15));
|
||||
auto o = flatbuffers::Offset<ScrollViewOptions>(fbb_.EndTable(start_, 18));
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
@ -1561,8 +1570,12 @@ inline flatbuffers::Offset<ScrollViewOptions> CreateScrollViewOptions(flatbuffer
|
|||
uint8_t backGroundScale9Enabled = 0,
|
||||
const FlatSize *innerSize = 0,
|
||||
int32_t direction = 0,
|
||||
uint8_t bounceEnabled = 0) {
|
||||
uint8_t bounceEnabled = 0,
|
||||
uint8_t scrollbarEnabeld = 1,
|
||||
uint8_t scrollbarAutoHide = 1,
|
||||
float scrollbarAutoHideTime = 0.2) {
|
||||
ScrollViewOptionsBuilder builder_(_fbb);
|
||||
builder_.add_scrollbarAutoHideTime(scrollbarAutoHideTime);
|
||||
builder_.add_direction(direction);
|
||||
builder_.add_innerSize(innerSize);
|
||||
builder_.add_scale9Size(scale9Size);
|
||||
|
@ -1574,6 +1587,8 @@ inline flatbuffers::Offset<ScrollViewOptions> CreateScrollViewOptions(flatbuffer
|
|||
builder_.add_bgColor(bgColor);
|
||||
builder_.add_backGroundImageData(backGroundImageData);
|
||||
builder_.add_widgetOptions(widgetOptions);
|
||||
builder_.add_scrollbarAutoHide(scrollbarAutoHide);
|
||||
builder_.add_scrollbarEnabeld(scrollbarEnabeld);
|
||||
builder_.add_bounceEnabled(bounceEnabled);
|
||||
builder_.add_backGroundScale9Enabled(backGroundScale9Enabled);
|
||||
builder_.add_bgColorOpacity(bgColorOpacity);
|
||||
|
|
|
@ -47,4 +47,6 @@ cocos2d::ObjectFactory::TInfo className::__Type(#className, &className::createIn
|
|||
#define CREATE_CLASS_NODE_READER_INFO(className) \
|
||||
cocos2d::ObjectFactory::TInfo(#className, &className::createInstance) \
|
||||
|
||||
#define FLATSTR_TO_BOOL(str) (str.compare("True") == 0) ? true : false
|
||||
|
||||
#endif /* defined(__cocos2d_libs__NodeReaderDefine__) */
|
||||
|
|
|
@ -65,11 +65,13 @@ namespace cocostudio
|
|||
if (key == P_InnerWidth) {
|
||||
innerWidth = valueToFloat(value);
|
||||
}
|
||||
else if(key == P_InnerHeight){
|
||||
else if (key == P_InnerHeight) {
|
||||
innerHeight = valueToFloat(value);
|
||||
}else if(key == P_Direction){
|
||||
}
|
||||
else if (key == P_Direction) {
|
||||
scrollView->setDirection((ScrollView::Direction)valueToInt(value));
|
||||
}else if(key == P_BounceEnable){
|
||||
}
|
||||
else if (key == P_BounceEnable) {
|
||||
scrollView->setBounceEnabled(valueToBool(value));
|
||||
}
|
||||
|
||||
|
@ -84,10 +86,10 @@ namespace cocostudio
|
|||
|
||||
|
||||
ScrollView* scrollView = static_cast<ScrollView*>(widget);
|
||||
float innerWidth = DICTOOL->getFloatValue_json(options, P_InnerWidth,200);
|
||||
float innerHeight = DICTOOL->getFloatValue_json(options, P_InnerHeight,200);
|
||||
float innerWidth = DICTOOL->getFloatValue_json(options, P_InnerWidth, 200);
|
||||
float innerHeight = DICTOOL->getFloatValue_json(options, P_InnerHeight, 200);
|
||||
scrollView->setInnerContainerSize(Size(innerWidth, innerHeight));
|
||||
int direction = DICTOOL->getFloatValue_json(options, P_Direction,1);
|
||||
int direction = DICTOOL->getFloatValue_json(options, P_Direction, 1);
|
||||
scrollView->setDirection((ScrollView::Direction)direction);
|
||||
scrollView->setBounceEnabled(DICTOOL->getBooleanValue_json(options, P_BounceEnable));
|
||||
|
||||
|
@ -118,7 +120,9 @@ namespace cocostudio
|
|||
Size innerSize(200, 300);
|
||||
int direction = 0;
|
||||
bool bounceEnabled = false;
|
||||
|
||||
bool scrollbarEnabled = true;
|
||||
bool scrollbarAutoHide = true;
|
||||
float scrollbarAutoHideTime = 0.2f;
|
||||
|
||||
// attributes
|
||||
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
||||
|
@ -129,7 +133,7 @@ namespace cocostudio
|
|||
|
||||
if (name == "ClipAble")
|
||||
{
|
||||
clipEnabled = (value == "True") ? true : false;
|
||||
clipEnabled = FLATSTR_TO_BOOL(value);
|
||||
}
|
||||
else if (name == "ComboBoxIndex")
|
||||
{
|
||||
|
@ -141,10 +145,7 @@ namespace cocostudio
|
|||
}
|
||||
else if (name == "Scale9Enable")
|
||||
{
|
||||
if (value == "True")
|
||||
{
|
||||
backGroundScale9Enabled = true;
|
||||
}
|
||||
backGroundScale9Enabled = FLATSTR_TO_BOOL(value);
|
||||
}
|
||||
else if (name == "Scale9OriginX")
|
||||
{
|
||||
|
@ -179,9 +180,20 @@ namespace cocostudio
|
|||
}
|
||||
else if (name == "IsBounceEnabled")
|
||||
{
|
||||
bounceEnabled = (value == "True") ? true : false;
|
||||
bounceEnabled = FLATSTR_TO_BOOL(value);
|
||||
}
|
||||
else if (name.compare("BarEnabled") == 0)
|
||||
{
|
||||
scrollbarEnabled = FLATSTR_TO_BOOL(value);
|
||||
}
|
||||
else if (name.compare("BarAutoHide") == 0)
|
||||
{
|
||||
scrollbarAutoHide = FLATSTR_TO_BOOL(value);
|
||||
}
|
||||
else if (name.compare("BarAutoHideTime") == 0)
|
||||
{
|
||||
scrollbarAutoHideTime = atof(value.c_str());
|
||||
}
|
||||
|
||||
attribute = attribute->Next();
|
||||
}
|
||||
|
||||
|
@ -392,7 +404,10 @@ namespace cocostudio
|
|||
backGroundScale9Enabled,
|
||||
&f_innerSize,
|
||||
direction,
|
||||
bounceEnabled);
|
||||
bounceEnabled,
|
||||
scrollbarEnabled,
|
||||
scrollbarAutoHide,
|
||||
scrollbarAutoHideTime);
|
||||
|
||||
return *(Offset<Table>*)(&options);
|
||||
}
|
||||
|
@ -513,6 +528,15 @@ namespace cocostudio
|
|||
bool bounceEnabled = options->bounceEnabled() != 0;
|
||||
scrollView->setBounceEnabled(bounceEnabled);
|
||||
|
||||
bool scrollbarEnabled = options->scrollbarEnabeld() != 0;
|
||||
scrollView->setScrollBarEnabled(scrollbarEnabled);
|
||||
bool scrollbarAutoHide = options->scrollbarAutoHide() != 0;
|
||||
if (scrollbarEnabled)
|
||||
{
|
||||
scrollView->setScrollBarAutoHideEnabled(scrollbarAutoHide);
|
||||
float barAutoHideTime = options->scrollbarAutoHideTime();
|
||||
scrollView->setScrollBarAutoHideTime(barAutoHideTime);
|
||||
}
|
||||
|
||||
auto widgetReader = WidgetReader::getInstance();
|
||||
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
|
||||
|
@ -549,15 +573,15 @@ namespace cocostudio
|
|||
|
||||
int ScrollViewReader::getResourceType(std::string key)
|
||||
{
|
||||
if(key == "Normal" || key == "Default")
|
||||
if (key == "Normal" || key == "Default")
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance();
|
||||
if(fbs->_isSimulator)
|
||||
if (fbs->_isSimulator)
|
||||
{
|
||||
if(key == "MarkedSubImage")
|
||||
if (key == "MarkedSubImage")
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -142,9 +142,9 @@ public:
|
|||
* Set the url address of HttpRequest object.
|
||||
* The url value could be like these: "http://httpbin.org/ip" or "https://httpbin.org/get"
|
||||
*
|
||||
* @param url the string pointer.
|
||||
* @param url the string object.
|
||||
*/
|
||||
inline void setUrl(const char* url)
|
||||
inline void setUrl(const std::string& url)
|
||||
{
|
||||
_url = url;
|
||||
};
|
||||
|
@ -194,9 +194,9 @@ public:
|
|||
* Set a string tag to identify your request.
|
||||
* This tag can be found in HttpResponse->getHttpRequest->getTag().
|
||||
*
|
||||
* @param tag the string pointer
|
||||
* @param tag the string object.
|
||||
*/
|
||||
inline void setTag(const char* tag)
|
||||
inline void setTag(const std::string& tag)
|
||||
{
|
||||
_tag = tag;
|
||||
};
|
||||
|
|
|
@ -19,8 +19,7 @@ jni/Java_org_cocos2dx_lib_Cocos2dxBitmap.cpp \
|
|||
jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp \
|
||||
jni/Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp \
|
||||
jni/JniHelper.cpp \
|
||||
jni/TouchesJni.cpp \
|
||||
jni/CocosPlayClient.cpp
|
||||
jni/TouchesJni.cpp
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ THE SOFTWARE.
|
|||
#include "CCFileUtils-android.h"
|
||||
#include "platform/CCCommon.h"
|
||||
#include "platform/android/jni/JniHelper.h"
|
||||
#include "platform/android/jni/CocosPlayClient.h"
|
||||
#include "android/asset_manager.h"
|
||||
#include "android/asset_manager_jni.h"
|
||||
#include <stdlib.h>
|
||||
|
@ -78,15 +77,7 @@ FileUtilsAndroid::~FileUtilsAndroid()
|
|||
|
||||
bool FileUtilsAndroid::init()
|
||||
{
|
||||
cocosplay::lazyInit();
|
||||
if (cocosplay::isEnabled() && !cocosplay::isDemo())
|
||||
{
|
||||
_defaultResRootPath = cocosplay::getGameRoot();
|
||||
}
|
||||
else
|
||||
{
|
||||
_defaultResRootPath = "assets/";
|
||||
}
|
||||
|
||||
return FileUtils::init();
|
||||
}
|
||||
|
@ -150,11 +141,6 @@ bool FileUtilsAndroid::isFileExistInternal(const std::string& strFilePath) const
|
|||
return false;
|
||||
}
|
||||
|
||||
if (cocosplay::isEnabled() && !cocosplay::isDemo())
|
||||
{
|
||||
return cocosplay::fileExists(strFilePath);
|
||||
}
|
||||
|
||||
bool bFound = false;
|
||||
|
||||
// Check whether file exists in apk.
|
||||
|
@ -200,16 +186,6 @@ bool FileUtilsAndroid::isDirectoryExistInternal(const std::string& dirPath) cons
|
|||
int lenOfAssets = 7;
|
||||
|
||||
std::string tmpStr;
|
||||
if (cocosplay::isEnabled() && !cocosplay::isDemo())
|
||||
{
|
||||
// redirect assets/*** path to cocosplay resource dir
|
||||
tmpStr.append(_defaultResRootPath);
|
||||
if ('/' != tmpStr[tmpStr.length() - 1])
|
||||
{
|
||||
tmpStr += '/';
|
||||
}
|
||||
tmpStr.append(s + lenOfAssets);
|
||||
}
|
||||
|
||||
// find absolute path in flash memory
|
||||
if (s[0] == '/')
|
||||
|
@ -264,7 +240,6 @@ Data FileUtilsAndroid::getData(const std::string& filename, bool forString)
|
|||
unsigned char* data = nullptr;
|
||||
ssize_t size = 0;
|
||||
string fullPath = fullPathForFilename(filename);
|
||||
cocosplay::updateAssets(fullPath);
|
||||
|
||||
if (fullPath[0] != '/')
|
||||
{
|
||||
|
@ -356,7 +331,6 @@ Data FileUtilsAndroid::getData(const std::string& filename, bool forString)
|
|||
else
|
||||
{
|
||||
ret.fastSet(data, size);
|
||||
cocosplay::notifyFileLoaded(fullPath);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -387,7 +361,6 @@ unsigned char* FileUtilsAndroid::getFileData(const std::string& filename, const
|
|||
}
|
||||
|
||||
string fullPath = fullPathForFilename(filename);
|
||||
cocosplay::updateAssets(fullPath);
|
||||
|
||||
if (fullPath[0] != '/')
|
||||
{
|
||||
|
@ -459,10 +432,7 @@ unsigned char* FileUtilsAndroid::getFileData(const std::string& filename, const
|
|||
msg.append(filename).append(") failed!");
|
||||
CCLOG("%s", msg.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
cocosplay::notifyFileLoaded(fullPath);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2015 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.
|
||||
****************************************************************************/
|
||||
package com.chukong.cocosplay.client;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
public class CocosPlayClient {
|
||||
|
||||
public static boolean init(Activity activity, boolean isDemo) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isDemo() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isNotifyFileLoadedEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void notifyFileLoaded(String filePath) {
|
||||
|
||||
}
|
||||
|
||||
public static void updateAssets(String filePath) {
|
||||
|
||||
}
|
||||
|
||||
public static String getGameRoot() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public static native String[] getSearchPaths();
|
||||
}
|
|
@ -42,8 +42,6 @@ import android.view.Window;
|
|||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.chukong.cocosplay.client.CocosPlayClient;
|
||||
|
||||
import org.cocos2dx.lib.Cocos2dxHelper.Cocos2dxHelperListener;
|
||||
|
||||
import javax.microedition.khronos.egl.EGL10;
|
||||
|
@ -258,7 +256,6 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
|
|||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
CocosPlayClient.init(this, false);
|
||||
|
||||
onLoadNativeLibraries();
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ import android.util.DisplayMetrics;
|
|||
import android.view.Display;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.chukong.cocosplay.client.CocosPlayClient;
|
||||
import com.enhance.gameservice.IGameTuningService;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
@ -94,12 +93,7 @@ public class Cocos2dxHelper {
|
|||
final ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
||||
|
||||
Cocos2dxHelper.sPackageName = applicationInfo.packageName;
|
||||
if (CocosPlayClient.isEnabled() && !CocosPlayClient.isDemo()) {
|
||||
Cocos2dxHelper.sFileDirectory = CocosPlayClient.getGameRoot();
|
||||
}
|
||||
else {
|
||||
Cocos2dxHelper.sFileDirectory = activity.getFilesDir().getAbsolutePath();
|
||||
}
|
||||
|
||||
Cocos2dxHelper.nativeSetApkPath(applicationInfo.sourceDir);
|
||||
|
||||
|
|
|
@ -30,8 +30,6 @@ import android.content.res.AssetFileDescriptor;
|
|||
import android.media.MediaPlayer;
|
||||
import android.util.Log;
|
||||
|
||||
import com.chukong.cocosplay.client.CocosPlayClient;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
|
||||
public class Cocos2dxMusic {
|
||||
|
@ -247,10 +245,6 @@ public class Cocos2dxMusic {
|
|||
MediaPlayer mediaPlayer = new MediaPlayer();
|
||||
|
||||
try {
|
||||
if (CocosPlayClient.isEnabled() && !CocosPlayClient.isDemo()) {
|
||||
CocosPlayClient.updateAssets(path);
|
||||
}
|
||||
CocosPlayClient.notifyFileLoaded(path);
|
||||
if (path.startsWith("/")) {
|
||||
final FileInputStream fis = new FileInputStream(path);
|
||||
mediaPlayer.setDataSource(fis.getFD());
|
||||
|
|
|
@ -29,8 +29,6 @@ import android.media.AudioManager;
|
|||
import android.media.SoundPool;
|
||||
import android.util.Log;
|
||||
|
||||
import com.chukong.cocosplay.client.CocosPlayClient;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
@ -98,10 +96,6 @@ public class Cocos2dxSound {
|
|||
}
|
||||
|
||||
public int preloadEffect(final String path) {
|
||||
if (CocosPlayClient.isEnabled() && !CocosPlayClient.isDemo()) {
|
||||
CocosPlayClient.updateAssets(path);
|
||||
}
|
||||
CocosPlayClient.notifyFileLoaded(path);
|
||||
Integer soundID = this.mPathSoundIDMap.get(path);
|
||||
|
||||
if (soundID == null) {
|
||||
|
|
|
@ -34,8 +34,6 @@ import android.view.SurfaceView;
|
|||
import android.widget.FrameLayout;
|
||||
import android.widget.MediaController.MediaPlayerControl;
|
||||
|
||||
import com.chukong.cocosplay.client.CocosPlayClient;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -219,10 +217,6 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
|
|||
if (path.startsWith(AssetResourceRoot)) {
|
||||
path = path.substring(AssetResourceRoot.length());
|
||||
}
|
||||
if (CocosPlayClient.isEnabled() && !CocosPlayClient.isDemo()) {
|
||||
CocosPlayClient.updateAssets(path);
|
||||
}
|
||||
CocosPlayClient.notifyFileLoaded(path);
|
||||
if (path.startsWith("/")) {
|
||||
mIsAssetRouse = false;
|
||||
setVideoURI(Uri.parse(path),null);
|
||||
|
|
|
@ -6,8 +6,6 @@ import android.util.SparseArray;
|
|||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.chukong.cocosplay.client.CocosPlayClient;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.FutureTask;
|
||||
|
@ -157,10 +155,6 @@ public class Cocos2dxWebViewHelper {
|
|||
}
|
||||
|
||||
public static void loadFile(final int index, final String filePath) {
|
||||
if (CocosPlayClient.isEnabled() && !CocosPlayClient.isDemo()) {
|
||||
CocosPlayClient.updateAssets(filePath);
|
||||
}
|
||||
CocosPlayClient.notifyFileLoaded(filePath);
|
||||
sCocos2dxActivity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -1,423 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2015 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 "CocosPlayClient.h"
|
||||
#include <map>
|
||||
#include<unordered_map>
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
#include "jni/JniHelper.h"
|
||||
#include "platform/CCCommon.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
#define LOG_TAG "CocosPlayClient.cpp"
|
||||
#if COCOS2D_DEBUG
|
||||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
|
||||
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN,LOG_TAG,__VA_ARGS__)
|
||||
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
|
||||
#else
|
||||
#define LOGD(...)
|
||||
#define LOGW(...)
|
||||
#define LOGE(...)
|
||||
#endif
|
||||
|
||||
static std::string __gameRootPath;
|
||||
static std::unordered_map<std::string, bool> __fileExistsCaches;
|
||||
static bool __isCocosPlayInited = false;
|
||||
static bool __isCocosPlayEnabled = false;
|
||||
static bool __isDemo = false;
|
||||
static bool __isNotifyFileLoadedEnabled = false;
|
||||
static jobject __classLoader;
|
||||
static jmethodID __findClassMethod;
|
||||
static pthread_key_t __threadKey;
|
||||
|
||||
|
||||
#define COCOSPLAYCLIENT_CLASS_NAME "com/chukong/cocosplay/client/CocosPlayClient"
|
||||
|
||||
extern "C" {
|
||||
jobjectArray Java_com_chukong_cocosplay_client_CocosPlayClient_getSearchPaths(JNIEnv* env, jobject thiz)
|
||||
{
|
||||
auto stringClass = env->FindClass("java/lang/String");
|
||||
auto& paths = cocos2d::FileUtils::getInstance()->getSearchPaths();
|
||||
auto count = paths.size();
|
||||
auto pathArray = env->NewObjectArray(count, stringClass, 0);
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
env->SetObjectArrayElement(pathArray, i, env->NewStringUTF(paths[i].c_str()));
|
||||
}
|
||||
|
||||
return pathArray;
|
||||
}
|
||||
}
|
||||
|
||||
namespace cocosplay {
|
||||
|
||||
static void detachCurrentThread(void *env) {
|
||||
JniHelper::getJavaVM()->DetachCurrentThread();
|
||||
}
|
||||
|
||||
static bool getEnv(JNIEnv **env)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
switch(JniHelper::getJavaVM()->GetEnv((void**)env, JNI_VERSION_1_4))
|
||||
{
|
||||
case JNI_OK:
|
||||
bRet = true;
|
||||
break;
|
||||
case JNI_EDETACHED:
|
||||
pthread_key_create (&__threadKey, detachCurrentThread);
|
||||
if (JniHelper::getJavaVM()->AttachCurrentThread(env, 0) < 0)
|
||||
{
|
||||
LOGD("%s", "Failed to get the environment using AttachCurrentThread()");
|
||||
break;
|
||||
}
|
||||
if (pthread_getspecific(__threadKey) == NULL) {
|
||||
pthread_setspecific(__threadKey, env);
|
||||
}
|
||||
bRet = true;
|
||||
break;
|
||||
default:
|
||||
LOGE("%s", "Failed to get the environment using GetEnv()");
|
||||
break;
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
static void initClassLoaderForMultiThread()
|
||||
{
|
||||
JNIEnv *env = 0;
|
||||
do
|
||||
{
|
||||
if (! getEnv(&env))
|
||||
{
|
||||
break;
|
||||
}
|
||||
jclass cocos2dClass = env->FindClass(COCOSPLAYCLIENT_CLASS_NAME);
|
||||
if(env->ExceptionCheck())
|
||||
{
|
||||
env->ExceptionDescribe();
|
||||
env->ExceptionClear();
|
||||
LOGW("Exception initClassLoaderForMultiThread cocos2dClass is exception");
|
||||
break;
|
||||
}
|
||||
|
||||
jclass classClass = env->GetObjectClass(cocos2dClass);
|
||||
if(env->ExceptionCheck())
|
||||
{
|
||||
env->ExceptionDescribe();
|
||||
env->ExceptionClear();
|
||||
LOGW("Exception initClassLoaderForMultiThread classClass is exception");
|
||||
break;
|
||||
}
|
||||
|
||||
jclass classLoaderClass = env->FindClass("java/lang/ClassLoader");
|
||||
if(env->ExceptionCheck())
|
||||
{
|
||||
env->ExceptionDescribe();
|
||||
env->ExceptionClear();
|
||||
LOGW("Exception initClassLoaderForMultiThread classLoaderClass");
|
||||
break;
|
||||
}
|
||||
|
||||
jmethodID getClassLoaderMethod = env->GetMethodID(classClass,"getClassLoader","()Ljava/lang/ClassLoader;");
|
||||
jobject classLoader = env->CallObjectMethod(cocos2dClass, getClassLoaderMethod);
|
||||
if(env->ExceptionCheck())
|
||||
{
|
||||
env->ExceptionDescribe();
|
||||
env->ExceptionClear();
|
||||
LOGW("Exception initClassLoaderForMultiThread classLoader");
|
||||
break;
|
||||
}
|
||||
__classLoader = env->NewGlobalRef(classLoader);
|
||||
jmethodID findClassMethod = env->GetMethodID(classLoaderClass, "findClass", "(Ljava/lang/String;)Ljava/lang/Class;");
|
||||
__findClassMethod = findClassMethod;
|
||||
|
||||
if(env->ExceptionCheck())
|
||||
{
|
||||
env->ExceptionDescribe();
|
||||
env->ExceptionClear();
|
||||
__findClassMethod = NULL;
|
||||
__classLoader = NULL;
|
||||
LOGW("Exception initClassLoaderForMultiThread findClassMethod");
|
||||
break;
|
||||
}
|
||||
}while(0);
|
||||
}
|
||||
|
||||
static jclass getClassID_(const char *className, JNIEnv *env)
|
||||
{
|
||||
JNIEnv *pEnv = env;
|
||||
jclass ret = 0;
|
||||
|
||||
do
|
||||
{
|
||||
if (! pEnv)
|
||||
{
|
||||
if (! getEnv(&pEnv))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ret = pEnv->FindClass(className);
|
||||
if (! ret)
|
||||
{
|
||||
if(__classLoader)
|
||||
{
|
||||
pEnv->ExceptionClear();
|
||||
jstring jstrName = (pEnv)->NewStringUTF(className);
|
||||
ret = (jclass)pEnv->CallObjectMethod(__classLoader, __findClassMethod, jstrName);
|
||||
pEnv->DeleteLocalRef(jstrName);
|
||||
if(ret) break;
|
||||
}
|
||||
|
||||
LOGE("Failed to find class of %s", className);
|
||||
break;
|
||||
}
|
||||
} while (0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool getStaticMethodInfo(cocos2d::JniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode)
|
||||
{
|
||||
jmethodID methodID = 0;
|
||||
JNIEnv *pEnv = 0;
|
||||
bool bRet = false;
|
||||
|
||||
do
|
||||
{
|
||||
if (! getEnv(&pEnv))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
jclass classID = getClassID_(className, pEnv);
|
||||
if(!classID) break;
|
||||
|
||||
methodID = pEnv->GetStaticMethodID(classID, methodName, paramCode);
|
||||
if (! methodID)
|
||||
{
|
||||
LOGW("Failed to find static method id of %s", methodName);
|
||||
break;
|
||||
}
|
||||
|
||||
methodinfo.classID = classID;
|
||||
methodinfo.env = pEnv;
|
||||
methodinfo.methodID = methodID;
|
||||
|
||||
bRet = true;
|
||||
} while (0);
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
void lazyInit()
|
||||
{
|
||||
if (__isCocosPlayInited)
|
||||
return;
|
||||
|
||||
JniMethodInfo t;
|
||||
if (JniHelper::getStaticMethodInfo(t, COCOSPLAYCLIENT_CLASS_NAME, "isEnabled", "()Z"))
|
||||
{
|
||||
__isCocosPlayEnabled = t.env->CallStaticBooleanMethod(t.classID, t.methodID);
|
||||
t.env->DeleteLocalRef(t.classID);
|
||||
LOGD("isEnabled = %d", __isCocosPlayEnabled);
|
||||
}
|
||||
|
||||
if (JniHelper::getStaticMethodInfo(t, COCOSPLAYCLIENT_CLASS_NAME, "isDemo", "()Z"))
|
||||
{
|
||||
__isDemo = t.env->CallStaticBooleanMethod(t.classID, t.methodID);
|
||||
t.env->DeleteLocalRef(t.classID);
|
||||
LOGD("isDemo = %d",__isDemo);
|
||||
}
|
||||
|
||||
if (JniHelper::getStaticMethodInfo(t, COCOSPLAYCLIENT_CLASS_NAME, "isNotifyFileLoadedEnabled", "()Z"))
|
||||
{
|
||||
__isNotifyFileLoadedEnabled = t.env->CallStaticBooleanMethod(t.classID, t.methodID);
|
||||
t.env->DeleteLocalRef(t.classID);
|
||||
LOGD("isNotifyFileLoadedEnabled = %d", __isNotifyFileLoadedEnabled);
|
||||
}
|
||||
|
||||
if (__isCocosPlayEnabled)
|
||||
{
|
||||
initClassLoaderForMultiThread();
|
||||
}
|
||||
|
||||
__isCocosPlayInited = true;
|
||||
}
|
||||
|
||||
bool isEnabled()
|
||||
{
|
||||
return __isCocosPlayEnabled;
|
||||
}
|
||||
|
||||
bool isDemo()
|
||||
{
|
||||
return __isDemo;
|
||||
}
|
||||
|
||||
void updateAssets(const std::string& filePath)
|
||||
{
|
||||
if (!__isCocosPlayInited)
|
||||
{
|
||||
lazyInit();
|
||||
}
|
||||
|
||||
if (!__isCocosPlayEnabled || __isDemo)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fileExists(filePath))
|
||||
{
|
||||
LOGD("file ( %s ) doesn't exist, updateAssets cancelled", filePath.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
JniMethodInfo t;
|
||||
if (getStaticMethodInfo(t, COCOSPLAYCLIENT_CLASS_NAME, "updateAssets", "(Ljava/lang/String;)V"))
|
||||
{
|
||||
jstring stringArg = t.env->NewStringUTF(filePath.c_str());
|
||||
t.env->CallStaticVoidMethod(t.classID, t.methodID, stringArg);
|
||||
t.env->DeleteLocalRef(stringArg);
|
||||
t.env->DeleteLocalRef(t.classID);
|
||||
}
|
||||
|
||||
LOGD("updateAssets (%s) OK!", filePath.c_str());
|
||||
}
|
||||
|
||||
bool fileExists(const std::string& filePath)
|
||||
{
|
||||
auto iter = __fileExistsCaches.find(filePath);
|
||||
if (iter != __fileExistsCaches.end())
|
||||
{
|
||||
LOGD("Return file path ( %s ) in cache!", filePath.c_str());
|
||||
if(!iter->second)
|
||||
{
|
||||
auto fp = fopen(filePath.c_str(), "r");
|
||||
if (fp)
|
||||
{
|
||||
iter->second = true;
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
bool ret = false;
|
||||
JniMethodInfo t;
|
||||
if (getStaticMethodInfo(t, COCOSPLAYCLIENT_CLASS_NAME, "fileExists", "(Ljava/lang/String;)Z"))
|
||||
{
|
||||
jstring stringArg = t.env->NewStringUTF(filePath.c_str());
|
||||
ret = t.env->CallStaticBooleanMethod(t.classID, t.methodID, stringArg);
|
||||
t.env->DeleteLocalRef(stringArg);
|
||||
t.env->DeleteLocalRef(t.classID);
|
||||
}
|
||||
|
||||
__fileExistsCaches[filePath] = ret;
|
||||
|
||||
LOGD("fileExists return (%d), path (%s)!", ret, filePath.c_str());
|
||||
return ret;
|
||||
}
|
||||
|
||||
void notifyFileLoaded(const std::string& filePath)
|
||||
{
|
||||
if (!__isNotifyFileLoadedEnabled)
|
||||
return;
|
||||
|
||||
JniMethodInfo t;
|
||||
if (getStaticMethodInfo(t, COCOSPLAYCLIENT_CLASS_NAME, "notifyFileLoaded", "(Ljava/lang/String;)V"))
|
||||
{
|
||||
jstring stringArg = t.env->NewStringUTF(filePath.c_str());
|
||||
t.env->CallStaticVoidMethod(t.classID, t.methodID, stringArg);
|
||||
t.env->DeleteLocalRef(stringArg);
|
||||
t.env->DeleteLocalRef(t.classID);
|
||||
}
|
||||
}
|
||||
|
||||
std::string getGameRoot()
|
||||
{
|
||||
if (!__isCocosPlayEnabled)
|
||||
{
|
||||
LOGW("CocosPlayClient isn't enabled!");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (__gameRootPath.empty())
|
||||
{
|
||||
JniMethodInfo t;
|
||||
if (JniHelper::getStaticMethodInfo(t, COCOSPLAYCLIENT_CLASS_NAME, "getGameRoot", "()Ljava/lang/String;"))
|
||||
{
|
||||
jstring str = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID);
|
||||
__gameRootPath = JniHelper::jstring2string(str);
|
||||
t.env->DeleteLocalRef(str);
|
||||
t.env->DeleteLocalRef(t.classID);
|
||||
}
|
||||
LOGD("GameRoot : %s", __gameRootPath.c_str());
|
||||
}
|
||||
return __gameRootPath;
|
||||
}
|
||||
|
||||
void purgeCachedEntries()
|
||||
{
|
||||
__fileExistsCaches.clear();
|
||||
}
|
||||
|
||||
void purgeCachedByFile(const std::string& filePath)
|
||||
{
|
||||
__fileExistsCaches.erase(filePath);
|
||||
}
|
||||
|
||||
void notifyDemoEnded()
|
||||
{
|
||||
JniMethodInfo t;
|
||||
if (JniHelper::getStaticMethodInfo(t, COCOSPLAYCLIENT_CLASS_NAME, "notifyDemoEnded", "()V"))
|
||||
{
|
||||
t.env->CallStaticVoidMethod(t.classID, t.methodID);
|
||||
t.env->DeleteLocalRef(t.classID);
|
||||
LOGD("Game demo was ended!");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace cocosplay {
|
||||
|
||||
#else
|
||||
|
||||
namespace cocosplay {
|
||||
|
||||
bool isEnabled() { return false; }
|
||||
bool isDemo() { return false; }
|
||||
void updateAssets(const std::string& filePath) {}
|
||||
bool fileExists(const std::string& filePath) { return false; }
|
||||
void notifyFileLoaded(const std::string& filePath) {}
|
||||
std::string getGameRoot() { return ""; }
|
||||
void purgeCachedEntries() {}
|
||||
void notifyDemoEnded() {}
|
||||
void purgeCachedByFile(const std::string& filePath){}
|
||||
} // namespace cocosplay {
|
||||
|
||||
#endif
|
|
@ -1,86 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2015 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.
|
||||
****************************************************************************/
|
||||
#ifndef __COCOSPLAYCLIENT_H__
|
||||
#define __COCOSPLAYCLIENT_H__
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace cocosplay {
|
||||
|
||||
void lazyInit();
|
||||
|
||||
/**
|
||||
* Checks whether CocosPlay is enabled
|
||||
*/
|
||||
bool isEnabled();
|
||||
|
||||
/**
|
||||
* Checks whether CocosPlay is in demo mode
|
||||
*/
|
||||
bool isDemo();
|
||||
|
||||
/**
|
||||
* Updates assets by filePath, if the file doesn't exist, CocosPlay will show a progress page of downloading.
|
||||
* And this interface will be hung up until the scene package was downloaded.
|
||||
*/
|
||||
void updateAssets(const std::string& filePath);
|
||||
|
||||
/**
|
||||
* Checks whether the file exists
|
||||
*/
|
||||
bool fileExists(const std::string& filePath);
|
||||
|
||||
/**
|
||||
* Notifies to Cocos Play SDK that a file was loaded
|
||||
* It will do nothing if game doesn't run on Cocos Play
|
||||
*/
|
||||
void notifyFileLoaded(const std::string& filePath);
|
||||
|
||||
/**
|
||||
* Gets the resource root path of current game
|
||||
* @return A writable path of current game
|
||||
*/
|
||||
std::string getGameRoot();
|
||||
|
||||
/**
|
||||
* Purges the file searching cache.
|
||||
*
|
||||
* @note It should be invoked after the resources were updated.
|
||||
* For instance, it could be used when there is a small update in games.
|
||||
*/
|
||||
void purgeCachedEntries();
|
||||
|
||||
/**
|
||||
* Purges the file searching cache by giving file path.
|
||||
*/
|
||||
void purgeCachedByFile(const std::string& filePath);
|
||||
|
||||
/**
|
||||
* Notifies that the game demo was ended
|
||||
*/
|
||||
void notifyDemoEnded();
|
||||
|
||||
} // namespace cocosplay {
|
||||
|
||||
#endif // __COCOSPLAYCLIENT_H__
|
|
@ -301,7 +301,7 @@ GLViewImpl::~GLViewImpl()
|
|||
GLViewImpl* GLViewImpl::create(const std::string& viewName)
|
||||
{
|
||||
auto ret = new (std::nothrow) GLViewImpl;
|
||||
if(ret && ret->initWithRect(viewName, Rect(0, 0, 960, 640), 1)) {
|
||||
if(ret && ret->initWithRect(viewName, Rect(0, 0, 960, 640), 1.0f, false)) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
|
@ -309,10 +309,10 @@ GLViewImpl* GLViewImpl::create(const std::string& viewName)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
GLViewImpl* GLViewImpl::createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
|
||||
GLViewImpl* GLViewImpl::createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor, bool resizable)
|
||||
{
|
||||
auto ret = new (std::nothrow) GLViewImpl;
|
||||
if(ret && ret->initWithRect(viewName, rect, frameZoomFactor)) {
|
||||
if(ret && ret->initWithRect(viewName, rect, frameZoomFactor, resizable)) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
|
@ -342,13 +342,13 @@ GLViewImpl* GLViewImpl::createWithFullScreen(const std::string& viewName, const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
|
||||
bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor, bool resizable)
|
||||
{
|
||||
setViewName(viewName);
|
||||
|
||||
_frameZoomFactor = frameZoomFactor;
|
||||
|
||||
glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
|
||||
glfwWindowHint(GLFW_RESIZABLE,resizable?GL_TRUE:GL_FALSE);
|
||||
glfwWindowHint(GLFW_RED_BITS,_glContextAttrs.redBits);
|
||||
glfwWindowHint(GLFW_GREEN_BITS,_glContextAttrs.greenBits);
|
||||
glfwWindowHint(GLFW_BLUE_BITS,_glContextAttrs.blueBits);
|
||||
|
@ -438,7 +438,7 @@ bool GLViewImpl::initWithFullScreen(const std::string& viewName)
|
|||
return false;
|
||||
|
||||
const GLFWvidmode* videoMode = glfwGetVideoMode(_monitor);
|
||||
return initWithRect(viewName, Rect(0, 0, videoMode->width, videoMode->height), 1.0f);
|
||||
return initWithRect(viewName, Rect(0, 0, videoMode->width, videoMode->height), 1.0f, false);
|
||||
}
|
||||
|
||||
bool GLViewImpl::initWithFullscreen(const std::string &viewname, const GLFWvidmode &videoMode, GLFWmonitor *monitor)
|
||||
|
@ -454,7 +454,7 @@ bool GLViewImpl::initWithFullscreen(const std::string &viewname, const GLFWvidmo
|
|||
glfwWindowHint(GLFW_BLUE_BITS, videoMode.blueBits);
|
||||
glfwWindowHint(GLFW_GREEN_BITS, videoMode.greenBits);
|
||||
|
||||
return initWithRect(viewname, Rect(0, 0, videoMode.width, videoMode.height), 1.0f);
|
||||
return initWithRect(viewname, Rect(0, 0, videoMode.width, videoMode.height), 1.0f, false);
|
||||
}
|
||||
|
||||
bool GLViewImpl::isOpenGLReady()
|
||||
|
@ -780,11 +780,12 @@ void GLViewImpl::onGLFWframebuffersize(GLFWwindow* window, int w, int h)
|
|||
|
||||
void GLViewImpl::onGLFWWindowSizeFunCallback(GLFWwindow *window, int width, int height)
|
||||
{
|
||||
if (_resolutionPolicy != ResolutionPolicy::UNKNOWN)
|
||||
{
|
||||
int frameWidth = width / _frameZoomFactor;
|
||||
int frameHeight = height / _frameZoomFactor;
|
||||
setFrameSize(frameWidth, frameHeight);
|
||||
|
||||
updateDesignResolutionSize();
|
||||
Director::getInstance()->setViewport();
|
||||
}
|
||||
}
|
||||
|
||||
void GLViewImpl::onGLFWWindowIconifyCallback(GLFWwindow* window, int iconified)
|
||||
|
|
|
@ -57,7 +57,7 @@ class CC_DLL GLViewImpl : public GLView
|
|||
{
|
||||
public:
|
||||
static GLViewImpl* create(const std::string& viewName);
|
||||
static GLViewImpl* createWithRect(const std::string& viewName, Rect size, float frameZoomFactor = 1.0f);
|
||||
static GLViewImpl* createWithRect(const std::string& viewName, Rect size, float frameZoomFactor = 1.0f, bool resizable = false);
|
||||
static GLViewImpl* createWithFullScreen(const std::string& viewName);
|
||||
static GLViewImpl* createWithFullScreen(const std::string& viewName, const GLFWvidmode &videoMode, GLFWmonitor *monitor);
|
||||
|
||||
|
@ -115,7 +115,7 @@ protected:
|
|||
GLViewImpl(bool initglfw = true);
|
||||
virtual ~GLViewImpl();
|
||||
|
||||
bool initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor);
|
||||
bool initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor, bool resizable);
|
||||
bool initWithFullScreen(const std::string& viewName);
|
||||
bool initWithFullscreen(const std::string& viewname, const GLFWvidmode &videoMode, GLFWmonitor *monitor);
|
||||
|
||||
|
|
|
@ -427,7 +427,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
|||
ids[i] = touch;
|
||||
xs[i] = [touch locationInView: [touch view]].x * self.contentScaleFactor;;
|
||||
ys[i] = [touch locationInView: [touch view]].y * self.contentScaleFactor;;
|
||||
#ifdef __IPHONE_9_0 && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0
|
||||
#if defined(__IPHONE_9_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0)
|
||||
// running on iOS 9.0 or higher version
|
||||
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0f) {
|
||||
fs[i] = touch.force;
|
||||
|
|
|
@ -31,6 +31,7 @@ THE SOFTWARE.
|
|||
#include <algorithm>
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include <shellapi.h>
|
||||
#include <WinVer.h>
|
||||
/**
|
||||
@brief This function change the PVRFrame show/hide setting in register.
|
||||
@param bEnable If true show the PVRFrame window, otherwise hide.
|
||||
|
@ -219,7 +220,43 @@ Application::Platform Application::getTargetPlatform()
|
|||
|
||||
std::string Application::getVersion()
|
||||
{
|
||||
return "";
|
||||
char verString[256] = { 0 };
|
||||
TCHAR szVersionFile[MAX_PATH];
|
||||
GetModuleFileName(NULL, szVersionFile, MAX_PATH);
|
||||
DWORD verHandle = NULL;
|
||||
UINT size = 0;
|
||||
LPBYTE lpBuffer = NULL;
|
||||
DWORD verSize = GetFileVersionInfoSize(szVersionFile, &verHandle);
|
||||
|
||||
if (verSize != NULL)
|
||||
{
|
||||
LPSTR verData = new char[verSize];
|
||||
|
||||
if (GetFileVersionInfo(szVersionFile, verHandle, verSize, verData))
|
||||
{
|
||||
if (VerQueryValue(verData, L"\\", (VOID FAR* FAR*)&lpBuffer, &size))
|
||||
{
|
||||
if (size)
|
||||
{
|
||||
VS_FIXEDFILEINFO *verInfo = (VS_FIXEDFILEINFO *)lpBuffer;
|
||||
if (verInfo->dwSignature == 0xfeef04bd)
|
||||
{
|
||||
|
||||
// Doesn't matter if you are on 32 bit or 64 bit,
|
||||
// DWORD is always 32 bits, so first two revision numbers
|
||||
// come from dwFileVersionMS, last two come from dwFileVersionLS
|
||||
sprintf(verString, "%d.%d.%d.%d", (verInfo->dwFileVersionMS >> 16) & 0xffff,
|
||||
(verInfo->dwFileVersionMS >> 0) & 0xffff,
|
||||
(verInfo->dwFileVersionLS >> 16) & 0xffff,
|
||||
(verInfo->dwFileVersionLS >> 0) & 0xffff
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
delete[] verData;
|
||||
}
|
||||
return verString;
|
||||
}
|
||||
|
||||
bool Application::openURL(const std::string &url)
|
||||
|
|
|
@ -129,6 +129,19 @@ std::string CCFileUtilsWinRT::getSuitableFOpen(const std::string& filenameUtf8)
|
|||
return UTF8StringToMultiByte(filenameUtf8);
|
||||
}
|
||||
|
||||
long CCFileUtilsWinRT::getFileSize(const std::string &filepath)
|
||||
{
|
||||
WIN32_FILE_ATTRIBUTE_DATA fad;
|
||||
if (!GetFileAttributesEx(StringUtf8ToWideChar(filepath).c_str(), GetFileExInfoStandard, &fad))
|
||||
{
|
||||
return 0; // error condition, could call GetLastError to find out more
|
||||
}
|
||||
LARGE_INTEGER size;
|
||||
size.HighPart = fad.nFileSizeHigh;
|
||||
size.LowPart = fad.nFileSizeLow;
|
||||
return (long)size.QuadPart;
|
||||
}
|
||||
|
||||
bool CCFileUtilsWinRT::isFileExistInternal(const std::string& strFilePath) const
|
||||
{
|
||||
bool ret = false;
|
||||
|
|
|
@ -53,6 +53,7 @@ public:
|
|||
virtual std::string getFullPathForDirectoryAndFilename(const std::string& strDirectory, const std::string& strFilename) const override;
|
||||
virtual std::string getStringFromFile(const std::string& filename) override;
|
||||
virtual std::string getSuitableFOpen(const std::string& filenameUtf8) const override;
|
||||
virtual long getFileSize(const std::string &filepath);
|
||||
static std::string getAppPath();
|
||||
|
||||
private:
|
||||
|
|
|
@ -105,10 +105,6 @@ bool Material::initWithGLProgramState(cocos2d::GLProgramState *state)
|
|||
|
||||
bool Material::initWithFile(const std::string& validfilename)
|
||||
{
|
||||
Data data = FileUtils::getInstance()->getDataFromFile(validfilename);
|
||||
char* bytes = (char*)data.getBytes();
|
||||
bytes[data.getSize()-1]='\0';
|
||||
|
||||
// Warning: properties is not a "Ref" object, must be manually deleted
|
||||
Properties* properties = Properties::createNonRefCounted(validfilename);
|
||||
|
||||
|
|
|
@ -6155,6 +6155,16 @@ supportsPVRTC : function (
|
|||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method supportsOESDepth24
|
||||
* @return {bool}
|
||||
*/
|
||||
supportsOESDepth24 : function (
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getMaxModelviewStackDepth
|
||||
* @return {int}
|
||||
|
@ -6319,6 +6329,16 @@ supportsDiscardFramebuffer : function (
|
|||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method supportsOESPackedDepthStencil
|
||||
* @return {bool}
|
||||
*/
|
||||
supportsOESPackedDepthStencil : function (
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method supportsS3TC
|
||||
* @return {bool}
|
||||
|
@ -12151,6 +12171,16 @@ getShadowOffset : function (
|
|||
return cc.Size;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getLineSpacing
|
||||
* @return {float}
|
||||
*/
|
||||
getLineSpacing : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setClipMarginEnabled
|
||||
* @param {bool} arg0
|
||||
|
@ -12181,6 +12211,16 @@ str
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method isWrapEnabled
|
||||
* @return {bool}
|
||||
*/
|
||||
isWrapEnabled : function (
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getOutlineSize
|
||||
* @return {int}
|
||||
|
@ -12260,13 +12300,11 @@ overflow
|
|||
},
|
||||
|
||||
/**
|
||||
* @method getLineSpacing
|
||||
* @return {float}
|
||||
* @method enableStrikethrough
|
||||
*/
|
||||
getLineSpacing : function (
|
||||
enableStrikethrough : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -12448,13 +12486,11 @@ getTTFConfig : function (
|
|||
},
|
||||
|
||||
/**
|
||||
* @method getVerticalAlignment
|
||||
* @return {cc.TextVAlignment}
|
||||
* @method enableItalics
|
||||
*/
|
||||
getVerticalAlignment : function (
|
||||
enableItalics : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -12519,6 +12555,16 @@ getOverflow : function (
|
|||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getVerticalAlignment
|
||||
* @return {cc.TextVAlignment}
|
||||
*/
|
||||
getVerticalAlignment : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setAdditionalKerning
|
||||
* @param {float} arg0
|
||||
|
@ -12580,13 +12626,19 @@ texthalignment
|
|||
},
|
||||
|
||||
/**
|
||||
* @method isWrapEnabled
|
||||
* @return {bool}
|
||||
* @method enableBold
|
||||
*/
|
||||
isWrapEnabled : function (
|
||||
enableBold : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method enableUnderline
|
||||
*/
|
||||
enableUnderline : function (
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -15363,6 +15415,14 @@ vec2
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method stop
|
||||
*/
|
||||
stop : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method updateParticleQuads
|
||||
*/
|
||||
|
@ -15421,6 +15481,14 @@ bool
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method start
|
||||
*/
|
||||
start : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setEndSizeVar
|
||||
* @param {float} arg0
|
||||
|
|
|
@ -2617,6 +2617,14 @@ end : function (
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method start
|
||||
*/
|
||||
start : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method stopBackgroundMusic
|
||||
* @param {bool} bool
|
||||
|
@ -2693,6 +2701,14 @@ bool
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method stop
|
||||
*/
|
||||
stop : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method playEffect
|
||||
* @param {char|char} char
|
||||
|
@ -4241,6 +4257,14 @@ pause : function (
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method start
|
||||
*/
|
||||
start : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method init
|
||||
* @return {bool}
|
||||
|
|
|
@ -3233,6 +3233,26 @@ jumpToBottomRight : function (
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setTouchTotalTimeThreshold
|
||||
* @param {float} arg0
|
||||
*/
|
||||
setTouchTotalTimeThreshold : function (
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getTouchTotalTimeThreshold
|
||||
* @return {float}
|
||||
*/
|
||||
getTouchTotalTimeThreshold : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getScrollBarPositionFromCornerForHorizontal
|
||||
* @return {vec2_object}
|
||||
|
@ -5314,6 +5334,8 @@ ccui.RichElementText = {
|
|||
* @param {String} arg3
|
||||
* @param {String} arg4
|
||||
* @param {float} arg5
|
||||
* @param {unsigned int} arg6
|
||||
* @param {String} arg7
|
||||
* @return {bool}
|
||||
*/
|
||||
init : function (
|
||||
|
@ -5322,7 +5344,9 @@ color3b,
|
|||
char,
|
||||
str,
|
||||
str,
|
||||
float
|
||||
float,
|
||||
int,
|
||||
str
|
||||
)
|
||||
{
|
||||
return false;
|
||||
|
@ -5336,6 +5360,8 @@ float
|
|||
* @param {String} arg3
|
||||
* @param {String} arg4
|
||||
* @param {float} arg5
|
||||
* @param {unsigned int} arg6
|
||||
* @param {String} arg7
|
||||
* @return {ccui.RichElementText}
|
||||
*/
|
||||
create : function (
|
||||
|
@ -5344,7 +5370,9 @@ color3b,
|
|||
char,
|
||||
str,
|
||||
str,
|
||||
float
|
||||
float,
|
||||
int,
|
||||
str
|
||||
)
|
||||
{
|
||||
return ccui.RichElementText;
|
||||
|
@ -5366,6 +5394,16 @@ RichElementText : function (
|
|||
*/
|
||||
ccui.RichElementImage = {
|
||||
|
||||
/**
|
||||
* @method setHeight
|
||||
* @param {int} arg0
|
||||
*/
|
||||
setHeight : function (
|
||||
int
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method init
|
||||
* @param {int} arg0
|
||||
|
@ -5384,6 +5422,16 @@ str
|
|||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setWidth
|
||||
* @param {int} arg0
|
||||
*/
|
||||
setWidth : function (
|
||||
int
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method create
|
||||
* @param {int} arg0
|
||||
|
@ -5492,6 +5540,16 @@ richelement
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setWrapMode
|
||||
* @param {ccui.RichText::WrapMode} arg0
|
||||
*/
|
||||
setWrapMode : function (
|
||||
wrapmode
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setVerticalSpace
|
||||
* @param {float} arg0
|
||||
|
@ -5502,6 +5560,16 @@ float
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getWrapMode
|
||||
* @return {ccui.RichText::WrapMode}
|
||||
*/
|
||||
getWrapMode : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method formatText
|
||||
*/
|
||||
|
@ -5510,6 +5578,18 @@ formatText : function (
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method initWithXML
|
||||
* @param {String} arg0
|
||||
* @return {bool}
|
||||
*/
|
||||
initWithXML : function (
|
||||
str
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method removeElement
|
||||
* @param {ccui.RichElement|int} richelement
|
||||
|
@ -5530,6 +5610,18 @@ create : function (
|
|||
return ccui.RichText;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method createWithXML
|
||||
* @param {String} arg0
|
||||
* @return {ccui.RichText}
|
||||
*/
|
||||
createWithXML : function (
|
||||
str
|
||||
)
|
||||
{
|
||||
return ccui.RichText;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method RichText
|
||||
* @constructor
|
||||
|
|
|
@ -16452,6 +16452,24 @@ bool js_cocos2dx_Configuration_supportsPVRTC(JSContext *cx, uint32_t argc, jsval
|
|||
JS_ReportError(cx, "js_cocos2dx_Configuration_supportsPVRTC : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Configuration_supportsOESDepth24(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsOESDepth24 : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
bool ret = cobj->supportsOESDepth24();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Configuration_supportsOESDepth24 : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Configuration_getMaxModelviewStackDepth(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -16750,6 +16768,24 @@ bool js_cocos2dx_Configuration_supportsDiscardFramebuffer(JSContext *cx, uint32_
|
|||
JS_ReportError(cx, "js_cocos2dx_Configuration_supportsDiscardFramebuffer : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Configuration_supportsOESPackedDepthStencil(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsOESPackedDepthStencil : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
bool ret = cobj->supportsOESPackedDepthStencil();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Configuration_supportsOESPackedDepthStencil : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Configuration_supportsS3TC(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -16902,6 +16938,7 @@ void js_register_cocos2dx_Configuration(JSContext *cx, JS::HandleObject global)
|
|||
|
||||
static JSFunctionSpec funcs[] = {
|
||||
JS_FN("supportsPVRTC", js_cocos2dx_Configuration_supportsPVRTC, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("supportsOESDepth24", js_cocos2dx_Configuration_supportsOESDepth24, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getMaxModelviewStackDepth", js_cocos2dx_Configuration_getMaxModelviewStackDepth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("supportsShareableVAO", js_cocos2dx_Configuration_supportsShareableVAO, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("supportsBGRA8888", js_cocos2dx_Configuration_supportsBGRA8888, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
|
@ -16918,6 +16955,7 @@ void js_register_cocos2dx_Configuration(JSContext *cx, JS::HandleObject global)
|
|||
JS_FN("getMaxSupportDirLightInShader", js_cocos2dx_Configuration_getMaxSupportDirLightInShader, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("loadConfigFile", js_cocos2dx_Configuration_loadConfigFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("supportsDiscardFramebuffer", js_cocos2dx_Configuration_supportsDiscardFramebuffer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("supportsOESPackedDepthStencil", js_cocos2dx_Configuration_supportsOESPackedDepthStencil, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("supportsS3TC", js_cocos2dx_Configuration_supportsS3TC, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("dumpInfo", js_cocos2dx_Configuration_getInfo, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getMaxTextureUnits", js_cocos2dx_Configuration_getMaxTextureUnits, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
|
@ -33144,6 +33182,24 @@ bool js_cocos2dx_Label_getShadowOffset(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
JS_ReportError(cx, "js_cocos2dx_Label_getShadowOffset : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_getLineSpacing(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getLineSpacing : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
double ret = cobj->getLineSpacing();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = DOUBLE_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Label_getLineSpacing : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_setClipMarginEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -33204,6 +33260,24 @@ bool js_cocos2dx_Label_setSystemFontName(JSContext *cx, uint32_t argc, jsval *vp
|
|||
JS_ReportError(cx, "js_cocos2dx_Label_setSystemFontName : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_isWrapEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_isWrapEnabled : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
bool ret = cobj->isWrapEnabled();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Label_isWrapEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_getOutlineSize(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -33498,22 +33572,20 @@ bool js_cocos2dx_Label_setOverflow(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
JS_ReportError(cx, "js_cocos2dx_Label_setOverflow : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_getLineSpacing(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
bool js_cocos2dx_Label_enableStrikethrough(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getLineSpacing : Invalid Native Object");
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_enableStrikethrough : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
double ret = cobj->getLineSpacing();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = DOUBLE_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
cobj->enableStrikethrough();
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Label_getLineSpacing : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
JS_ReportError(cx, "js_cocos2dx_Label_enableStrikethrough : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_updateContent(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
|
@ -33903,22 +33975,20 @@ bool js_cocos2dx_Label_getTTFConfig(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
JS_ReportError(cx, "js_cocos2dx_Label_getTTFConfig : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_getVerticalAlignment(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
bool js_cocos2dx_Label_enableItalics(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getVerticalAlignment : Invalid Native Object");
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_enableItalics : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
int ret = (int)cobj->getVerticalAlignment();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = int32_to_jsval(cx, ret);
|
||||
args.rval().set(jsret);
|
||||
cobj->enableItalics();
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Label_getVerticalAlignment : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
JS_ReportError(cx, "js_cocos2dx_Label_enableItalics : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_setTextColor(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
|
@ -34043,6 +34113,24 @@ bool js_cocos2dx_Label_getOverflow(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
JS_ReportError(cx, "js_cocos2dx_Label_getOverflow : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_getVerticalAlignment(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getVerticalAlignment : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
int ret = (int)cobj->getVerticalAlignment();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = int32_to_jsval(cx, ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Label_getVerticalAlignment : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_setAdditionalKerning(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -34157,22 +34245,36 @@ bool js_cocos2dx_Label_setHorizontalAlignment(JSContext *cx, uint32_t argc, jsva
|
|||
JS_ReportError(cx, "js_cocos2dx_Label_setHorizontalAlignment : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_isWrapEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
bool js_cocos2dx_Label_enableBold(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_isWrapEnabled : Invalid Native Object");
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_enableBold : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
bool ret = cobj->isWrapEnabled();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
cobj->enableBold();
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Label_isWrapEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
JS_ReportError(cx, "js_cocos2dx_Label_enableBold : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_enableUnderline(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_enableUnderline : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
cobj->enableUnderline();
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Label_enableUnderline : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_getLabelEffectType(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
|
@ -34587,16 +34689,18 @@ void js_register_cocos2dx_Label(JSContext *cx, JS::HandleObject global) {
|
|||
JS_FN("getMaxLineWidth", js_cocos2dx_Label_getMaxLineWidth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getHorizontalAlignment", js_cocos2dx_Label_getHorizontalAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getShadowOffset", js_cocos2dx_Label_getShadowOffset, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getLineSpacing", js_cocos2dx_Label_getLineSpacing, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setClipMarginEnabled", js_cocos2dx_Label_setClipMarginEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setString", js_cocos2dx_Label_setString, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setSystemFontName", js_cocos2dx_Label_setSystemFontName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("isWrapEnabled", js_cocos2dx_Label_isWrapEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getOutlineSize", js_cocos2dx_Label_getOutlineSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setBMFontFilePath", js_cocos2dx_Label_setBMFontFilePath, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("initWithTTF", js_cocos2dx_Label_initWithTTF, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setLineHeight", js_cocos2dx_Label_setLineHeight, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setSystemFontSize", js_cocos2dx_Label_setSystemFontSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setOverflow", js_cocos2dx_Label_setOverflow, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getLineSpacing", js_cocos2dx_Label_getLineSpacing, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("enableStrikethrough", js_cocos2dx_Label_enableStrikethrough, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("updateContent", js_cocos2dx_Label_updateContent, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getStringLength", js_cocos2dx_Label_getStringLength, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setLineBreakWithoutSpace", js_cocos2dx_Label_setLineBreakWithoutSpace, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
|
@ -34614,20 +34718,22 @@ void js_register_cocos2dx_Label(JSContext *cx, JS::HandleObject global) {
|
|||
JS_FN("getLineHeight", js_cocos2dx_Label_getLineHeight, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getShadowColor", js_cocos2dx_Label_getShadowColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getTTFConfig", js_cocos2dx_Label_getTTFConfig, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getVerticalAlignment", js_cocos2dx_Label_getVerticalAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("enableItalics", js_cocos2dx_Label_enableItalics, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setTextColor", js_cocos2dx_Label_setTextColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getLetter", js_cocos2dx_Label_getLetter, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setHeight", js_cocos2dx_Label_setHeight, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("isShadowEnabled", js_cocos2dx_Label_isShadowEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("enableGlow", js_cocos2dx_Label_enableGlow, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getOverflow", js_cocos2dx_Label_getOverflow, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getVerticalAlignment", js_cocos2dx_Label_getVerticalAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setAdditionalKerning", js_cocos2dx_Label_setAdditionalKerning, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getSystemFontSize", js_cocos2dx_Label_getSystemFontSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setBlendFunc", js_cocos2dx_Label_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getTextAlignment", js_cocos2dx_Label_getTextAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getBMFontFilePath", js_cocos2dx_Label_getBMFontFilePath, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setHorizontalAlignment", js_cocos2dx_Label_setHorizontalAlignment, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("isWrapEnabled", js_cocos2dx_Label_isWrapEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("enableBold", js_cocos2dx_Label_enableBold, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("enableUnderline", js_cocos2dx_Label_enableUnderline, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getLabelEffectType", js_cocos2dx_Label_getLabelEffectType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setAlignment", js_cocos2dx_Label_setAlignment, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("requestSystemFontRefresh", js_cocos2dx_Label_requestSystemFontRefresh, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
|
@ -41747,6 +41853,22 @@ bool js_cocos2dx_ParticleSystem_setSourcePosition(JSContext *cx, uint32_t argc,
|
|||
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setSourcePosition : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ParticleSystem_stop(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_stop : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
cobj->stop();
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_stop : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ParticleSystem_updateParticleQuads(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -41861,6 +41983,22 @@ bool js_cocos2dx_ParticleSystem_setRotationIsDir(JSContext *cx, uint32_t argc, j
|
|||
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setRotationIsDir : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ParticleSystem_start(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_start : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
cobj->start();
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_start : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ParticleSystem_setEndSizeVar(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -42738,12 +42876,14 @@ void js_register_cocos2dx_ParticleSystem(JSContext *cx, JS::HandleObject global)
|
|||
JS_FN("setEmitterMode", js_cocos2dx_ParticleSystem_setEmitterMode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getDuration", js_cocos2dx_ParticleSystem_getDuration, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setSourcePosition", js_cocos2dx_ParticleSystem_setSourcePosition, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("stop", js_cocos2dx_ParticleSystem_stop, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("updateParticleQuads", js_cocos2dx_ParticleSystem_updateParticleQuads, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getEndSpinVar", js_cocos2dx_ParticleSystem_getEndSpinVar, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setBlendAdditive", js_cocos2dx_ParticleSystem_setBlendAdditive, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setLife", js_cocos2dx_ParticleSystem_setLife, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setAngleVar", js_cocos2dx_ParticleSystem_setAngleVar, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setRotationIsDir", js_cocos2dx_ParticleSystem_setRotationIsDir, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("start", js_cocos2dx_ParticleSystem_start, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setEndSizeVar", js_cocos2dx_ParticleSystem_setEndSizeVar, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setAngle", js_cocos2dx_ParticleSystem_setAngle, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setBatchNode", js_cocos2dx_ParticleSystem_setBatchNode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
|
|
|
@ -950,6 +950,7 @@ void js_cocos2dx_Configuration_finalize(JSContext *cx, JSObject *obj);
|
|||
void js_register_cocos2dx_Configuration(JSContext *cx, JS::HandleObject global);
|
||||
void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj);
|
||||
bool js_cocos2dx_Configuration_supportsPVRTC(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Configuration_supportsOESDepth24(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Configuration_getMaxModelviewStackDepth(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Configuration_supportsShareableVAO(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Configuration_supportsBGRA8888(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
@ -966,6 +967,7 @@ bool js_cocos2dx_Configuration_supportsETC(JSContext *cx, uint32_t argc, jsval *
|
|||
bool js_cocos2dx_Configuration_getMaxSupportDirLightInShader(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Configuration_loadConfigFile(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Configuration_supportsDiscardFramebuffer(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Configuration_supportsOESPackedDepthStencil(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Configuration_supportsS3TC(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Configuration_getInfo(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Configuration_getMaxTextureUnits(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
@ -2239,16 +2241,18 @@ bool js_cocos2dx_Label_getBMFontSize(JSContext *cx, uint32_t argc, jsval *vp);
|
|||
bool js_cocos2dx_Label_getMaxLineWidth(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getHorizontalAlignment(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getShadowOffset(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getLineSpacing(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setClipMarginEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setString(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setSystemFontName(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_isWrapEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getOutlineSize(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setBMFontFilePath(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_initWithTTF(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setLineHeight(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setSystemFontSize(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setOverflow(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getLineSpacing(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_enableStrikethrough(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_updateContent(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getStringLength(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setLineBreakWithoutSpace(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
@ -2266,20 +2270,22 @@ bool js_cocos2dx_Label_setLineSpacing(JSContext *cx, uint32_t argc, jsval *vp);
|
|||
bool js_cocos2dx_Label_getLineHeight(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getShadowColor(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getTTFConfig(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getVerticalAlignment(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_enableItalics(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setTextColor(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getLetter(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setHeight(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_isShadowEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_enableGlow(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getOverflow(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getVerticalAlignment(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setAdditionalKerning(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getSystemFontSize(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getTextAlignment(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getBMFontFilePath(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setHorizontalAlignment(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_isWrapEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_enableBold(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_enableUnderline(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getLabelEffectType(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setAlignment(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_requestSystemFontRefresh(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
@ -2692,12 +2698,14 @@ bool js_cocos2dx_ParticleSystem_getRotatePerSecond(JSContext *cx, uint32_t argc,
|
|||
bool js_cocos2dx_ParticleSystem_setEmitterMode(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ParticleSystem_getDuration(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ParticleSystem_setSourcePosition(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ParticleSystem_stop(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ParticleSystem_updateParticleQuads(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ParticleSystem_getEndSpinVar(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ParticleSystem_setBlendAdditive(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ParticleSystem_setLife(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ParticleSystem_setAngleVar(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ParticleSystem_setRotationIsDir(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ParticleSystem_start(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ParticleSystem_setEndSizeVar(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ParticleSystem_setAngle(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ParticleSystem_setBatchNode(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
|
|
@ -6663,6 +6663,22 @@ bool js_cocos2dx_studio_ComAudio_end(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
JS_ReportError(cx, "js_cocos2dx_studio_ComAudio_end : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_studio_ComAudio_start(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocostudio::ComAudio* cobj = (cocostudio::ComAudio *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComAudio_start : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
cobj->start();
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_studio_ComAudio_start : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_studio_ComAudio_stopBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
|
@ -6845,6 +6861,22 @@ bool js_cocos2dx_studio_ComAudio_playBackgroundMusic(JSContext *cx, uint32_t arg
|
|||
JS_ReportError(cx, "js_cocos2dx_studio_ComAudio_playBackgroundMusic : wrong number of arguments");
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_studio_ComAudio_stop(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocostudio::ComAudio* cobj = (cocostudio::ComAudio *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComAudio_stop : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
cobj->stop();
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_studio_ComAudio_stop : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_studio_ComAudio_playEffect(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
|
@ -7147,6 +7179,7 @@ void js_register_cocos2dx_studio_ComAudio(JSContext *cx, JS::HandleObject global
|
|||
JS_FN("willPlayBackgroundMusic", js_cocos2dx_studio_ComAudio_willPlayBackgroundMusic, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setBackgroundMusicVolume", js_cocos2dx_studio_ComAudio_setBackgroundMusicVolume, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("end", js_cocos2dx_studio_ComAudio_end, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("start", js_cocos2dx_studio_ComAudio_start, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("stopBackgroundMusic", js_cocos2dx_studio_ComAudio_stopBackgroundMusic, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("pauseBackgroundMusic", js_cocos2dx_studio_ComAudio_pauseBackgroundMusic, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("isBackgroundMusicPlaying", js_cocos2dx_studio_ComAudio_isBackgroundMusicPlaying, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
|
@ -7155,6 +7188,7 @@ void js_register_cocos2dx_studio_ComAudio(JSContext *cx, JS::HandleObject global
|
|||
JS_FN("pauseAllEffects", js_cocos2dx_studio_ComAudio_pauseAllEffects, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("preloadBackgroundMusic", js_cocos2dx_studio_ComAudio_preloadBackgroundMusic, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("playBackgroundMusic", js_cocos2dx_studio_ComAudio_playBackgroundMusic, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("stop", js_cocos2dx_studio_ComAudio_stop, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("playEffect", js_cocos2dx_studio_ComAudio_playEffect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("preloadEffect", js_cocos2dx_studio_ComAudio_preloadEffect, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setLoop", js_cocos2dx_studio_ComAudio_setLoop, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
|
@ -10794,6 +10828,22 @@ bool js_cocos2dx_studio_ActionTimeline_pause(JSContext *cx, uint32_t argc, jsval
|
|||
JS_ReportError(cx, "js_cocos2dx_studio_ActionTimeline_pause : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_studio_ActionTimeline_start(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocostudio::timeline::ActionTimeline* cobj = (cocostudio::timeline::ActionTimeline *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionTimeline_start : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
cobj->start();
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_studio_ActionTimeline_start : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_studio_ActionTimeline_init(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -11423,6 +11473,7 @@ void js_register_cocos2dx_studio_ActionTimeline(JSContext *cx, JS::HandleObject
|
|||
JS_FN("getCurrentFrame", js_cocos2dx_studio_ActionTimeline_getCurrentFrame, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getStartFrame", js_cocos2dx_studio_ActionTimeline_getStartFrame, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("pause", js_cocos2dx_studio_ActionTimeline_pause, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("start", js_cocos2dx_studio_ActionTimeline_start, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("init", js_cocos2dx_studio_ActionTimeline_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("removeTimeline", js_cocos2dx_studio_ActionTimeline_removeTimeline, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setLastFrameCallFunc", js_cocos2dx_studio_ActionTimeline_setLastFrameCallFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
|
|
|
@ -413,6 +413,7 @@ bool js_cocos2dx_studio_ComAudio_getBackgroundMusicVolume(JSContext *cx, uint32_
|
|||
bool js_cocos2dx_studio_ComAudio_willPlayBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ComAudio_setBackgroundMusicVolume(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ComAudio_end(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ComAudio_start(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ComAudio_stopBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ComAudio_pauseBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ComAudio_isBackgroundMusicPlaying(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
@ -421,6 +422,7 @@ bool js_cocos2dx_studio_ComAudio_resumeAllEffects(JSContext *cx, uint32_t argc,
|
|||
bool js_cocos2dx_studio_ComAudio_pauseAllEffects(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ComAudio_preloadBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ComAudio_playBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ComAudio_stop(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ComAudio_playEffect(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ComAudio_preloadEffect(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ComAudio_setLoop(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
@ -730,6 +732,7 @@ bool js_cocos2dx_studio_ActionTimeline_addTimeline(JSContext *cx, uint32_t argc,
|
|||
bool js_cocos2dx_studio_ActionTimeline_getCurrentFrame(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ActionTimeline_getStartFrame(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ActionTimeline_pause(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ActionTimeline_start(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ActionTimeline_init(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ActionTimeline_removeTimeline(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ActionTimeline_setLastFrameCallFunc(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
|
|
@ -7981,6 +7981,44 @@ bool js_cocos2dx_ui_ScrollView_jumpToBottomRight(JSContext *cx, uint32_t argc, j
|
|||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_jumpToBottomRight : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_setTouchTotalTimeThreshold(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_setTouchTotalTimeThreshold : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
double arg0 = 0;
|
||||
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ScrollView_setTouchTotalTimeThreshold : Error processing arguments");
|
||||
cobj->setTouchTotalTimeThreshold(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_setTouchTotalTimeThreshold : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_getTouchTotalTimeThreshold(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_getTouchTotalTimeThreshold : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
double ret = cobj->getTouchTotalTimeThreshold();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = DOUBLE_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_getTouchTotalTimeThreshold : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForHorizontal(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -8486,6 +8524,8 @@ void js_register_cocos2dx_ui_ScrollView(JSContext *cx, JS::HandleObject global)
|
|||
JS_FN("jumpToTopLeft", js_cocos2dx_ui_ScrollView_jumpToTopLeft, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("jumpToPercentHorizontal", js_cocos2dx_ui_ScrollView_jumpToPercentHorizontal, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("jumpToBottomRight", js_cocos2dx_ui_ScrollView_jumpToBottomRight, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setTouchTotalTimeThreshold", js_cocos2dx_ui_ScrollView_setTouchTotalTimeThreshold, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getTouchTotalTimeThreshold", js_cocos2dx_ui_ScrollView_getTouchTotalTimeThreshold, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getScrollBarPositionFromCornerForHorizontal", js_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForHorizontal, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setScrollBarWidth", js_cocos2dx_ui_ScrollView_setScrollBarWidth, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setBounceEnabled", js_cocos2dx_ui_ScrollView_setBounceEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
|
@ -12908,28 +12948,32 @@ bool js_cocos2dx_ui_RichElementText_init(JSContext *cx, uint32_t argc, jsval *vp
|
|||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::RichElementText* cobj = (cocos2d::ui::RichElementText *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RichElementText_init : Invalid Native Object");
|
||||
if (argc == 6) {
|
||||
if (argc == 8) {
|
||||
int arg0 = 0;
|
||||
cocos2d::Color3B arg1;
|
||||
uint16_t arg2;
|
||||
std::string arg3;
|
||||
std::string arg4;
|
||||
double arg5 = 0;
|
||||
unsigned int arg6 = 0;
|
||||
std::string arg7;
|
||||
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
||||
ok &= jsval_to_cccolor3b(cx, args.get(1), &arg1);
|
||||
ok &= jsval_to_uint16(cx, args.get(2), &arg2);
|
||||
ok &= jsval_to_std_string(cx, args.get(3), &arg3);
|
||||
ok &= jsval_to_std_string(cx, args.get(4), &arg4);
|
||||
ok &= JS::ToNumber( cx, args.get(5), &arg5) && !isnan(arg5);
|
||||
ok &= jsval_to_uint32(cx, args.get(6), &arg6);
|
||||
ok &= jsval_to_std_string(cx, args.get(7), &arg7);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_RichElementText_init : Error processing arguments");
|
||||
bool ret = cobj->init(arg0, arg1, arg2, arg3, arg4, arg5);
|
||||
bool ret = cobj->init(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_RichElementText_init : wrong number of arguments: %d, was expecting %d", argc, 6);
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_RichElementText_init : wrong number of arguments: %d, was expecting %d", argc, 8);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_RichElementText_create(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
|
@ -12957,6 +13001,54 @@ bool js_cocos2dx_ui_RichElementText_create(JSContext *cx, uint32_t argc, jsval *
|
|||
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
||||
return true;
|
||||
}
|
||||
if (argc == 7) {
|
||||
int arg0 = 0;
|
||||
cocos2d::Color3B arg1;
|
||||
uint16_t arg2;
|
||||
std::string arg3;
|
||||
std::string arg4;
|
||||
double arg5 = 0;
|
||||
unsigned int arg6 = 0;
|
||||
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
||||
ok &= jsval_to_cccolor3b(cx, args.get(1), &arg1);
|
||||
ok &= jsval_to_uint16(cx, args.get(2), &arg2);
|
||||
ok &= jsval_to_std_string(cx, args.get(3), &arg3);
|
||||
ok &= jsval_to_std_string(cx, args.get(4), &arg4);
|
||||
ok &= JS::ToNumber( cx, args.get(5), &arg5) && !isnan(arg5);
|
||||
ok &= jsval_to_uint32(cx, args.get(6), &arg6);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_RichElementText_create : Error processing arguments");
|
||||
|
||||
auto ret = cocos2d::ui::RichElementText::create(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
|
||||
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ui::RichElementText>(ret);
|
||||
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ui::RichElementText"));
|
||||
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
||||
return true;
|
||||
}
|
||||
if (argc == 8) {
|
||||
int arg0 = 0;
|
||||
cocos2d::Color3B arg1;
|
||||
uint16_t arg2;
|
||||
std::string arg3;
|
||||
std::string arg4;
|
||||
double arg5 = 0;
|
||||
unsigned int arg6 = 0;
|
||||
std::string arg7;
|
||||
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
||||
ok &= jsval_to_cccolor3b(cx, args.get(1), &arg1);
|
||||
ok &= jsval_to_uint16(cx, args.get(2), &arg2);
|
||||
ok &= jsval_to_std_string(cx, args.get(3), &arg3);
|
||||
ok &= jsval_to_std_string(cx, args.get(4), &arg4);
|
||||
ok &= JS::ToNumber( cx, args.get(5), &arg5) && !isnan(arg5);
|
||||
ok &= jsval_to_uint32(cx, args.get(6), &arg6);
|
||||
ok &= jsval_to_std_string(cx, args.get(7), &arg7);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_RichElementText_create : Error processing arguments");
|
||||
|
||||
auto ret = cocos2d::ui::RichElementText::create(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
|
||||
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ui::RichElementText>(ret);
|
||||
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ui::RichElementText"));
|
||||
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
||||
return true;
|
||||
}
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_RichElementText_create : wrong number of arguments");
|
||||
return false;
|
||||
}
|
||||
|
@ -13013,7 +13105,7 @@ void js_register_cocos2dx_ui_RichElementText(JSContext *cx, JS::HandleObject glo
|
|||
};
|
||||
|
||||
static JSFunctionSpec funcs[] = {
|
||||
JS_FN("init", js_cocos2dx_ui_RichElementText_init, 6, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("init", js_cocos2dx_ui_RichElementText_init, 8, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("ctor", js_cocos2dx_ui_RichElementText_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FS_END
|
||||
};
|
||||
|
@ -13043,6 +13135,26 @@ void js_register_cocos2dx_ui_RichElementText(JSContext *cx, JS::HandleObject glo
|
|||
JSClass *jsb_cocos2d_ui_RichElementImage_class;
|
||||
JSObject *jsb_cocos2d_ui_RichElementImage_prototype;
|
||||
|
||||
bool js_cocos2dx_ui_RichElementImage_setHeight(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::RichElementImage* cobj = (cocos2d::ui::RichElementImage *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RichElementImage_setHeight : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
int arg0 = 0;
|
||||
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_RichElementImage_setHeight : Error processing arguments");
|
||||
cobj->setHeight(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_RichElementImage_setHeight : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_RichElementImage_init(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -13071,6 +13183,26 @@ bool js_cocos2dx_ui_RichElementImage_init(JSContext *cx, uint32_t argc, jsval *v
|
|||
JS_ReportError(cx, "js_cocos2dx_ui_RichElementImage_init : wrong number of arguments: %d, was expecting %d", argc, 4);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_RichElementImage_setWidth(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::RichElementImage* cobj = (cocos2d::ui::RichElementImage *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RichElementImage_setWidth : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
int arg0 = 0;
|
||||
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_RichElementImage_setWidth : Error processing arguments");
|
||||
cobj->setWidth(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_RichElementImage_setWidth : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_RichElementImage_create(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -13148,7 +13280,9 @@ void js_register_cocos2dx_ui_RichElementImage(JSContext *cx, JS::HandleObject gl
|
|||
};
|
||||
|
||||
static JSFunctionSpec funcs[] = {
|
||||
JS_FN("setHeight", js_cocos2dx_ui_RichElementImage_setHeight, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("init", js_cocos2dx_ui_RichElementImage_init, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setWidth", js_cocos2dx_ui_RichElementImage_setWidth, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("ctor", js_cocos2dx_ui_RichElementImage_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FS_END
|
||||
};
|
||||
|
@ -13387,6 +13521,26 @@ bool js_cocos2dx_ui_RichText_pushBackElement(JSContext *cx, uint32_t argc, jsval
|
|||
JS_ReportError(cx, "js_cocos2dx_ui_RichText_pushBackElement : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_RichText_setWrapMode(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::RichText* cobj = (cocos2d::ui::RichText *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RichText_setWrapMode : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
cocos2d::ui::RichText::WrapMode arg0;
|
||||
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_RichText_setWrapMode : Error processing arguments");
|
||||
cobj->setWrapMode(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_RichText_setWrapMode : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_RichText_setVerticalSpace(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -13407,6 +13561,24 @@ bool js_cocos2dx_ui_RichText_setVerticalSpace(JSContext *cx, uint32_t argc, jsva
|
|||
JS_ReportError(cx, "js_cocos2dx_ui_RichText_setVerticalSpace : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_RichText_getWrapMode(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::RichText* cobj = (cocos2d::ui::RichText *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RichText_getWrapMode : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
int ret = (int)cobj->getWrapMode();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = int32_to_jsval(cx, ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_RichText_getWrapMode : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_RichText_formatText(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -13423,6 +13595,28 @@ bool js_cocos2dx_ui_RichText_formatText(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
JS_ReportError(cx, "js_cocos2dx_ui_RichText_formatText : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_RichText_initWithXML(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::RichText* cobj = (cocos2d::ui::RichText *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RichText_initWithXML : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_RichText_initWithXML : Error processing arguments");
|
||||
bool ret = cobj->initWithXML(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_RichText_initWithXML : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_RichText_removeElement(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
|
@ -13482,6 +13676,25 @@ bool js_cocos2dx_ui_RichText_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_ui_RichText_createWithXML(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_RichText_createWithXML : Error processing arguments");
|
||||
|
||||
auto ret = cocos2d::ui::RichText::createWithXML(arg0);
|
||||
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ui::RichText>(ret);
|
||||
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ui::RichText"));
|
||||
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
||||
return true;
|
||||
}
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_RichText_createWithXML : wrong number of arguments");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_ui_RichText_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -13536,8 +13749,11 @@ void js_register_cocos2dx_ui_RichText(JSContext *cx, JS::HandleObject global) {
|
|||
static JSFunctionSpec funcs[] = {
|
||||
JS_FN("insertElement", js_cocos2dx_ui_RichText_insertElement, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("pushBackElement", js_cocos2dx_ui_RichText_pushBackElement, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setWrapMode", js_cocos2dx_ui_RichText_setWrapMode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setVerticalSpace", js_cocos2dx_ui_RichText_setVerticalSpace, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getWrapMode", js_cocos2dx_ui_RichText_getWrapMode, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("formatText", js_cocos2dx_ui_RichText_formatText, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("initWithXML", js_cocos2dx_ui_RichText_initWithXML, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("removeElement", js_cocos2dx_ui_RichText_removeElement, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("ctor", js_cocos2dx_ui_RichText_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FS_END
|
||||
|
@ -13545,6 +13761,7 @@ void js_register_cocos2dx_ui_RichText(JSContext *cx, JS::HandleObject global) {
|
|||
|
||||
static JSFunctionSpec st_funcs[] = {
|
||||
JS_FN("create", js_cocos2dx_ui_RichText_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("createWithXML", js_cocos2dx_ui_RichText_createWithXML, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
|
|
|
@ -423,6 +423,8 @@ bool js_cocos2dx_ui_ScrollView_getScrollBarColor(JSContext *cx, uint32_t argc, j
|
|||
bool js_cocos2dx_ui_ScrollView_jumpToTopLeft(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_jumpToPercentHorizontal(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_jumpToBottomRight(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_setTouchTotalTimeThreshold(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_getTouchTotalTimeThreshold(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForHorizontal(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_setScrollBarWidth(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_setBounceEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
@ -698,7 +700,9 @@ bool js_cocos2dx_ui_RichElementImage_constructor(JSContext *cx, uint32_t argc, j
|
|||
void js_cocos2dx_ui_RichElementImage_finalize(JSContext *cx, JSObject *obj);
|
||||
void js_register_cocos2dx_ui_RichElementImage(JSContext *cx, JS::HandleObject global);
|
||||
void register_all_cocos2dx_ui(JSContext* cx, JS::HandleObject obj);
|
||||
bool js_cocos2dx_ui_RichElementImage_setHeight(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_RichElementImage_init(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_RichElementImage_setWidth(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_RichElementImage_create(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_RichElementImage_RichElementImage(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
||||
|
@ -722,10 +726,14 @@ void js_register_cocos2dx_ui_RichText(JSContext *cx, JS::HandleObject global);
|
|||
void register_all_cocos2dx_ui(JSContext* cx, JS::HandleObject obj);
|
||||
bool js_cocos2dx_ui_RichText_insertElement(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_RichText_pushBackElement(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_RichText_setWrapMode(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_RichText_setVerticalSpace(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_RichText_getWrapMode(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_RichText_formatText(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_RichText_initWithXML(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_RichText_removeElement(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_RichText_create(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_RichText_createWithXML(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_RichText_RichText(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
||||
extern JSClass *jsb_cocos2d_ui_HBox_class;
|
||||
|
|
|
@ -1066,21 +1066,24 @@ bool ScriptingCore::executeScript(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
JSString* str = JS::ToString(cx, jsstr);
|
||||
JSStringWrapper path(str);
|
||||
bool res = false;
|
||||
JS::RootedValue jsret(cx);
|
||||
if (argc == 2 && args.get(1).isString()) {
|
||||
JSString* globalName = args.get(1).toString();
|
||||
JSStringWrapper name(globalName);
|
||||
|
||||
JS::RootedObject debugObj(cx, ScriptingCore::getInstance()->getDebugGlobal());
|
||||
if (debugObj) {
|
||||
res = ScriptingCore::getInstance()->runScript(path.get(), debugObj);
|
||||
res = ScriptingCore::getInstance()->requireScript(path.get(), debugObj, cx, &jsret);
|
||||
} else {
|
||||
JS_ReportError(cx, "Invalid global object: %s", name.get());
|
||||
args.rval().setUndefined();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
JS::RootedObject glob(cx, JS::CurrentGlobalOrNull(cx));
|
||||
res = ScriptingCore::getInstance()->runScript(path.get(), glob);
|
||||
res = ScriptingCore::getInstance()->requireScript(path.get(), glob, cx, &jsret);
|
||||
}
|
||||
args.rval().set(jsret);
|
||||
return res;
|
||||
}
|
||||
args.rval().setUndefined();
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "js_bindings_core.h"
|
||||
#include "js_manual_conversions.h"
|
||||
#include "jsb_opengl_functions.h"
|
||||
#include "platform/CCGL.h"
|
||||
|
||||
// Arguments: GLenum
|
||||
// Ret value: void
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "js_manual_conversions.h"
|
||||
#include "js_bindings_core.h"
|
||||
#include "jsb_opengl_functions.h"
|
||||
#include "platform/CCGL.h"
|
||||
|
||||
|
||||
// Helper functions that link "glGenXXXs" (OpenGL ES 2.0 spec), with "gl.createXXX" (WebGL spec)
|
||||
|
|
|
@ -28,22 +28,9 @@
|
|||
#include "js_bindings_config.h"
|
||||
#ifdef JSB_INCLUDE_OPENGL
|
||||
|
||||
//#include <Availability.h>
|
||||
#include "jsapi.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
|
||||
#elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
|
||||
|
||||
// compatible with iOS
|
||||
#define glClearDepthf glClearDepth
|
||||
#define glDepthRangef glDepthRange
|
||||
#ifndef glReleaseShaderCompiler
|
||||
#define glReleaseShaderCompiler()
|
||||
#endif
|
||||
|
||||
#endif // __MAC_OS_X_VERSION_MAX_ALLOWED
|
||||
|
||||
// forward declaration of new functions
|
||||
bool JSB_glGetSupportedExtensions(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ ccui.TextField.prototype._ctor = function(placeholder, fontName, fontSize){
|
|||
};
|
||||
|
||||
ccui.RichElementText.prototype._ctor = function(tag, color, opacity, text, fontName, fontSize){
|
||||
fontSize !== undefined && this.init(tag, color, opacity, text, fontName, fontSize);
|
||||
fontSize !== undefined && this.init(tag, color, opacity, text, fontName, fontSize, 0, "");
|
||||
};
|
||||
|
||||
ccui.RichElementImage.prototype._ctor = function(tag, color, opacity, filePath){
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/*global ccui */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
*
|
||||
|
@ -25,15 +27,69 @@
|
|||
var cc = cc || {};
|
||||
|
||||
(function() {
|
||||
var logW = function(oldName, newName) {
|
||||
cc.log("\n********** \n"+oldName +" was deprecated, please use "+ newName +" instead.\n**********");
|
||||
};
|
||||
|
||||
ccui.Text.prototype.setText = function(text){
|
||||
ccui.Text.prototype.setText = function(text) {
|
||||
logW("ccui.Text.setText", "ccui.Text.setString");
|
||||
this.setString(text);
|
||||
};
|
||||
|
||||
ccui.Text.prototype.getStringValue = function(){
|
||||
ccui.Text.prototype.getStringValue = function() {
|
||||
logW("ccui.Text.getStringValue", "ccui.Text.getString");
|
||||
return this.getString();
|
||||
};
|
||||
|
||||
ccui.PageView.prototype.getCurPageIndex = function() {
|
||||
logW("ccui.PageView.getCurPageIndex", "ccui.PageView.getCurrentPageIndex");
|
||||
return this.getCurrentPageIndex();
|
||||
};
|
||||
|
||||
ccui.PageView.prototype.addWidgetToPage = function(widget, pageIndx) {
|
||||
logW("ccui.PageView.addWidgetToPage", "ccui.PageView.insertPage");
|
||||
return this.insertPage(widget, pageIndx);
|
||||
};
|
||||
|
||||
ccui.PageView.prototype.setCurPageIndex = function(index) {
|
||||
logW("ccui.PageView.setCurPageIndex", "ccui.PageView.setCurrentPageIndex");
|
||||
return this.setCurrentPageIndex(index);
|
||||
};
|
||||
|
||||
ccui.PageView.prototype.getPages = function() {
|
||||
logW("ccui.PageView.getPages", "ccui.PageView.getItems");
|
||||
return this.getItems();
|
||||
};
|
||||
|
||||
ccui.PageView.prototype.getPage = function(index) {
|
||||
logW("ccui.PageView.getPage", "ccui.PageView.getItem");
|
||||
return this.getItem(index);
|
||||
};
|
||||
|
||||
ccui.PageView.prototype.setCustomScrollThreshold = function() {
|
||||
cc.log("Since v3.9, this method has no effect.");
|
||||
};
|
||||
|
||||
ccui.PageView.prototype.getCustomScrollThreshold = function() {
|
||||
cc.log("Since v3.9, this method has no effect.");
|
||||
};
|
||||
|
||||
ccui.PageView.prototype.setUsingCustomScrollThreshold = function() {
|
||||
cc.log("Since v3.9, this method has no effect.");
|
||||
};
|
||||
|
||||
ccui.PageView.prototype.isUsingCustomScrollThreshold = function() {
|
||||
cc.log("Since v3.9, this method has no effect.");
|
||||
};
|
||||
|
||||
ccui.ListView.prototype.requestRefreshView = function() {
|
||||
logW("ccui.ListView.requestRefreshView", "ccui.ListView.forceDoLayout");
|
||||
this.forceDoLayout();
|
||||
};
|
||||
|
||||
ccui.ListView.prototype.refreshView = function() {
|
||||
logW("ccui.ListView.refreshView", "ccui.ListView.forceDoLayout");
|
||||
this.forceDoLayout();
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
@ -4,7 +4,20 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
function utf16to8(str) {
|
||||
/* General utilities used throughout devtools. */
|
||||
|
||||
// var { Ci, Cu, Cc, components } = require("chrome");
|
||||
// var Services = require("Services");
|
||||
// var promise = require("promise");
|
||||
|
||||
// loader.lazyRequireGetter(this, "FileUtils",
|
||||
// "resource://gre/modules/FileUtils.jsm", true);
|
||||
|
||||
function DevToolsUtils() {
|
||||
|
||||
}
|
||||
|
||||
DevToolsUtils.utf16to8 = function utf16to8(str) {
|
||||
var out, i, len, c;
|
||||
|
||||
out = "";
|
||||
|
@ -31,7 +44,7 @@ function utf16to8(str) {
|
|||
return out;
|
||||
}
|
||||
|
||||
function utf8to16(str) {
|
||||
DevToolsUtils.utf8to16 = function utf8to16(str) {
|
||||
var out, i, len, c;
|
||||
var char2, char3;
|
||||
|
||||
|
@ -63,53 +76,53 @@ function utf8to16(str) {
|
|||
return out;
|
||||
}
|
||||
|
||||
var dump = function(msg) {
|
||||
log(msg);
|
||||
};
|
||||
|
||||
/* General utilities used throughout devtools. */
|
||||
|
||||
/**
|
||||
* Turn the error |aError| into a string, without fail.
|
||||
*/
|
||||
this.safeErrorString = function safeErrorString(aError) {
|
||||
DevToolsUtils.safeErrorString = function safeErrorString(aError) {
|
||||
try {
|
||||
let errorString = aError.toString();
|
||||
if (typeof errorString === "string") {
|
||||
if (typeof errorString == "string") {
|
||||
// Attempt to attach a stack to |errorString|. If it throws an error, or
|
||||
// isn't a string, don't use it.
|
||||
try {
|
||||
if (aError.stack) {
|
||||
let stack = aError.stack.toString();
|
||||
if (typeof stack === "string") {
|
||||
if (typeof stack == "string") {
|
||||
errorString += "\nStack: " + stack;
|
||||
}
|
||||
}
|
||||
} catch (ee) { }
|
||||
|
||||
// Append additional line and column number information to the output,
|
||||
// since it might not be part of the stringified error.
|
||||
if (typeof aError.lineNumber == "number" && typeof aError.columnNumber == "number") {
|
||||
errorString += "Line: " + aError.lineNumber + ", column: " + aError.columnNumber;
|
||||
}
|
||||
|
||||
return errorString;
|
||||
}
|
||||
} catch (ee) { }
|
||||
|
||||
return "<failed trying to find error description>";
|
||||
// We failed to find a good error description, so do the next best thing.
|
||||
return Object.prototype.toString.call(aError);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Report that |aWho| threw an exception, |aException|.
|
||||
*/
|
||||
this.reportException = function reportException(aWho, aException) {
|
||||
let msg = aWho + " threw an exception: " + safeErrorString(aException);
|
||||
DevToolsUtils.reportException = function reportException(aWho, aException) {
|
||||
let msg = aWho + " threw an exception: " + DevToolsUtils.safeErrorString(aException);
|
||||
|
||||
dump(msg + "\n");
|
||||
log(msg + "\n");
|
||||
|
||||
// if (Cu && Cu.reportError) {
|
||||
|
||||
// if (Components.utils.reportError) {
|
||||
// /*
|
||||
// * Note that the xpcshell test harness registers an observer for
|
||||
// * console messages, so when we're running tests, this will cause
|
||||
// * the test to quit.
|
||||
// */
|
||||
// Components.utils.reportError(msg);
|
||||
|
||||
// Cu.reportError(msg);
|
||||
// }
|
||||
}
|
||||
|
||||
|
@ -127,7 +140,7 @@ this.reportException = function reportException(aWho, aException) {
|
|||
* (SpiderMonkey does generate good names for anonymous functions, but we
|
||||
* don't have a way to get at them from JavaScript at the moment.)
|
||||
*/
|
||||
this.makeInfallible = function makeInfallible(aHandler, aName) {
|
||||
DevToolsUtils.makeInfallible = function makeInfallible(aHandler, aName) {
|
||||
if (!aName)
|
||||
aName = aHandler.name;
|
||||
|
||||
|
@ -139,17 +152,107 @@ this.makeInfallible = function makeInfallible(aHandler, aName) {
|
|||
if (aName) {
|
||||
who += " " + aName;
|
||||
}
|
||||
reportException(who, ex);
|
||||
return DevToolsUtils.reportException(who, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Interleaves two arrays element by element, returning the combined array, like
|
||||
* a zip. In the case of arrays with different sizes, undefined values will be
|
||||
* interleaved at the end along with the extra values of the larger array.
|
||||
*
|
||||
* @param Array a
|
||||
* @param Array b
|
||||
* @returns Array
|
||||
* The combined array, in the form [a1, b1, a2, b2, ...]
|
||||
*/
|
||||
DevToolsUtils.zip = function zip(a, b) {
|
||||
if (!b) {
|
||||
return a;
|
||||
}
|
||||
if (!a) {
|
||||
return b;
|
||||
}
|
||||
const pairs = [];
|
||||
for (let i = 0, aLength = a.length, bLength = b.length;
|
||||
i < aLength || i < bLength;
|
||||
i++) {
|
||||
pairs.push([a[i], b[i]]);
|
||||
}
|
||||
return pairs;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Converts an object into an array with 2-element arrays as key/value
|
||||
* pairs of the object. `{ foo: 1, bar: 2}` would become
|
||||
* `[[foo, 1], [bar 2]]` (order not guaranteed);
|
||||
*
|
||||
* @param object obj
|
||||
* @returns array
|
||||
*/
|
||||
DevToolsUtils.entries = function entries(obj) {
|
||||
return Object.keys(obj).map(k => [k, obj[k]]);
|
||||
}
|
||||
|
||||
const executeSoon = aFn => {
|
||||
Services.tm.mainThread.dispatch({
|
||||
run: this.makeInfallible(aFn)
|
||||
}, Components.interfaces.nsIThread.DISPATCH_NORMAL);
|
||||
/**
|
||||
* Composes the given functions into a single function, which will
|
||||
* apply the results of each function right-to-left, starting with
|
||||
* applying the given arguments to the right-most function.
|
||||
* `compose(foo, bar, baz)` === `args => foo(bar(baz(args)`
|
||||
*
|
||||
* @param ...function funcs
|
||||
* @returns function
|
||||
*/
|
||||
DevToolsUtils.compose = function compose(...funcs) {
|
||||
return (...args) => {
|
||||
const initialValue = funcs[funcs.length - 1].apply(null, args);
|
||||
const leftFuncs = funcs.slice(0, -1);
|
||||
return leftFuncs.reduceRight((composed, f) => f(composed),
|
||||
initialValue);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Waits for the next tick in the event loop to execute a callback.
|
||||
*/
|
||||
DevToolsUtils.executeSoon = function executeSoon(aFn) {
|
||||
if (isWorker) {
|
||||
setImmediate(aFn);
|
||||
} else {
|
||||
Services.tm.mainThread.dispatch({
|
||||
run: DevToolsUtils.makeInfallible(aFn)
|
||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Waits for the next tick in the event loop.
|
||||
*
|
||||
* @return Promise
|
||||
* A promise that is resolved after the next tick in the event loop.
|
||||
*/
|
||||
DevToolsUtils.waitForTick = function waitForTick() {
|
||||
let deferred = promise.defer();
|
||||
DevToolsUtils.executeSoon(deferred.resolve);
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
/**
|
||||
* Waits for the specified amount of time to pass.
|
||||
*
|
||||
* @param number aDelay
|
||||
* The amount of time to wait, in milliseconds.
|
||||
* @return Promise
|
||||
* A promise that is resolved after the specified amount of time passes.
|
||||
*/
|
||||
DevToolsUtils.waitForTime = function waitForTime(aDelay) {
|
||||
let deferred = promise.defer();
|
||||
require("Timer").setTimeout(deferred.resolve, aDelay);
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
/**
|
||||
* Like Array.prototype.forEach, but doesn't cause jankiness when iterating over
|
||||
* very large arrays by yielding to the browser and continuing execution on the
|
||||
|
@ -158,16 +261,19 @@ const executeSoon = aFn => {
|
|||
* @param Array aArray
|
||||
* The array being iterated over.
|
||||
* @param Function aFn
|
||||
* The function called on each item in the array.
|
||||
* The function called on each item in the array. If a promise is
|
||||
* returned by this function, iterating over the array will be paused
|
||||
* until the respective promise is resolved.
|
||||
* @returns Promise
|
||||
* A promise that is resolved once the whole array has been iterated
|
||||
* over.
|
||||
* over, and all promises returned by the aFn callback are resolved.
|
||||
*/
|
||||
this.yieldingEach = function yieldingEach(aArray, aFn) {
|
||||
DevToolsUtils.yieldingEach = function yieldingEach(aArray, aFn) {
|
||||
const deferred = promise.defer();
|
||||
|
||||
let i = 0;
|
||||
let len = aArray.length;
|
||||
let outstanding = [deferred.promise];
|
||||
|
||||
(function loop() {
|
||||
const start = Date.now();
|
||||
|
@ -178,12 +284,12 @@ this.yieldingEach = function yieldingEach(aArray, aFn) {
|
|||
// aren't including time spent in non-JS here, but this is Good
|
||||
// Enough(tm).
|
||||
if (Date.now() - start > 16) {
|
||||
executeSoon(loop);
|
||||
DevToolsUtils.executeSoon(loop);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
aFn(aArray[i++]);
|
||||
outstanding.push(aFn(aArray[i], i++));
|
||||
} catch (e) {
|
||||
deferred.reject(e);
|
||||
return;
|
||||
|
@ -193,10 +299,9 @@ this.yieldingEach = function yieldingEach(aArray, aFn) {
|
|||
deferred.resolve();
|
||||
}());
|
||||
|
||||
return deferred.promise;
|
||||
return promise.all(outstanding);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Like XPCOMUtils.defineLazyGetter, but with a |this| sensitive getter that
|
||||
* allows the lazy getter to be defined on a prototype and work correctly with
|
||||
|
@ -210,7 +315,7 @@ this.yieldingEach = function yieldingEach(aArray, aFn) {
|
|||
* The callback that will be called to determine the value. Will be
|
||||
* called with the |this| value of the current instance.
|
||||
*/
|
||||
this.defineLazyPrototypeGetter =
|
||||
DevToolsUtils.defineLazyPrototypeGetter =
|
||||
function defineLazyPrototypeGetter(aObject, aKey, aCallback) {
|
||||
Object.defineProperty(aObject, aKey, {
|
||||
configurable: true,
|
||||
|
@ -228,3 +333,477 @@ function defineLazyPrototypeGetter(aObject, aKey, aCallback) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Safely get the property value from a Debugger.Object for a given key. Walks
|
||||
* the prototype chain until the property is found.
|
||||
*
|
||||
* @param Debugger.Object aObject
|
||||
* The Debugger.Object to get the value from.
|
||||
* @param String aKey
|
||||
* The key to look for.
|
||||
* @return Any
|
||||
*/
|
||||
DevToolsUtils.getProperty = function getProperty(aObj, aKey) {
|
||||
let root = aObj;
|
||||
try {
|
||||
do {
|
||||
const desc = aObj.getOwnPropertyDescriptor(aKey);
|
||||
if (desc) {
|
||||
if ("value" in desc) {
|
||||
return desc.value;
|
||||
}
|
||||
// Call the getter if it's safe.
|
||||
return DevToolsUtils.hasSafeGetter(desc) ? desc.get.call(root).return : undefined;
|
||||
}
|
||||
aObj = aObj.proto;
|
||||
} while (aObj);
|
||||
} catch (e) {
|
||||
// If anything goes wrong report the error and return undefined.
|
||||
DevToolsUtils.reportException("getProperty", e);
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* Determines if a descriptor has a getter which doesn't call into JavaScript.
|
||||
*
|
||||
* @param Object aDesc
|
||||
* The descriptor to check for a safe getter.
|
||||
* @return Boolean
|
||||
* Whether a safe getter was found.
|
||||
*/
|
||||
DevToolsUtils.hasSafeGetter = function hasSafeGetter(aDesc) {
|
||||
// Scripted functions that are CCWs will not appear scripted until after
|
||||
// unwrapping.
|
||||
// let fn = aDesc.get.unwrap();
|
||||
let fn = aDesc.get;
|
||||
return fn && fn.callable && fn.class == "Function" && fn.script === undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if it is safe to read properties and execute methods from the given JS
|
||||
* object. Safety is defined as being protected from unintended code execution
|
||||
* from content scripts (or cross-compartment code).
|
||||
*
|
||||
* See bugs 945920 and 946752 for discussion.
|
||||
*
|
||||
* @type Object aObj
|
||||
* The object to check.
|
||||
* @return Boolean
|
||||
* True if it is safe to read properties from aObj, or false otherwise.
|
||||
*/
|
||||
DevToolsUtils.isSafeJSObject = function isSafeJSObject(aObj) {
|
||||
return true;
|
||||
// If we are running on a worker thread, Cu is not available. In this case,
|
||||
// we always return false, just to be on the safe side.
|
||||
// if (isWorker) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// if (Cu.getGlobalForObject(aObj) ==
|
||||
// Cu.getGlobalForObject(DevToolsUtils.isSafeJSObject)) {
|
||||
// return true; // aObj is not a cross-compartment wrapper.
|
||||
// }
|
||||
|
||||
// let principal = Cu.getObjectPrincipal(aObj);
|
||||
// if (Services.scriptSecurityManager.isSystemPrincipal(principal)) {
|
||||
// return true; // allow chrome objects
|
||||
// }
|
||||
|
||||
// return Cu.isXrayWrapper(aObj);
|
||||
};
|
||||
|
||||
DevToolsUtils.dumpn = function dumpn(str) {
|
||||
if (DevToolsUtils.dumpn.wantLogging) {
|
||||
dump("DBG-SERVER: " + str + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
// We want wantLogging to be writable. The DevToolsUtils object is frozen by the
|
||||
// loader, so define it on dumpn instead.
|
||||
DevToolsUtils.dumpn.wantLogging = false;
|
||||
|
||||
/**
|
||||
* A verbose logger for low-level tracing.
|
||||
*/
|
||||
DevToolsUtils.dumpv = function(msg) {
|
||||
if (DevToolsUtils.dumpv.wantVerbose) {
|
||||
DevToolsUtils.dumpn(msg);
|
||||
}
|
||||
};
|
||||
|
||||
// We want wantLogging to be writable. The DevToolsUtils object is frozen by the
|
||||
// loader, so define it on dumpn instead.
|
||||
DevToolsUtils.dumpv.wantVerbose = false;
|
||||
|
||||
DevToolsUtils.dbg_assert = function dbg_assert(cond, e) {
|
||||
if (!cond) {
|
||||
return e;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Utility function for updating an object with the properties of
|
||||
* other objects.
|
||||
*
|
||||
* @param aTarget Object
|
||||
* The object being updated.
|
||||
* @param aNewAttrs Object
|
||||
* The rest params are objects to update aTarget with. You
|
||||
* can pass as many as you like.
|
||||
*/
|
||||
DevToolsUtils.update = function update(aTarget, ...aArgs) {
|
||||
for (let attrs of aArgs) {
|
||||
for (let key in attrs) {
|
||||
let desc = Object.getOwnPropertyDescriptor(attrs, key);
|
||||
|
||||
if (desc) {
|
||||
Object.defineProperty(aTarget, key, desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return aTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility function for getting the values from an object as an array
|
||||
*
|
||||
* @param aObject Object
|
||||
* The object to iterate over
|
||||
*/
|
||||
DevToolsUtils.values = function values(aObject) {
|
||||
return Object.keys(aObject).map(k => aObject[k]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a getter on a specified object that will be created upon first use.
|
||||
*
|
||||
* @param aObject
|
||||
* The object to define the lazy getter on.
|
||||
* @param aName
|
||||
* The name of the getter to define on aObject.
|
||||
* @param aLambda
|
||||
* A function that returns what the getter should return. This will
|
||||
* only ever be called once.
|
||||
*/
|
||||
DevToolsUtils.defineLazyGetter = function defineLazyGetter(aObject, aName, aLambda) {
|
||||
Object.defineProperty(aObject, aName, {
|
||||
get: function () {
|
||||
delete aObject[aName];
|
||||
return aObject[aName] = aLambda.apply(aObject);
|
||||
},
|
||||
configurable: true,
|
||||
enumerable: true
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Defines a getter on a specified object for a module. The module will not
|
||||
* be imported until first use.
|
||||
*
|
||||
* @param aObject
|
||||
* The object to define the lazy getter on.
|
||||
* @param aName
|
||||
* The name of the getter to define on aObject for the module.
|
||||
* @param aResource
|
||||
* The URL used to obtain the module.
|
||||
* @param aSymbol
|
||||
* The name of the symbol exported by the module.
|
||||
* This parameter is optional and defaults to aName.
|
||||
*/
|
||||
DevToolsUtils.defineLazyModuleGetter = function defineLazyModuleGetter(aObject, aName,
|
||||
aResource,
|
||||
aSymbol)
|
||||
{
|
||||
this.defineLazyGetter(aObject, aName, function XPCU_moduleLambda() {
|
||||
var temp = {};
|
||||
Cu.import(aResource, temp);
|
||||
return temp[aSymbol || aName];
|
||||
});
|
||||
};
|
||||
|
||||
DevToolsUtils.defineLazyGetter(this, "NetUtil", () => {
|
||||
return Cu.import("resource://gre/modules/NetUtil.jsm", {}).NetUtil;
|
||||
});
|
||||
|
||||
DevToolsUtils.defineLazyGetter(this, "OS", () => {
|
||||
return Cu.import("resource://gre/modules/osfile.jsm", {}).OS;
|
||||
});
|
||||
|
||||
DevToolsUtils.defineLazyGetter(this, "TextDecoder", () => {
|
||||
return Cu.import("resource://gre/modules/osfile.jsm", {}).TextDecoder;
|
||||
});
|
||||
|
||||
DevToolsUtils.defineLazyGetter(this, "NetworkHelper", () => {
|
||||
return require("devtools/toolkit/webconsole/network-helper");
|
||||
});
|
||||
|
||||
/**
|
||||
* Performs a request to load the desired URL and returns a promise.
|
||||
*
|
||||
* @param aURL String
|
||||
* The URL we will request.
|
||||
* @param aOptions Object
|
||||
* An object with the following optional properties:
|
||||
* - loadFromCache: if false, will bypass the cache and
|
||||
* always load fresh from the network (default: true)
|
||||
* - policy: the nsIContentPolicy type to apply when fetching the URL
|
||||
* - window: the window to get the loadGroup from
|
||||
* - charset: the charset to use if the channel doesn't provide one
|
||||
* @returns Promise that resolves with an object with the following members on
|
||||
* success:
|
||||
* - content: the document at that URL, as a string,
|
||||
* - contentType: the content type of the document
|
||||
*
|
||||
* If an error occurs, the promise is rejected with that error.
|
||||
*
|
||||
* XXX: It may be better to use nsITraceableChannel to get to the sources
|
||||
* without relying on caching when we can (not for eval, etc.):
|
||||
* http://www.softwareishard.com/blog/firebug/nsitraceablechannel-intercept-http-traffic/
|
||||
*/
|
||||
function mainThreadFetch(aURL, aOptions={ loadFromCache: true,
|
||||
policy: Ci.nsIContentPolicy.TYPE_OTHER,
|
||||
window: null,
|
||||
charset: null }) {
|
||||
// Create a channel.
|
||||
let url = aURL.split(" -> ").pop();
|
||||
let channel;
|
||||
try {
|
||||
channel = newChannelForURL(url, aOptions);
|
||||
} catch (ex) {
|
||||
return promise.reject(ex);
|
||||
}
|
||||
|
||||
// Set the channel options.
|
||||
channel.loadFlags = aOptions.loadFromCache
|
||||
? channel.LOAD_FROM_CACHE
|
||||
: channel.LOAD_BYPASS_CACHE;
|
||||
|
||||
if (aOptions.window) {
|
||||
// Respect private browsing.
|
||||
channel.loadGroup = aOptions.window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocumentLoader)
|
||||
.loadGroup;
|
||||
}
|
||||
|
||||
let deferred = promise.defer();
|
||||
let onResponse = (stream, status, request) => {
|
||||
if (!components.isSuccessCode(status)) {
|
||||
deferred.reject(new Error('Failed to fetch ${url}. Code ${status}.'));
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// We cannot use NetUtil to do the charset conversion as if charset
|
||||
// information is not available and our default guess is wrong the method
|
||||
// might fail and we lose the stream data. This means we can't fall back
|
||||
// to using the locale default encoding (bug 1181345).
|
||||
|
||||
// Read and decode the data according to the locale default encoding.
|
||||
let available = stream.available();
|
||||
let source = NetUtil.readInputStreamToString(stream, available);
|
||||
stream.close();
|
||||
|
||||
// If the channel or the caller has correct charset information, the
|
||||
// content will be decoded correctly. If we have to fall back to UTF-8 and
|
||||
// the guess is wrong, the conversion fails and convertToUnicode returns
|
||||
// the input unmodified. Essentially we try to decode the data as UTF-8
|
||||
// and if that fails, we use the locale specific default encoding. This is
|
||||
// the best we can do if the source does not provide charset info.
|
||||
let charset = channel.contentCharset || aOptions.charset || "UTF-8";
|
||||
let unicodeSource = NetworkHelper.convertToUnicode(source, charset);
|
||||
|
||||
deferred.resolve({
|
||||
content: unicodeSource,
|
||||
contentType: request.contentType
|
||||
});
|
||||
} catch (ex) {
|
||||
let uri = request.originalURI;
|
||||
if (ex.name === "NS_BASE_STREAM_CLOSED" && uri instanceof Ci.nsIFileURL) {
|
||||
// Empty files cause NS_BASE_STREAM_CLOSED exception. Use OS.File to
|
||||
// differentiate between empty files and other errors (bug 1170864).
|
||||
// This can be removed when bug 982654 is fixed.
|
||||
|
||||
uri.QueryInterface(Ci.nsIFileURL);
|
||||
let result = OS.File.read(uri.file.path).then(bytes => {
|
||||
// Convert the bytearray to a String.
|
||||
let decoder = new TextDecoder();
|
||||
let content = decoder.decode(bytes);
|
||||
|
||||
// We can't detect the contentType without opening a channel
|
||||
// and that failed already. This is the best we can do here.
|
||||
return {
|
||||
content,
|
||||
contentType: "text/plain"
|
||||
};
|
||||
});
|
||||
|
||||
deferred.resolve(result);
|
||||
} else {
|
||||
deferred.reject(ex);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Open the channel
|
||||
try {
|
||||
NetUtil.asyncFetch(channel, onResponse);
|
||||
} catch (ex) {
|
||||
return promise.reject(ex);
|
||||
}
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a channel for given URL. Tries a bit harder than NetUtil.newChannel.
|
||||
*
|
||||
* @param {String} url - The URL to open a channel for.
|
||||
* @param {Object} options - The options object passed to @method fetch.
|
||||
* @return {nsIChannel} - The newly created channel. Throws on failure.
|
||||
*/
|
||||
function newChannelForURL(url, { policy }) {
|
||||
let channelOptions = {
|
||||
contentPolicyType: policy,
|
||||
loadUsingSystemPrincipal: true,
|
||||
uri: url
|
||||
};
|
||||
|
||||
try {
|
||||
return NetUtil.newChannel(channelOptions);
|
||||
} catch (e) {
|
||||
// In the xpcshell tests, the script url is the absolute path of the test
|
||||
// file, which will make a malformed URI error be thrown. Add the file
|
||||
// scheme to see if it helps.
|
||||
channelOptions.uri = "file://" + url;
|
||||
|
||||
return NetUtil.newChannel(channelOptions);
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch is defined differently depending on whether we are on the main thread
|
||||
// or a worker thread.
|
||||
if (!this.isWorker) {
|
||||
DevToolsUtils.fetch = mainThreadFetch;
|
||||
} else {
|
||||
// Services is not available in worker threads, nor is there any other way
|
||||
// to fetch a URL. We need to enlist the help from the main thread here, by
|
||||
// issuing an rpc request, to fetch the URL on our behalf.
|
||||
DevToolsUtils.fetch = function (url, options) {
|
||||
return rpc("fetch", url, options);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a promise that is resolved or rejected when all promises have settled
|
||||
* (resolved or rejected).
|
||||
*
|
||||
* This differs from Promise.all, which will reject immediately after the first
|
||||
* rejection, instead of waiting for the remaining promises to settle.
|
||||
*
|
||||
* @param values
|
||||
* Iterable of promises that may be pending, resolved, or rejected. When
|
||||
* when all promises have settled (resolved or rejected), the returned
|
||||
* promise will be resolved or rejected as well.
|
||||
*
|
||||
* @return A new promise that is fulfilled when all values have settled
|
||||
* (resolved or rejected). Its resolution value will be an array of all
|
||||
* resolved values in the given order, or undefined if values is an
|
||||
* empty array. The reject reason will be forwarded from the first
|
||||
* promise in the list of given promises to be rejected.
|
||||
*/
|
||||
DevToolsUtils.settleAll = values => {
|
||||
if (values === null || typeof(values[Symbol.iterator]) != "function") {
|
||||
throw new Error("settleAll() expects an iterable.");
|
||||
}
|
||||
|
||||
let deferred = promise.defer();
|
||||
|
||||
values = Array.isArray(values) ? values : [...values];
|
||||
let countdown = values.length;
|
||||
let resolutionValues = new Array(countdown);
|
||||
let rejectionValue;
|
||||
let rejectionOccurred = false;
|
||||
|
||||
if (!countdown) {
|
||||
deferred.resolve(resolutionValues);
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function checkForCompletion() {
|
||||
if (--countdown > 0) {
|
||||
return;
|
||||
}
|
||||
if (!rejectionOccurred) {
|
||||
deferred.resolve(resolutionValues);
|
||||
} else {
|
||||
deferred.reject(rejectionValue);
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
let index = i;
|
||||
let value = values[i];
|
||||
let resolver = result => {
|
||||
resolutionValues[index] = result;
|
||||
checkForCompletion();
|
||||
};
|
||||
let rejecter = error => {
|
||||
if (!rejectionOccurred) {
|
||||
rejectionValue = error;
|
||||
rejectionOccurred = true;
|
||||
}
|
||||
checkForCompletion();
|
||||
};
|
||||
|
||||
if (value && typeof(value.then) == "function") {
|
||||
value.then(resolver, rejecter);
|
||||
} else {
|
||||
// Given value is not a promise, forward it as a resolution value.
|
||||
resolver(value);
|
||||
}
|
||||
}
|
||||
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
/**
|
||||
* When the testing flag is set, various behaviors may be altered from
|
||||
* production mode, typically to enable easier testing or enhanced debugging.
|
||||
*/
|
||||
var testing = false;
|
||||
Object.defineProperty(DevToolsUtils, "testing", {
|
||||
get: function() {
|
||||
return testing;
|
||||
},
|
||||
set: function(state) {
|
||||
testing = state;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Open the file at the given path for reading.
|
||||
*
|
||||
* @param {String} filePath
|
||||
*
|
||||
* @returns Promise<nsIInputStream>
|
||||
*/
|
||||
DevToolsUtils.openFileStream = function (filePath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const uri = NetUtil.newURI(new FileUtils.File(filePath));
|
||||
NetUtil.asyncFetch(
|
||||
{ uri, loadUsingSystemPrincipal: true },
|
||||
(stream, result) => {
|
||||
if (!components.isSuccessCode(result)) {
|
||||
reject(new Error('Could not open "${filePath}": result = ${result}'));
|
||||
return;
|
||||
}
|
||||
|
||||
resolve(stream);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,277 @@
|
|||
/**
|
||||
* An OriginalLocation represents a location in an original source.
|
||||
*
|
||||
* @param SourceActor actor
|
||||
* A SourceActor representing an original source.
|
||||
* @param Number line
|
||||
* A line within the given source.
|
||||
* @param Number column
|
||||
* A column within the given line.
|
||||
* @param String name
|
||||
* The name of the symbol corresponding to this OriginalLocation.
|
||||
*/
|
||||
|
||||
function OriginalLocation(actor, line, column, name) {
|
||||
this._connection = actor ? actor.conn : null;
|
||||
this._actorID = actor ? actor.actorID : undefined;
|
||||
this._line = line;
|
||||
this._column = column;
|
||||
this._name = name;
|
||||
}
|
||||
|
||||
OriginalLocation.fromGeneratedLocation = function (generatedLocation) {
|
||||
return new OriginalLocation(
|
||||
generatedLocation.generatedSourceActor,
|
||||
generatedLocation.generatedLine,
|
||||
generatedLocation.generatedColumn
|
||||
);
|
||||
};
|
||||
|
||||
OriginalLocation.prototype = {
|
||||
get originalSourceActor() {
|
||||
return this._connection ? this._connection.getActor(this._actorID) : null;
|
||||
},
|
||||
|
||||
get originalUrl() {
|
||||
let actor = this.originalSourceActor;
|
||||
let source = actor.source;
|
||||
return source ? source.url : actor._originalUrl;
|
||||
},
|
||||
|
||||
get originalLine() {
|
||||
return this._line;
|
||||
},
|
||||
|
||||
get originalColumn() {
|
||||
return this._column;
|
||||
},
|
||||
|
||||
get originalName() {
|
||||
return this._name;
|
||||
},
|
||||
|
||||
get generatedSourceActor() {
|
||||
throw new Error("Shouldn't access generatedSourceActor from an OriginalLocation");
|
||||
},
|
||||
|
||||
get generatedLine() {
|
||||
throw new Error("Shouldn't access generatedLine from an OriginalLocation");
|
||||
},
|
||||
|
||||
get generatedColumn() {
|
||||
throw new Error("Shouldn't access generatedColumn from an Originallocation");
|
||||
},
|
||||
|
||||
equals: function (other) {
|
||||
return this.originalSourceActor.url == other.originalSourceActor.url &&
|
||||
this.originalLine === other.originalLine &&
|
||||
(this.originalColumn === undefined ||
|
||||
other.originalColumn === undefined ||
|
||||
this.originalColumn === other.originalColumn);
|
||||
},
|
||||
|
||||
toJSON: function () {
|
||||
return {
|
||||
source: this.originalSourceActor.form(),
|
||||
line: this.originalLine,
|
||||
column: this.originalColumn
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A GeneratedLocation represents a location in a generated source.
|
||||
*
|
||||
* @param SourceActor actor
|
||||
* A SourceActor representing a generated source.
|
||||
* @param Number line
|
||||
* A line within the given source.
|
||||
* @param Number column
|
||||
* A column within the given line.
|
||||
*/
|
||||
function GeneratedLocation(actor, line, column, lastColumn) {
|
||||
this._connection = actor ? actor.conn : null;
|
||||
this._actorID = actor ? actor.actorID : undefined;
|
||||
this._line = line;
|
||||
this._column = column;
|
||||
this._lastColumn = (lastColumn !== undefined) ? lastColumn : column + 1;
|
||||
}
|
||||
|
||||
GeneratedLocation.fromOriginalLocation = function (originalLocation) {
|
||||
return new GeneratedLocation(
|
||||
originalLocation.originalSourceActor,
|
||||
originalLocation.originalLine,
|
||||
originalLocation.originalColumn
|
||||
);
|
||||
};
|
||||
|
||||
GeneratedLocation.prototype = {
|
||||
get originalSourceActor() {
|
||||
throw new Error();
|
||||
},
|
||||
|
||||
get originalUrl() {
|
||||
throw new Error("Shouldn't access originalUrl from a GeneratedLocation");
|
||||
},
|
||||
|
||||
get originalLine() {
|
||||
throw new Error("Shouldn't access originalLine from a GeneratedLocation");
|
||||
},
|
||||
|
||||
get originalColumn() {
|
||||
throw new Error("Shouldn't access originalColumn from a GeneratedLocation");
|
||||
},
|
||||
|
||||
get originalName() {
|
||||
throw new Error("Shouldn't access originalName from a GeneratedLocation");
|
||||
},
|
||||
|
||||
get generatedSourceActor() {
|
||||
return this._connection ? this._connection.getActor(this._actorID) : null;
|
||||
},
|
||||
|
||||
get generatedLine() {
|
||||
return this._line;
|
||||
},
|
||||
|
||||
get generatedColumn() {
|
||||
return this._column;
|
||||
},
|
||||
|
||||
get generatedLastColumn() {
|
||||
return this._lastColumn;
|
||||
},
|
||||
|
||||
equals: function (other) {
|
||||
return this.generatedSourceActor.url == other.generatedSourceActor.url &&
|
||||
this.generatedLine === other.generatedLine &&
|
||||
(this.generatedColumn === undefined ||
|
||||
other.generatedColumn === undefined ||
|
||||
this.generatedColumn === other.generatedColumn);
|
||||
},
|
||||
|
||||
toJSON: function () {
|
||||
return {
|
||||
source: this.generatedSourceActor.form(),
|
||||
line: this.generatedLine,
|
||||
column: this.generatedColumn,
|
||||
lastColumn: this.generatedLastColumn
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
getOffsetColumn = function getOffsetColumn(aOffset, aScript) {
|
||||
let bestOffsetMapping = null;
|
||||
for (let offsetMapping of aScript.getAllColumnOffsets()) {
|
||||
if (!bestOffsetMapping ||
|
||||
(offsetMapping.offset <= aOffset &&
|
||||
offsetMapping.offset > bestOffsetMapping.offset)) {
|
||||
bestOffsetMapping = offsetMapping;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bestOffsetMapping) {
|
||||
// XXX: Try not to completely break the experience of using the debugger for
|
||||
// the user by assuming column 0. Simultaneously, report the error so that
|
||||
// there is a paper trail if the assumption is bad and the debugging
|
||||
// experience becomes wonky.
|
||||
reportError(new Error("Could not find a column for offset " + aOffset
|
||||
+ " in the script " + aScript));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return bestOffsetMapping.columnNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an ActorPool.
|
||||
*
|
||||
* ActorPools are actorID -> actor mapping and storage. These are
|
||||
* used to accumulate and quickly dispose of groups of actors that
|
||||
* share a lifetime.
|
||||
*/
|
||||
function ActorPool(aConnection)
|
||||
{
|
||||
this.conn = aConnection;
|
||||
this._cleanups = {};
|
||||
this._actors = {};
|
||||
}
|
||||
|
||||
ActorPool.prototype = {
|
||||
/**
|
||||
* Add an actor to the actor pool. If the actor doesn't have an ID,
|
||||
* allocate one from the connection.
|
||||
*
|
||||
* @param aActor object
|
||||
* The actor implementation. If the object has a
|
||||
* 'disconnect' property, it will be called when the actor
|
||||
* pool is cleaned up.
|
||||
*/
|
||||
addActor: function AP_addActor(aActor) {
|
||||
aActor.conn = this.conn;
|
||||
if (!aActor.actorID) {
|
||||
let prefix = aActor.actorPrefix;
|
||||
if (!prefix && typeof aActor == "function") {
|
||||
// typeName is a convention used with protocol.js-based actors
|
||||
prefix = aActor.prototype.actorPrefix || aActor.prototype.typeName;
|
||||
}
|
||||
aActor.actorID = this.conn.allocID(prefix || undefined);
|
||||
}
|
||||
|
||||
if (aActor.registeredPool) {
|
||||
aActor.registeredPool.removeActor(aActor);
|
||||
}
|
||||
aActor.registeredPool = this;
|
||||
|
||||
this._actors[aActor.actorID] = aActor;
|
||||
if (aActor.disconnect) {
|
||||
this._cleanups[aActor.actorID] = aActor;
|
||||
}
|
||||
},
|
||||
|
||||
get: function AP_get(aActorID) {
|
||||
return this._actors[aActorID] || undefined;
|
||||
},
|
||||
|
||||
has: function AP_has(aActorID) {
|
||||
return aActorID in this._actors;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if the pool is empty.
|
||||
*/
|
||||
isEmpty: function AP_isEmpty() {
|
||||
return Object.keys(this._actors).length == 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove an actor from the actor pool.
|
||||
*/
|
||||
removeActor: function AP_remove(aActor) {
|
||||
delete this._actors[aActor.actorID];
|
||||
delete this._cleanups[aActor.actorID];
|
||||
},
|
||||
|
||||
/**
|
||||
* Match the api expected by the protocol library.
|
||||
*/
|
||||
unmanage: function(aActor) {
|
||||
return this.removeActor(aActor);
|
||||
},
|
||||
|
||||
/**
|
||||
* Run all actor cleanups.
|
||||
*/
|
||||
cleanup: function AP_cleanup() {
|
||||
for (let id in this._cleanups) {
|
||||
this._cleanups[id].disconnect();
|
||||
}
|
||||
this._cleanups = {};
|
||||
},
|
||||
|
||||
forEach: function(callback) {
|
||||
for (let name in this._actors) {
|
||||
callback(this._actors[name]);
|
||||
}
|
||||
},
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
|||
/* -*- tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
@ -6,79 +6,17 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
// const { Cc, Ci, Cu } = require("chrome");
|
||||
// const Services = require("Services");
|
||||
// const { ActorPool, appendExtraActors, createExtraActors } = require("devtools/server/actors/common");
|
||||
// const { DebuggerServer } = require("devtools/server/main");
|
||||
|
||||
// loader.lazyGetter(this, "ppmm", () => {
|
||||
// return Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIMessageBroadcaster);
|
||||
// });
|
||||
|
||||
/* Root actor for the remote debugging protocol. */
|
||||
|
||||
/**
|
||||
* Methods shared between RootActor and BrowserTabActor.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Populate |this._extraActors| as specified by |aFactories|, reusing whatever
|
||||
* actors are already there. Add all actors in the final extra actors table to
|
||||
* |aPool|.
|
||||
*
|
||||
* The root actor and the tab actor use this to instantiate actors that other
|
||||
* parts of the browser have specified with DebuggerServer.addTabActor antd
|
||||
* DebuggerServer.addGlobalActor.
|
||||
*
|
||||
* @param aFactories
|
||||
* An object whose own property names are the names of properties to add to
|
||||
* some reply packet (say, a tab actor grip or the "listTabs" response
|
||||
* form), and whose own property values are actor constructor functions, as
|
||||
* documented for addTabActor and addGlobalActor.
|
||||
*
|
||||
* @param this
|
||||
* The BrowserRootActor or BrowserTabActor with which the new actors will
|
||||
* be associated. It should support whatever API the |aFactories|
|
||||
* constructor functions might be interested in, as it is passed to them.
|
||||
* For the sake of CommonCreateExtraActors itself, it should have at least
|
||||
* the following properties:
|
||||
*
|
||||
* - _extraActors
|
||||
* An object whose own property names are factory table (and packet)
|
||||
* property names, and whose values are no-argument actor constructors,
|
||||
* of the sort that one can add to an ActorPool.
|
||||
*
|
||||
* - conn
|
||||
* The DebuggerServerConnection in which the new actors will participate.
|
||||
*
|
||||
* - actorID
|
||||
* The actor's name, for use as the new actors' parentID.
|
||||
*/
|
||||
function CommonCreateExtraActors(aFactories, aPool) {
|
||||
// Walk over global actors added by extensions.
|
||||
for (let name in aFactories) {
|
||||
let actor = this._extraActors[name];
|
||||
if (!actor) {
|
||||
actor = aFactories[name].bind(null, this.conn, this);
|
||||
actor.prototype = aFactories[name].prototype;
|
||||
actor.parentID = this.actorID;
|
||||
this._extraActors[name] = actor;
|
||||
}
|
||||
aPool.addActor(actor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Append the extra actors in |this._extraActors|, constructed by a prior call
|
||||
* to CommonCreateExtraActors, to |aObject|.
|
||||
*
|
||||
* @param aObject
|
||||
* The object to which the extra actors should be added, under the
|
||||
* property names given in the |aFactories| table passed to
|
||||
* CommonCreateExtraActors.
|
||||
*
|
||||
* @param this
|
||||
* The BrowserRootActor or BrowserTabActor whose |_extraActors| table we
|
||||
* should use; see above.
|
||||
*/
|
||||
function CommonAppendExtraActors(aObject) {
|
||||
for (let name in this._extraActors) {
|
||||
let actor = this._extraActors[name];
|
||||
aObject[name] = actor.actorID;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a remote debugging protocol root actor.
|
||||
*
|
||||
|
@ -97,6 +35,11 @@ function CommonAppendExtraActors(aObject) {
|
|||
* notifications when the live list's contents change. One actor in
|
||||
* this list must have a true '.selected' property.
|
||||
*
|
||||
* - addonList: a live list (see below) of addon actors. If present, the
|
||||
* new root actor supports the 'listAddons' request, providing the live
|
||||
* list's elements as its addon actors, and sending 'addonListchanged'
|
||||
* notifications when the live list's contents change.
|
||||
*
|
||||
* - globalActorFactories: an object |A| describing further actors to
|
||||
* attach to the 'listTabs' reply. This is the type accumulated by
|
||||
* DebuggerServer.addGlobalActor. For each own property |P| of |A|,
|
||||
|
@ -118,9 +61,7 @@ function CommonAppendExtraActors(aObject) {
|
|||
* list of actors, and also notifies its clients of changes to the list. A
|
||||
* live list's interface is two properties:
|
||||
*
|
||||
* - iterator: a method that returns an iterator. A for-of loop will call
|
||||
* this method to obtain an iterator for the loop, so if LL is
|
||||
* a live list, one can simply write 'for (i of LL) ...'.
|
||||
* - getList: a method that returns a promise to the contents of the list.
|
||||
*
|
||||
* - onListChanged: a handler called, with no arguments, when the set of
|
||||
* values the iterator would produce has changed since the last
|
||||
|
@ -148,18 +89,92 @@ function CommonAppendExtraActors(aObject) {
|
|||
* actually produce any actors until they are reached in the course of
|
||||
* iteration: alliterative lazy live lists.
|
||||
*/
|
||||
|
||||
function RootActor(aConnection, aParameters) {
|
||||
this.conn = aConnection;
|
||||
this._parameters = aParameters;
|
||||
this._onTabListChanged = this.onTabListChanged.bind(this);
|
||||
this._onAddonListChanged = this.onAddonListChanged.bind(this);
|
||||
this._extraActors = {};
|
||||
|
||||
this._globalActorPool = new ActorPool(this.conn);
|
||||
this.conn.addActorPool(this._globalActorPool);
|
||||
|
||||
this._chromeActor = null;
|
||||
}
|
||||
|
||||
RootActor.prototype = {
|
||||
constructor: RootActor,
|
||||
applicationType: "browser",
|
||||
|
||||
traits: {
|
||||
sources: true,
|
||||
// Whether the inspector actor allows modifying outer HTML.
|
||||
editOuterHTML: true,
|
||||
// Whether the inspector actor allows modifying innerHTML and inserting
|
||||
// adjacent HTML.
|
||||
pasteHTML: true,
|
||||
// Whether the server-side highlighter actor exists and can be used to
|
||||
// remotely highlight nodes (see server/actors/highlighters.js)
|
||||
highlightable: true,
|
||||
// Which custom highlighter does the server-side highlighter actor supports?
|
||||
// (see server/actors/highlighters.js)
|
||||
customHighlighters: true,
|
||||
// Whether the inspector actor implements the getImageDataFromURL
|
||||
// method that returns data-uris for image URLs. This is used for image
|
||||
// tooltips for instance
|
||||
urlToImageDataResolver: true,
|
||||
networkMonitor: true,
|
||||
// Whether the storage inspector actor to inspect cookies, etc.
|
||||
storageInspector: true,
|
||||
// Whether storage inspector is read only
|
||||
storageInspectorReadOnly: true,
|
||||
// Whether conditional breakpoints are supported
|
||||
conditionalBreakpoints: true,
|
||||
// Whether the server supports full source actors (breakpoints on
|
||||
// eval scripts, etc)
|
||||
debuggerSourceActors: true,
|
||||
bulk: true,
|
||||
// Whether the style rule actor implements the modifySelector method
|
||||
// that modifies the rule's selector
|
||||
selectorEditable: true,
|
||||
// Whether the page style actor implements the addNewRule method that
|
||||
// adds new rules to the page
|
||||
addNewRule: true,
|
||||
// Whether the dom node actor implements the getUniqueSelector method
|
||||
getUniqueSelector: true,
|
||||
// Whether the director scripts are supported
|
||||
directorScripts: true,
|
||||
// Whether the debugger server supports
|
||||
// blackboxing/pretty-printing (not supported in Fever Dream yet)
|
||||
noBlackBoxing: false,
|
||||
noPrettyPrinting: false,
|
||||
// Whether the page style actor implements the getUsedFontFaces method
|
||||
// that returns the font faces used on a node
|
||||
getUsedFontFaces: true,
|
||||
// Trait added in Gecko 38, indicating that all features necessary for
|
||||
// grabbing allocations from the MemoryActor are available for the performance tool
|
||||
memoryActorAllocations: true,
|
||||
// Added in Gecko 40, indicating that the backend isn't stupid about
|
||||
// sending resumption packets on tab navigation.
|
||||
noNeedToFakeResumptionOnNavigation: true,
|
||||
// Added in Firefox 40. Indicates that the backend supports registering custom
|
||||
// commands through the WebConsoleCommands API.
|
||||
webConsoleCommands: true,
|
||||
// Whether root actor exposes tab actors
|
||||
// if allowChromeProcess is true, you can fetch a ChromeActor instance
|
||||
// to debug chrome and any non-content ressource via getProcess request
|
||||
// if allocChromeProcess is defined, but not true, it means that root actor
|
||||
// no longer expose tab actors, but also that getProcess forbids
|
||||
// exposing actors for security reasons
|
||||
get allowChromeProcess() {
|
||||
return DebuggerServer.allowChromeProcess;
|
||||
},
|
||||
// Whether or not `getProfile()` supports specifying a `startTime`
|
||||
// and `endTime` to filter out samples. Fx40+
|
||||
profilerDataFilterable: true,
|
||||
},
|
||||
|
||||
/**
|
||||
* Return a 'hello' packet as specified by the Remote Debugging Protocol.
|
||||
*/
|
||||
|
@ -169,23 +184,10 @@ RootActor.prototype = {
|
|||
applicationType: this.applicationType,
|
||||
/* This is not in the spec, but it's used by tests. */
|
||||
testConnectionPrefix: this.conn.prefix,
|
||||
traits: {
|
||||
sources: true,
|
||||
editOuterHTML: true
|
||||
}
|
||||
traits: this.traits
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* This is true for the root actor only, used by some child actors
|
||||
*/
|
||||
get isRootActor() true,
|
||||
|
||||
/**
|
||||
* The (chrome) window, for use by child actors
|
||||
*/
|
||||
get window() Services.wm.getMostRecentWindow(DebuggerServer.chromeWindowType),
|
||||
|
||||
/**
|
||||
* Disconnects the actor from the browser window.
|
||||
*/
|
||||
|
@ -201,6 +203,11 @@ RootActor.prototype = {
|
|||
this._parameters.onShutdown();
|
||||
}
|
||||
this._extraActors = null;
|
||||
this.conn = null;
|
||||
this._tabActorPool = null;
|
||||
this._globalActorPool = null;
|
||||
this._parameters = null;
|
||||
this._chromeActor = null;
|
||||
},
|
||||
|
||||
/* The 'listTabs' request and the 'tabListChanged' notification. */
|
||||
|
@ -235,10 +242,12 @@ RootActor.prototype = {
|
|||
newActorPool.addActor(tabActor);
|
||||
tabActorList.push(tabActor);
|
||||
}
|
||||
|
||||
/* DebuggerServer.addGlobalActor support: create actors. */
|
||||
this._createExtraActors(this._parameters.globalActorFactories, newActorPool);
|
||||
|
||||
if (!this._globalActorPool) {
|
||||
this._globalActorPool = new ActorPool(this.conn);
|
||||
this.conn.addActorPool(this._globalActorPool);
|
||||
}
|
||||
// this._createExtraActors(this._parameters.globalActorFactories, this._globalActorPool);
|
||||
/*
|
||||
* Drop the old actorID -> actor map. Actors that still mattered were
|
||||
* added to the new map; others will go away.
|
||||
|
@ -252,11 +261,16 @@ RootActor.prototype = {
|
|||
let reply = {
|
||||
"from": this.actorID,
|
||||
"selected": selected || 0,
|
||||
"tabs": [actor.form() for (actor of tabActorList)],
|
||||
"tabs": tabActorList.map(actor => actor.form())
|
||||
};
|
||||
|
||||
/* If a root window is accessible, include its URL. */
|
||||
if (this.url) {
|
||||
reply.url = this.url;
|
||||
}
|
||||
|
||||
/* DebuggerServer.addGlobalActor support: name actors in 'listTabs' reply. */
|
||||
this._appendExtraActors(reply);
|
||||
// this._appendExtraActors(reply);
|
||||
|
||||
/*
|
||||
* Now that we're actually going to report the contents of tabList to
|
||||
|
@ -269,6 +283,33 @@ RootActor.prototype = {
|
|||
});
|
||||
},
|
||||
|
||||
onGetTab: function (options) {
|
||||
let tabList = this._parameters.tabList;
|
||||
if (!tabList) {
|
||||
return { error: "noTabs",
|
||||
message: "This root actor has no browser tabs." };
|
||||
}
|
||||
if (!this._tabActorPool) {
|
||||
this._tabActorPool = new ActorPool(this.conn);
|
||||
this.conn.addActorPool(this._tabActorPool);
|
||||
}
|
||||
return tabList.getTab(options)
|
||||
.then(tabActor => {
|
||||
tabActor.parentID = this.actorID;
|
||||
this._tabActorPool.addActor(tabActor);
|
||||
|
||||
return { tab: tabActor.form() };
|
||||
}, error => {
|
||||
if (error.error) {
|
||||
// Pipe expected errors as-is to the client
|
||||
return error;
|
||||
} else {
|
||||
return { error: "noTab",
|
||||
message: "Unexpected error while calling getTab(): " + error };
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onTabListChanged: function () {
|
||||
this.conn.send({ from: this.actorID, type:"tabListChanged" });
|
||||
/* It's a one-shot notification; no need to watch any more. */
|
||||
|
@ -298,7 +339,7 @@ RootActor.prototype = {
|
|||
|
||||
return {
|
||||
"from": this.actorID,
|
||||
"addons": [addonActor.form() for (addonActor of addonActors)]
|
||||
"addons": addonActors.map(addonActor => addonActor.form())
|
||||
};
|
||||
});
|
||||
},
|
||||
|
@ -308,78 +349,96 @@ RootActor.prototype = {
|
|||
this._parameters.addonList.onListChanged = null;
|
||||
},
|
||||
|
||||
onListProcesses: function () {
|
||||
let processes = [];
|
||||
for (let i = 0; i < ppmm.childCount; i++) {
|
||||
processes.push({
|
||||
id: i, // XXX: may not be a perfect id, but process message manager doesn't expose anything...
|
||||
parent: i == 0, // XXX Weak, but appear to be stable
|
||||
tabCount: undefined, // TODO: exposes process message manager on frameloaders in order to compute this
|
||||
});
|
||||
}
|
||||
return { processes: processes };
|
||||
},
|
||||
|
||||
onGetProcess: function (aRequest) {
|
||||
if (!DebuggerServer.allowChromeProcess) {
|
||||
return { error: "forbidden",
|
||||
message: "You are not allowed to debug chrome." };
|
||||
}
|
||||
if (("id" in aRequest) && typeof(aRequest.id) != "number") {
|
||||
return { error: "wrongParameter",
|
||||
message: "getProcess requires a valid `id` attribute." };
|
||||
}
|
||||
// If the request doesn't contains id parameter or id is 0
|
||||
// (id == 0, based on onListProcesses implementation)
|
||||
if ((!("id" in aRequest)) || aRequest.id === 0) {
|
||||
if (!this._chromeActor) {
|
||||
// Create a ChromeActor for the parent process
|
||||
let { ChromeActor } = require("devtools/server/actors/chrome");
|
||||
this._chromeActor = new ChromeActor(this.conn);
|
||||
this._globalActorPool.addActor(this._chromeActor);
|
||||
}
|
||||
|
||||
return { form: this._chromeActor.form() };
|
||||
} else {
|
||||
let mm = ppmm.getChildAt(aRequest.id);
|
||||
if (!mm) {
|
||||
return { error: "noProcess",
|
||||
message: "There is no process with id '" + aRequest.id + "'." };
|
||||
}
|
||||
return DebuggerServer.connectToContent(this.conn, mm)
|
||||
.then(form => ({ form }));
|
||||
}
|
||||
},
|
||||
|
||||
/* This is not in the spec, but it's used by tests. */
|
||||
onEcho: function (aRequest) {
|
||||
/*
|
||||
* Request packets are frozen. Copy aRequest, so that
|
||||
* DebuggerServerConnection.onPacket can attach a 'from' property.
|
||||
*/
|
||||
return JSON.parse(JSON.stringify(aRequest));
|
||||
return Cu.cloneInto(aRequest, {});
|
||||
},
|
||||
|
||||
onProtocolDescription: function () {
|
||||
return require("devtools/server/protocol").dumpProtocolSpec();
|
||||
},
|
||||
|
||||
/* Support for DebuggerServer.addGlobalActor. */
|
||||
_createExtraActors: CommonCreateExtraActors,
|
||||
_appendExtraActors: CommonAppendExtraActors,
|
||||
|
||||
/* ThreadActor hooks. */
|
||||
// _createExtraActors: createExtraActors,
|
||||
// _appendExtraActors: appendExtraActors,
|
||||
|
||||
/**
|
||||
* Prepare to enter a nested event loop by disabling debuggee events.
|
||||
* Remove the extra actor (added by DebuggerServer.addGlobalActor or
|
||||
* DebuggerServer.addTabActor) name |aName|.
|
||||
*/
|
||||
preNest: function() {
|
||||
// Disable events in all open windows.
|
||||
let e = windowMediator.getEnumerator(null);
|
||||
while (e.hasMoreElements()) {
|
||||
let win = e.getNext();
|
||||
let windowUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
windowUtils.suppressEventHandling(true);
|
||||
windowUtils.suspendTimeouts();
|
||||
removeActorByName: function(aName) {
|
||||
if (aName in this._extraActors) {
|
||||
const actor = this._extraActors[aName];
|
||||
if (this._globalActorPool.has(actor)) {
|
||||
this._globalActorPool.removeActor(actor);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Prepare to exit a nested event loop by enabling debuggee events.
|
||||
*/
|
||||
postNest: function(aNestData) {
|
||||
// Enable events in all open windows.
|
||||
let e = windowMediator.getEnumerator(null);
|
||||
while (e.hasMoreElements()) {
|
||||
let win = e.getNext();
|
||||
let windowUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
windowUtils.resumeTimeouts();
|
||||
windowUtils.suppressEventHandling(false);
|
||||
if (this._tabActorPool) {
|
||||
// Iterate over TabActor instances to also remove tab actors
|
||||
// created during listTabs for each document.
|
||||
this._tabActorPool.forEach(tab => {
|
||||
tab.removeActorByName(aName);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/* ChromeDebuggerActor hooks. */
|
||||
|
||||
/**
|
||||
* Add the specified actor to the default actor pool connection, in order to
|
||||
* keep it alive as long as the server is. This is used by breakpoints in the
|
||||
* thread and chrome debugger actors.
|
||||
*
|
||||
* @param actor aActor
|
||||
* The actor object.
|
||||
*/
|
||||
addToParentPool: function(aActor) {
|
||||
this.conn.addActor(aActor);
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove the specified actor from the default actor pool.
|
||||
*
|
||||
* @param BreakpointActor aActor
|
||||
* The actor object.
|
||||
*/
|
||||
removeFromParentPool: function(aActor) {
|
||||
this.conn.removeActor(aActor);
|
||||
delete this._extraActors[aName];
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
RootActor.prototype.requestTypes = {
|
||||
"listTabs": RootActor.prototype.onListTabs,
|
||||
"getTab": RootActor.prototype.onGetTab,
|
||||
"listAddons": RootActor.prototype.onListAddons,
|
||||
"echo": RootActor.prototype.onEcho
|
||||
"listProcesses": RootActor.prototype.onListProcesses,
|
||||
"getProcess": RootActor.prototype.onGetProcess,
|
||||
"echo": RootActor.prototype.onEcho,
|
||||
"protocolDescription": RootActor.prototype.onProtocolDescription
|
||||
};
|
||||
|
||||
// exports.RootActor = RootActor;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,219 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const { noop } = DevToolsUtils;
|
||||
|
||||
/**
|
||||
* A `ScriptStore` is a cache of `Debugger.Script` instances. It holds strong
|
||||
* references to the cached scripts to alleviate the GC-sensitivity issues that
|
||||
* plague `Debugger.prototype.findScripts`, but this means that its lifetime
|
||||
* must be managed carefully. It is the `ScriptStore` user's responsibility to
|
||||
* ensure that the `ScriptStore` stays up to date.
|
||||
*
|
||||
* Implementation Notes:
|
||||
*
|
||||
* The ScriptStore's prototype methods are very hot, in general. To help the
|
||||
* JIT, they avoid ES6-isms and higher-order iteration functions, for the most
|
||||
* part. You might be wondering why we don't maintain indices on, say,
|
||||
* Debugger.Source for faster querying, if these methods are so hot. First, the
|
||||
* hottest method is actually just getting all scripts; second, populating the
|
||||
* store becomes prohibitively expensive. So we fall back to linear queries
|
||||
* (which isn't so bad, because Debugger.prototype.findScripts is also linear).
|
||||
*/
|
||||
function ScriptStore() {
|
||||
// Set of every Debugger.Script in the cache.
|
||||
this._scripts = new NoDeleteSet;
|
||||
}
|
||||
|
||||
// module.exports = ScriptStore;
|
||||
|
||||
ScriptStore.prototype = {
|
||||
// Populating a ScriptStore.
|
||||
|
||||
/**
|
||||
* Add one script to the cache.
|
||||
*
|
||||
* @param Debugger.Script script
|
||||
*/
|
||||
addScript: function(script) {
|
||||
this._scripts.add(script);
|
||||
},
|
||||
|
||||
/**
|
||||
* Add many scripts to the cache at once.
|
||||
*
|
||||
* @param Array scripts
|
||||
* The set of Debugger.Scripts to add to the cache.
|
||||
*/
|
||||
addScripts: function(scripts) {
|
||||
for (var i = 0, len = scripts.length; i < len; i++) {
|
||||
this.addScript(scripts[i]);
|
||||
}
|
||||
},
|
||||
|
||||
// Querying a ScriptStore.
|
||||
|
||||
/**
|
||||
* Get all the sources for which we have scripts cached.
|
||||
*
|
||||
* @returns Array of Debugger.Source
|
||||
*/
|
||||
getSources: function() {
|
||||
return [...new Set(this._scripts.items.map(s => s.source))];
|
||||
},
|
||||
|
||||
/**
|
||||
* Get all the scripts in the cache.
|
||||
*
|
||||
* @returns read-only Array of Debugger.Script.
|
||||
*
|
||||
* NB: The ScriptStore retains ownership of the returned array, and the
|
||||
* ScriptStore's consumers MUST NOT MODIFY its contents!
|
||||
*/
|
||||
getAllScripts: function() {
|
||||
return this._scripts.items;
|
||||
},
|
||||
|
||||
getScriptsBySourceActor: function(sourceActor) {
|
||||
return sourceActor.source ?
|
||||
this.getScriptsBySource(sourceActor.source) :
|
||||
this.getScriptsByURL(sourceActor._originalUrl);
|
||||
},
|
||||
|
||||
getScriptsBySourceActorAndLine: function(sourceActor, line) {
|
||||
return sourceActor.source ?
|
||||
this.getScriptsBySourceAndLine(sourceActor.source, line) :
|
||||
this.getScriptsByURLAndLine(sourceActor._originalUrl, line);
|
||||
},
|
||||
|
||||
/**
|
||||
* Get all scripts produced from the given source.
|
||||
*
|
||||
* @oaram Debugger.Source source
|
||||
* @returns Array of Debugger.Script
|
||||
*/
|
||||
getScriptsBySource: function(source) {
|
||||
var results = [];
|
||||
var scripts = this._scripts.items;
|
||||
var length = scripts.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (scripts[i].source === source) {
|
||||
results.push(scripts[i]);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get all scripts produced from the given source whose source code definition
|
||||
* spans the given line.
|
||||
*
|
||||
* @oaram Debugger.Source source
|
||||
* @param Number line
|
||||
* @returns Array of Debugger.Script
|
||||
*/
|
||||
getScriptsBySourceAndLine: function(source, line) {
|
||||
var results = [];
|
||||
var scripts = this._scripts.items;
|
||||
var length = scripts.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
var script = scripts[i];
|
||||
if (script.source === source &&
|
||||
script.startLine <= line &&
|
||||
(script.startLine + script.lineCount) > line) {
|
||||
results.push(script);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get all scripts defined by a source at the given URL.
|
||||
*
|
||||
* @param String url
|
||||
* @returns Array of Debugger.Script
|
||||
*/
|
||||
getScriptsByURL: function(url) {
|
||||
var results = [];
|
||||
var scripts = this._scripts.items;
|
||||
var length = scripts.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (scripts[i].url === url) {
|
||||
results.push(scripts[i]);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get all scripts defined by a source a the given URL and whose source code
|
||||
* definition spans the given line.
|
||||
*
|
||||
* @param String url
|
||||
* @param Number line
|
||||
* @returns Array of Debugger.Script
|
||||
*/
|
||||
getScriptsByURLAndLine: function(url, line) {
|
||||
var results = [];
|
||||
var scripts = this._scripts.items;
|
||||
var length = scripts.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
var script = scripts[i];
|
||||
if (script.url === url &&
|
||||
script.startLine <= line &&
|
||||
(script.startLine + script.lineCount) > line) {
|
||||
results.push(script);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A set which can only grow, and does not support the delete operation.
|
||||
* Provides faster iteration than the native Set by maintaining an array of all
|
||||
* items, in addition to the internal set of all items, which allows direct
|
||||
* iteration (without the iteration protocol and calling into C++, which are
|
||||
* both expensive).
|
||||
*/
|
||||
function NoDeleteSet() {
|
||||
this._set = new Set();
|
||||
this.items = [];
|
||||
}
|
||||
|
||||
NoDeleteSet.prototype = {
|
||||
/**
|
||||
* An array containing every item in the set for convenience and faster
|
||||
* iteration. This is public for reading only, and consumers MUST NOT modify
|
||||
* this array!
|
||||
*/
|
||||
items: null,
|
||||
|
||||
/**
|
||||
* Add an item to the set.
|
||||
*
|
||||
* @param any item
|
||||
*/
|
||||
add: function(item) {
|
||||
if (!this._set.has(item)) {
|
||||
this._set.add(item);
|
||||
this.items.push(item);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Return true if the item is in the set, false otherwise.
|
||||
*
|
||||
* @param any item
|
||||
* @returns Boolean
|
||||
*/
|
||||
has: function(item) {
|
||||
return this._set.has(item);
|
||||
}
|
||||
};
|
|
@ -0,0 +1,805 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
// const { Ci, Cu } = require("chrome");
|
||||
// const Services = require("Services");
|
||||
// const DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
|
||||
// const { dbg_assert, fetch } = DevToolsUtils;
|
||||
// const EventEmitter = require("devtools/toolkit/event-emitter");
|
||||
// const { OriginalLocation, GeneratedLocation, getOffsetColumn } = require("devtools/server/actors/common");
|
||||
// const { resolve } = require("promise");
|
||||
|
||||
// loader.lazyRequireGetter(this, "SourceActor", "devtools/server/actors/script", true);
|
||||
// loader.lazyRequireGetter(this, "isEvalSource", "devtools/server/actors/script", true);
|
||||
// loader.lazyRequireGetter(this, "SourceMapConsumer", "source-map", true);
|
||||
// loader.lazyRequireGetter(this, "SourceMapGenerator", "source-map", true);
|
||||
|
||||
/**
|
||||
* Manages the sources for a thread. Handles source maps, locations in the
|
||||
* sources, etc for ThreadActors.
|
||||
*/
|
||||
function TabSources(threadActor, allowSourceFn=() => true) {
|
||||
EventEmitter.decorate(this);
|
||||
|
||||
this._thread = threadActor;
|
||||
this._useSourceMaps = true;
|
||||
this._autoBlackBox = true;
|
||||
this._anonSourceMapId = 1;
|
||||
this.allowSource = source => {
|
||||
return !isHiddenSource(source) && allowSourceFn(source);
|
||||
}
|
||||
|
||||
this.blackBoxedSources = new Set();
|
||||
this.prettyPrintedSources = new Map();
|
||||
|
||||
// generated Debugger.Source -> promise of SourceMapConsumer
|
||||
this._sourceMaps = new Map();
|
||||
// sourceMapURL -> promise of SourceMapConsumer
|
||||
this._sourceMapCache = Object.create(null);
|
||||
// Debugger.Source -> SourceActor
|
||||
this._sourceActors = new Map();
|
||||
// url -> SourceActor
|
||||
this._sourceMappedSourceActors = Object.create(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Matches strings of the form "foo.min.js" or "foo-min.js", etc. If the regular
|
||||
* expression matches, we can be fairly sure that the source is minified, and
|
||||
* treat it as such.
|
||||
*/
|
||||
const MINIFIED_SOURCE_REGEXP = /\bmin\.js$/;
|
||||
|
||||
TabSources.prototype = {
|
||||
/**
|
||||
* Update preferences and clear out existing sources
|
||||
*/
|
||||
reconfigure: function(options) {
|
||||
if ('useSourceMaps' in options) {
|
||||
this._useSourceMaps = options.useSourceMaps;
|
||||
}
|
||||
|
||||
if ('autoBlackBox' in options) {
|
||||
this._autoBlackBox = options.autoBlackBox;
|
||||
}
|
||||
|
||||
this.reset();
|
||||
},
|
||||
|
||||
/**
|
||||
* Clear existing sources so they are recreated on the next access.
|
||||
*
|
||||
* @param Object opts
|
||||
* Specify { sourceMaps: true } if you also want to clear
|
||||
* the source map cache (usually done on reload).
|
||||
*/
|
||||
reset: function(opts={}) {
|
||||
this._sourceActors = new Map();
|
||||
this._sourceMaps = new Map();
|
||||
this._sourceMappedSourceActors = Object.create(null);
|
||||
|
||||
if (opts.sourceMaps) {
|
||||
this._sourceMapCache = Object.create(null);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the source actor representing the `source` (or
|
||||
* `originalUrl`), creating one if none exists already. May return
|
||||
* null if the source is disallowed.
|
||||
*
|
||||
* @param Debugger.Source source
|
||||
* The source to make an actor for
|
||||
* @param String originalUrl
|
||||
* The original source URL of a sourcemapped source
|
||||
* @param optional Debguger.Source generatedSource
|
||||
* The generated source that introduced this source via source map,
|
||||
* if any.
|
||||
* @param optional String contentType
|
||||
* The content type of the source, if immediately available.
|
||||
* @returns a SourceActor representing the source or null.
|
||||
*/
|
||||
source: function ({ source, originalUrl, generatedSource,
|
||||
isInlineSource, contentType }) {
|
||||
dbg_assert(source || (originalUrl && generatedSource),
|
||||
"TabSources.prototype.source needs an originalUrl or a source");
|
||||
|
||||
if (source) {
|
||||
// If a source is passed, we are creating an actor for a real
|
||||
// source, which may or may not be sourcemapped.
|
||||
|
||||
if (!this.allowSource(source)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// It's a hack, but inline HTML scripts each have real sources,
|
||||
// but we want to represent all of them as one source as the
|
||||
// HTML page. The actor representing this fake HTML source is
|
||||
// stored in this array, which always has a URL, so check it
|
||||
// first.
|
||||
if (source.url in this._sourceMappedSourceActors) {
|
||||
return this._sourceMappedSourceActors[source.url];
|
||||
}
|
||||
|
||||
if (isInlineSource) {
|
||||
// If it's an inline source, the fake HTML source hasn't been
|
||||
// created yet (would have returned above), so flip this source
|
||||
// into a sourcemapped state by giving it an `originalUrl` which
|
||||
// is the HTML url.
|
||||
originalUrl = source.url;
|
||||
source = null;
|
||||
}
|
||||
else if (this._sourceActors.has(source)) {
|
||||
return this._sourceActors.get(source);
|
||||
}
|
||||
}
|
||||
else if (originalUrl) {
|
||||
// Not all "original" scripts are distinctly separate from the
|
||||
// generated script. Pretty-printed sources have a sourcemap for
|
||||
// themselves, so we need to make sure there a real source
|
||||
// doesn't already exist with this URL.
|
||||
for (let [source, actor] of this._sourceActors) {
|
||||
if (source.url === originalUrl) {
|
||||
return actor;
|
||||
}
|
||||
}
|
||||
|
||||
if (originalUrl in this._sourceMappedSourceActors) {
|
||||
return this._sourceMappedSourceActors[originalUrl];
|
||||
}
|
||||
}
|
||||
|
||||
let actor = new SourceActor({
|
||||
thread: this._thread,
|
||||
source: source,
|
||||
originalUrl: originalUrl,
|
||||
generatedSource: generatedSource,
|
||||
isInlineSource: isInlineSource,
|
||||
contentType: contentType
|
||||
});
|
||||
|
||||
let sourceActorStore = this._thread.sourceActorStore;
|
||||
var id = sourceActorStore.getReusableActorId(source, originalUrl);
|
||||
if (id) {
|
||||
actor.actorID = id;
|
||||
}
|
||||
|
||||
this._thread.threadLifetimePool.addActor(actor);
|
||||
sourceActorStore.setReusableActorId(source, originalUrl, actor.actorID);
|
||||
|
||||
if (this._autoBlackBox && this._isMinifiedURL(actor.url)) {
|
||||
this.blackBox(actor.url);
|
||||
}
|
||||
|
||||
if (source) {
|
||||
this._sourceActors.set(source, actor);
|
||||
}
|
||||
else {
|
||||
this._sourceMappedSourceActors[originalUrl] = actor;
|
||||
}
|
||||
|
||||
this._emitNewSource(actor);
|
||||
return actor;
|
||||
},
|
||||
|
||||
_emitNewSource: function(actor) {
|
||||
if (!actor.source) {
|
||||
// Always notify if we don't have a source because that means
|
||||
// it's something that has been sourcemapped, or it represents
|
||||
// the HTML file that contains inline sources.
|
||||
this.emit('newSource', actor);
|
||||
}
|
||||
else {
|
||||
// If sourcemapping is enabled and a source has sourcemaps, we
|
||||
// create `SourceActor` instances for both the original and
|
||||
// generated sources. The source actors for the generated
|
||||
// sources are only for internal use, however; breakpoints are
|
||||
// managed by these internal actors. We only want to notify the
|
||||
// user of the original sources though, so if the actor has a
|
||||
// `Debugger.Source` instance and a valid source map (meaning
|
||||
// it's a generated source), don't send the notification.
|
||||
this.fetchSourceMap(actor.source).then(map => {
|
||||
if (!map) {
|
||||
this.emit('newSource', actor);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
getSourceActor: function(source) {
|
||||
if (source.url in this._sourceMappedSourceActors) {
|
||||
return this._sourceMappedSourceActors[source.url];
|
||||
}
|
||||
|
||||
if (this._sourceActors.has(source)) {
|
||||
return this._sourceActors.get(source);
|
||||
}
|
||||
|
||||
throw new Error('getSource: could not find source actor for ' +
|
||||
(source.url || 'source'));
|
||||
},
|
||||
|
||||
getSourceActorByURL: function(url) {
|
||||
if (url) {
|
||||
for (let [source, actor] of this._sourceActors) {
|
||||
if (source.url === url) {
|
||||
return actor;
|
||||
}
|
||||
}
|
||||
|
||||
if (url in this._sourceMappedSourceActors) {
|
||||
return this._sourceMappedSourceActors[url];
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error('getSourceByURL: could not find source for ' + url);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if the URL likely points to a minified resource, false
|
||||
* otherwise.
|
||||
*
|
||||
* @param String aURL
|
||||
* The URL to test.
|
||||
* @returns Boolean
|
||||
*/
|
||||
_isMinifiedURL: function (aURL) {
|
||||
try {
|
||||
let url = Services.io.newURI(aURL, null, null)
|
||||
.QueryInterface(Ci.nsIURL);
|
||||
return MINIFIED_SOURCE_REGEXP.test(url.fileName);
|
||||
} catch (e) {
|
||||
// Not a valid URL so don't try to parse out the filename, just test the
|
||||
// whole thing with the minified source regexp.
|
||||
return MINIFIED_SOURCE_REGEXP.test(aURL);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a source actor representing this source. This ignores
|
||||
* source mapping and always returns an actor representing this real
|
||||
* source. Use `createSourceActors` if you want to respect source maps.
|
||||
*
|
||||
* @param Debugger.Source aSource
|
||||
* The source instance to create an actor for.
|
||||
* @returns SourceActor
|
||||
*/
|
||||
createNonSourceMappedActor: function (aSource) {
|
||||
// Don't use getSourceURL because we don't want to consider the
|
||||
// displayURL property if it's an eval source. We only want to
|
||||
// consider real URLs, otherwise if there is a URL but it's
|
||||
// invalid the code below will not set the content type, and we
|
||||
// will later try to fetch the contents of the URL to figure out
|
||||
// the content type, but it's a made up URL for eval sources.
|
||||
let url = isEvalSource(aSource) ? null : aSource.url;
|
||||
let spec = { source: aSource };
|
||||
|
||||
// XXX bug 915433: We can't rely on Debugger.Source.prototype.text
|
||||
// if the source is an HTML-embedded <script> tag. Since we don't
|
||||
// have an API implemented to detect whether this is the case, we
|
||||
// need to be conservative and only treat valid js files as real
|
||||
// sources. Otherwise, use the `originalUrl` property to treat it
|
||||
// as an HTML source that manages multiple inline sources.
|
||||
|
||||
// Assume the source is inline if the element that introduced it is not a
|
||||
// script element, or does not have a src attribute.
|
||||
let element = aSource.element ? aSource.element.unsafeDereference() : null;
|
||||
if (element && (element.tagName !== "SCRIPT" || !element.hasAttribute("src"))) {
|
||||
spec.isInlineSource = true;
|
||||
} else {
|
||||
if (url) {
|
||||
try {
|
||||
let urlInfo = Services.io.newURI(url, null, null).QueryInterface(Ci.nsIURL);
|
||||
if (urlInfo.fileExtension === "xml") {
|
||||
// XUL inline scripts may not correctly have the
|
||||
// `source.element` property, so do a blunt check here if
|
||||
// it's an xml page.
|
||||
spec.isInlineSource = true;
|
||||
}
|
||||
else if (urlInfo.fileExtension === "js") {
|
||||
spec.contentType = "text/javascript";
|
||||
}
|
||||
} catch(ex) {
|
||||
// There are a few special URLs that we know are JavaScript:
|
||||
// inline `javascript:` and code coming from the console
|
||||
if (url.indexOf("javascript:") === 0 || url === 'debugger eval code') {
|
||||
spec.contentType = "text/javascript";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Assume the content is javascript if there's no URL
|
||||
spec.contentType = "text/javascript";
|
||||
}
|
||||
}
|
||||
return this.source(spec);
|
||||
},
|
||||
|
||||
/**
|
||||
* This is an internal function that returns a promise of an array
|
||||
* of source actors representing all the source mapped sources of
|
||||
* `aSource`, or `null` if the source is not sourcemapped or
|
||||
* sourcemapping is disabled. Users should call `createSourceActors`
|
||||
* instead of this.
|
||||
*
|
||||
* @param Debugger.Source aSource
|
||||
* The source instance to create actors for.
|
||||
* @return Promise of an array of source actors
|
||||
*/
|
||||
_createSourceMappedActors: function (aSource) {
|
||||
if (!this._useSourceMaps || !aSource.sourceMapURL) {
|
||||
return resolve(null);
|
||||
}
|
||||
|
||||
return this.fetchSourceMap(aSource)
|
||||
.then(map => {
|
||||
if (map) {
|
||||
return map.sources.map(s => {
|
||||
return this.source({ originalUrl: s, generatedSource: aSource });
|
||||
}).filter(isNotNull);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates the source actors representing the appropriate sources
|
||||
* of `aSource`. If sourcemapped, returns actors for all of the original
|
||||
* sources, otherwise returns a 1-element array with the actor for
|
||||
* `aSource`.
|
||||
*
|
||||
* @param Debugger.Source aSource
|
||||
* The source instance to create actors for.
|
||||
* @param Promise of an array of source actors
|
||||
*/
|
||||
createSourceActors: function(aSource) {
|
||||
return this._createSourceMappedActors(aSource).then(actors => {
|
||||
let actor = this.createNonSourceMappedActor(aSource);
|
||||
return (actors || [actor]).filter(isNotNull);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Return a promise of a SourceMapConsumer for the source map for
|
||||
* `aSource`; if we already have such a promise extant, return that.
|
||||
* This will fetch the source map if we don't have a cached object
|
||||
* and source maps are enabled (see `_fetchSourceMap`).
|
||||
*
|
||||
* @param Debugger.Source aSource
|
||||
* The source instance to get sourcemaps for.
|
||||
* @return Promise of a SourceMapConsumer
|
||||
*/
|
||||
fetchSourceMap: function (aSource) {
|
||||
if (this._sourceMaps.has(aSource)) {
|
||||
return this._sourceMaps.get(aSource);
|
||||
}
|
||||
else if (!aSource || !aSource.sourceMapURL) {
|
||||
return resolve(null);
|
||||
}
|
||||
|
||||
let sourceMapURL = aSource.sourceMapURL;
|
||||
if (aSource.url) {
|
||||
sourceMapURL = this._normalize(sourceMapURL, aSource.url);
|
||||
}
|
||||
let result = this._fetchSourceMap(sourceMapURL, aSource.url);
|
||||
|
||||
// The promises in `_sourceMaps` must be the exact same instances
|
||||
// as returned by `_fetchSourceMap` for `clearSourceMapCache` to work.
|
||||
this._sourceMaps.set(aSource, result);
|
||||
return result;
|
||||
},
|
||||
|
||||
/**
|
||||
* Return a promise of a SourceMapConsumer for the source map for
|
||||
* `aSource`. The resolved result may be null if the source does not
|
||||
* have a source map or source maps are disabled.
|
||||
*/
|
||||
getSourceMap: function(aSource) {
|
||||
return resolve(this._sourceMaps.get(aSource));
|
||||
},
|
||||
|
||||
/**
|
||||
* Set a SourceMapConsumer for the source map for
|
||||
* |aSource|.
|
||||
*/
|
||||
setSourceMap: function(aSource, aMap) {
|
||||
this._sourceMaps.set(aSource, resolve(aMap));
|
||||
},
|
||||
|
||||
/**
|
||||
* Return a promise of a SourceMapConsumer for the source map located at
|
||||
* |aAbsSourceMapURL|, which must be absolute. If there is already such a
|
||||
* promise extant, return it. This will not fetch if source maps are
|
||||
* disabled.
|
||||
*
|
||||
* @param string aAbsSourceMapURL
|
||||
* The source map URL, in absolute form, not relative.
|
||||
* @param string aScriptURL
|
||||
* When the source map URL is a data URI, there is no sourceRoot on the
|
||||
* source map, and the source map's sources are relative, we resolve
|
||||
* them from aScriptURL.
|
||||
*/
|
||||
_fetchSourceMap: function (aAbsSourceMapURL, aSourceURL) {
|
||||
if (!this._useSourceMaps) {
|
||||
return resolve(null);
|
||||
}
|
||||
else if (this._sourceMapCache[aAbsSourceMapURL]) {
|
||||
return this._sourceMapCache[aAbsSourceMapURL];
|
||||
}
|
||||
|
||||
let fetching = fetch(aAbsSourceMapURL, { loadFromCache: false })
|
||||
.then(({ content }) => {
|
||||
let map = new SourceMapConsumer(content);
|
||||
this._setSourceMapRoot(map, aAbsSourceMapURL, aSourceURL);
|
||||
return map;
|
||||
})
|
||||
.then(null, error => {
|
||||
if (!DevToolsUtils.reportingDisabled) {
|
||||
DevToolsUtils.reportException("TabSources.prototype._fetchSourceMap", error);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
this._sourceMapCache[aAbsSourceMapURL] = fetching;
|
||||
return fetching;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the source map's sourceRoot to be relative to the source map url.
|
||||
*/
|
||||
_setSourceMapRoot: function (aSourceMap, aAbsSourceMapURL, aScriptURL) {
|
||||
// No need to do this fiddling if we won't be fetching any sources over the
|
||||
// wire.
|
||||
if (aSourceMap.hasContentsOfAllSources()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const base = this._dirname(
|
||||
aAbsSourceMapURL.indexOf("data:") === 0
|
||||
? aScriptURL
|
||||
: aAbsSourceMapURL);
|
||||
aSourceMap.sourceRoot = aSourceMap.sourceRoot
|
||||
? this._normalize(aSourceMap.sourceRoot, base)
|
||||
: base;
|
||||
},
|
||||
|
||||
_dirname: function (aPath) {
|
||||
return Services.io.newURI(
|
||||
".", null, Services.io.newURI(aPath, null, null)).spec;
|
||||
},
|
||||
|
||||
/**
|
||||
* Clears the source map cache. Source maps are cached by URL so
|
||||
* they can be reused across separate Debugger instances (once in
|
||||
* this cache, they will never be reparsed again). They are
|
||||
* also cached by Debugger.Source objects for usefulness. By default
|
||||
* this just removes the Debugger.Source cache, but you can remove
|
||||
* the lower-level URL cache with the `hard` option.
|
||||
*
|
||||
* @param aSourceMapURL string
|
||||
* The source map URL to uncache
|
||||
* @param opts object
|
||||
* An object with the following properties:
|
||||
* - hard: Also remove the lower-level URL cache, which will
|
||||
* make us completely forget about the source map.
|
||||
*/
|
||||
clearSourceMapCache: function(aSourceMapURL, opts = { hard: false }) {
|
||||
let oldSm = this._sourceMapCache[aSourceMapURL];
|
||||
|
||||
if (opts.hard) {
|
||||
delete this._sourceMapCache[aSourceMapURL];
|
||||
}
|
||||
|
||||
if (oldSm) {
|
||||
// Clear out the current cache so all sources will get the new one
|
||||
for (let [source, sm] of this._sourceMaps.entries()) {
|
||||
if (sm === oldSm) {
|
||||
this._sourceMaps.delete(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* Forcefully change the source map of a source, changing the
|
||||
* sourceMapURL and installing the source map in the cache. This is
|
||||
* necessary to expose changes across Debugger instances
|
||||
* (pretty-printing is the use case). Generate a random url if one
|
||||
* isn't specified, allowing you to set "anonymous" source maps.
|
||||
*
|
||||
* @param aSource Debugger.Source
|
||||
* The source to change the sourceMapURL property
|
||||
* @param aUrl string
|
||||
* The source map URL (optional)
|
||||
* @param aMap SourceMapConsumer
|
||||
* The source map instance
|
||||
*/
|
||||
setSourceMapHard: function(aSource, aUrl, aMap) {
|
||||
let url = aUrl;
|
||||
if (!url) {
|
||||
// This is a littly hacky, but we want to forcefully set a
|
||||
// sourcemap regardless of sourcemap settings. We want to
|
||||
// literally change the sourceMapURL so that all debuggers will
|
||||
// get this and pretty-printing will Just Work (Debugger.Source
|
||||
// instances are per-debugger, so we can't key off that). To
|
||||
// avoid tons of work serializing the sourcemap into a data url,
|
||||
// just make a fake URL and stick the sourcemap there.
|
||||
url = "internal://sourcemap" + (this._anonSourceMapId++) + '/';
|
||||
}
|
||||
aSource.sourceMapURL = url;
|
||||
|
||||
// Forcefully set the sourcemap cache. This will be used even if
|
||||
// sourcemaps are disabled.
|
||||
this._sourceMapCache[url] = resolve(aMap);
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the non-source-mapped location of the given Debugger.Frame. If the
|
||||
* frame does not have a script, the location's properties are all null.
|
||||
*
|
||||
* @param Debugger.Frame aFrame
|
||||
* The frame whose location we are getting.
|
||||
* @returns Object
|
||||
* Returns an object of the form { source, line, column }
|
||||
*/
|
||||
getFrameLocation: function (aFrame) {
|
||||
if (!aFrame || !aFrame.script) {
|
||||
return new GeneratedLocation();
|
||||
}
|
||||
|
||||
return new GeneratedLocation(
|
||||
this.createNonSourceMappedActor(aFrame.script.source),
|
||||
aFrame.script.getOffsetLine(aFrame.offset),
|
||||
getOffsetColumn(aFrame.offset, aFrame.script)
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a promise of the location in the original source if the source is
|
||||
* source mapped, otherwise a promise of the same location. This can
|
||||
* be called with a source from *any* Debugger instance and we make
|
||||
* sure to that it works properly, reusing source maps if already
|
||||
* fetched. Use this from any actor that needs sourcemapping.
|
||||
*/
|
||||
getOriginalLocation: function (generatedLocation) {
|
||||
let {
|
||||
generatedSourceActor,
|
||||
generatedLine,
|
||||
generatedColumn
|
||||
} = generatedLocation;
|
||||
let source = generatedSourceActor.source;
|
||||
let url = source ? source.url : generatedSourceActor._originalUrl;
|
||||
|
||||
// In certain scenarios the source map may have not been fetched
|
||||
// yet (or at least tied to this Debugger.Source instance), so use
|
||||
// `fetchSourceMap` instead of `getSourceMap`. This allows this
|
||||
// function to be called from anywere (across debuggers) and it
|
||||
// should just automatically work.
|
||||
return this.fetchSourceMap(source).then(map => {
|
||||
if (map) {
|
||||
let {
|
||||
source: originalUrl,
|
||||
line: originalLine,
|
||||
column: originalColumn,
|
||||
name: originalName
|
||||
} = map.originalPositionFor({
|
||||
line: generatedLine,
|
||||
column: generatedColumn == null ? Infinity : generatedColumn
|
||||
});
|
||||
|
||||
// Since the `Debugger.Source` instance may come from a
|
||||
// different `Debugger` instance (any actor can call this
|
||||
// method), we can't rely on any of the source discovery
|
||||
// setup (`_discoverSources`, etc) to have been run yet. So
|
||||
// we have to assume that the actor may not already exist,
|
||||
// and we might need to create it, so use `source` and give
|
||||
// it the required parameters for a sourcemapped source.
|
||||
return new OriginalLocation(
|
||||
originalUrl ? this.source({
|
||||
originalUrl: originalUrl,
|
||||
generatedSource: source
|
||||
}) : null,
|
||||
originalLine,
|
||||
originalColumn,
|
||||
originalName
|
||||
);
|
||||
}
|
||||
|
||||
// No source map
|
||||
return OriginalLocation.fromGeneratedLocation(generatedLocation);
|
||||
});
|
||||
},
|
||||
|
||||
getAllGeneratedLocations: function (originalLocation) {
|
||||
let {
|
||||
originalSourceActor,
|
||||
originalLine,
|
||||
originalColumn
|
||||
} = originalLocation;
|
||||
|
||||
let source = originalSourceActor.source ||
|
||||
originalSourceActor.generatedSource;
|
||||
|
||||
return this.fetchSourceMap(source).then((map) => {
|
||||
if (map) {
|
||||
map.computeColumnSpans();
|
||||
|
||||
return map.allGeneratedPositionsFor({
|
||||
source: originalSourceActor.url,
|
||||
line: originalLine,
|
||||
column: originalColumn
|
||||
}).map(({ line, column, lastColumn }) => {
|
||||
return new GeneratedLocation(
|
||||
this.createNonSourceMappedActor(source),
|
||||
line,
|
||||
column,
|
||||
lastColumn
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
return [GeneratedLocation.fromOriginalLocation(originalLocation)];
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Returns a promise of the location in the generated source corresponding to
|
||||
* the original source and line given.
|
||||
*
|
||||
* When we pass a script S representing generated code to `sourceMap`,
|
||||
* above, that returns a promise P. The process of resolving P populates
|
||||
* the tables this function uses; thus, it won't know that S's original
|
||||
* source URLs map to S until P is resolved.
|
||||
*/
|
||||
getGeneratedLocation: function (originalLocation) {
|
||||
let { originalSourceActor } = originalLocation;
|
||||
|
||||
// Both original sources and normal sources could have sourcemaps,
|
||||
// because normal sources can be pretty-printed which generates a
|
||||
// sourcemap for itself. Check both of the source properties to make it work
|
||||
// for both kinds of sources.
|
||||
let source = originalSourceActor.source || originalSourceActor.generatedSource;
|
||||
|
||||
// See comment about `fetchSourceMap` in `getOriginalLocation`.
|
||||
return this.fetchSourceMap(source).then((map) => {
|
||||
if (map) {
|
||||
let {
|
||||
originalLine,
|
||||
originalColumn
|
||||
} = originalLocation;
|
||||
|
||||
let {
|
||||
line: generatedLine,
|
||||
column: generatedColumn
|
||||
} = map.generatedPositionFor({
|
||||
source: originalSourceActor.url,
|
||||
line: originalLine,
|
||||
column: originalColumn == null ? 0 : originalColumn,
|
||||
bias: SourceMapConsumer.LEAST_UPPER_BOUND
|
||||
});
|
||||
|
||||
return new GeneratedLocation(
|
||||
this.createNonSourceMappedActor(source),
|
||||
generatedLine,
|
||||
generatedColumn
|
||||
);
|
||||
}
|
||||
|
||||
return GeneratedLocation.fromOriginalLocation(originalLocation);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if URL for the given source is black boxed.
|
||||
*
|
||||
* @param aURL String
|
||||
* The URL of the source which we are checking whether it is black
|
||||
* boxed or not.
|
||||
*/
|
||||
isBlackBoxed: function (aURL) {
|
||||
return this.blackBoxedSources.has(aURL);
|
||||
},
|
||||
|
||||
/**
|
||||
* Add the given source URL to the set of sources that are black boxed.
|
||||
*
|
||||
* @param aURL String
|
||||
* The URL of the source which we are black boxing.
|
||||
*/
|
||||
blackBox: function (aURL) {
|
||||
this.blackBoxedSources.add(aURL);
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove the given source URL to the set of sources that are black boxed.
|
||||
*
|
||||
* @param aURL String
|
||||
* The URL of the source which we are no longer black boxing.
|
||||
*/
|
||||
unblackBox: function (aURL) {
|
||||
this.blackBoxedSources.delete(aURL);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if the given URL is pretty printed.
|
||||
*
|
||||
* @param aURL String
|
||||
* The URL of the source that might be pretty printed.
|
||||
*/
|
||||
isPrettyPrinted: function (aURL) {
|
||||
return this.prettyPrintedSources.has(aURL);
|
||||
},
|
||||
|
||||
/**
|
||||
* Add the given URL to the set of sources that are pretty printed.
|
||||
*
|
||||
* @param aURL String
|
||||
* The URL of the source to be pretty printed.
|
||||
*/
|
||||
prettyPrint: function (aURL, aIndent) {
|
||||
this.prettyPrintedSources.set(aURL, aIndent);
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the indent the given URL was pretty printed by.
|
||||
*/
|
||||
prettyPrintIndent: function (aURL) {
|
||||
return this.prettyPrintedSources.get(aURL);
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove the given URL from the set of sources that are pretty printed.
|
||||
*
|
||||
* @param aURL String
|
||||
* The URL of the source that is no longer pretty printed.
|
||||
*/
|
||||
disablePrettyPrint: function (aURL) {
|
||||
this.prettyPrintedSources.delete(aURL);
|
||||
},
|
||||
|
||||
/**
|
||||
* Normalize multiple relative paths towards the base paths on the right.
|
||||
*/
|
||||
_normalize: function (...aURLs) {
|
||||
dbg_assert(aURLs.length > 1, "Should have more than 1 URL");
|
||||
let base = Services.io.newURI(aURLs.pop(), null, null);
|
||||
let url;
|
||||
while ((url = aURLs.pop())) {
|
||||
base = Services.io.newURI(url, null, base);
|
||||
}
|
||||
return base.spec;
|
||||
},
|
||||
|
||||
iter: function () {
|
||||
let actors = Object.keys(this._sourceMappedSourceActors).map(k => {
|
||||
return this._sourceMappedSourceActors[k];
|
||||
});
|
||||
for (let actor of this._sourceActors.values()) {
|
||||
if (!this._sourceMaps.has(actor.source)) {
|
||||
actors.push(actor);
|
||||
}
|
||||
}
|
||||
return actors;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Checks if a source should never be displayed to the user because
|
||||
* it's either internal or we don't support in the UI yet.
|
||||
*/
|
||||
function isHiddenSource(aSource) {
|
||||
// Ignore the internal Function.prototype script
|
||||
return aSource.text === '() {\n}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if its argument is not null.
|
||||
*/
|
||||
function isNotNull(aThing) {
|
||||
return aThing !== null;
|
||||
}
|
||||
|
||||
exports.TabSources = TabSources;
|
||||
exports.isHiddenSource = isHiddenSource;
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,217 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
* EventEmitter.
|
||||
*/
|
||||
|
||||
// (function (factory) { // Module boilerplate
|
||||
// if (this.module && module.id.indexOf("event-emitter") >= 0) { // require
|
||||
// factory.call(this, require, exports, module);
|
||||
// } else { // Cu.import
|
||||
// const Cu = Components.utils;
|
||||
// const { require } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
// this.isWorker = false;
|
||||
// this.promise = Cu.import("resource://gre/modules/Promise.jsm", {}).Promise;
|
||||
// factory.call(this, require, this, { exports: this });
|
||||
// this.EXPORTED_SYMBOLS = ["EventEmitter"];
|
||||
// }
|
||||
// }).call(this, function (require, exports, module) {
|
||||
|
||||
this.EventEmitter = function EventEmitter() {};
|
||||
// module.exports = EventEmitter;
|
||||
|
||||
// const { Cu, components } = require("chrome");
|
||||
// const Services = require("Services");
|
||||
// const promise = require("promise");
|
||||
var loggingEnabled = true;
|
||||
|
||||
// if (!isWorker) {
|
||||
// loggingEnabled = Services.prefs.getBoolPref("devtools.dump.emit");
|
||||
// Services.prefs.addObserver("devtools.dump.emit", {
|
||||
// observe: () => {
|
||||
// loggingEnabled = Services.prefs.getBoolPref("devtools.dump.emit");
|
||||
// }
|
||||
// }, false);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Decorate an object with event emitter functionality.
|
||||
*
|
||||
* @param Object aObjectToDecorate
|
||||
* Bind all public methods of EventEmitter to
|
||||
* the aObjectToDecorate object.
|
||||
*/
|
||||
EventEmitter.decorate = function EventEmitter_decorate (aObjectToDecorate) {
|
||||
let emitter = new EventEmitter();
|
||||
aObjectToDecorate.on = emitter.on.bind(emitter);
|
||||
aObjectToDecorate.off = emitter.off.bind(emitter);
|
||||
aObjectToDecorate.once = emitter.once.bind(emitter);
|
||||
aObjectToDecorate.emit = emitter.emit.bind(emitter);
|
||||
};
|
||||
|
||||
EventEmitter.prototype = {
|
||||
/**
|
||||
* Connect a listener.
|
||||
*
|
||||
* @param string aEvent
|
||||
* The event name to which we're connecting.
|
||||
* @param function aListener
|
||||
* Called when the event is fired.
|
||||
*/
|
||||
on: function EventEmitter_on(aEvent, aListener) {
|
||||
if (!this._eventEmitterListeners)
|
||||
this._eventEmitterListeners = new Map();
|
||||
if (!this._eventEmitterListeners.has(aEvent)) {
|
||||
this._eventEmitterListeners.set(aEvent, []);
|
||||
}
|
||||
this._eventEmitterListeners.get(aEvent).push(aListener);
|
||||
},
|
||||
|
||||
/**
|
||||
* Listen for the next time an event is fired.
|
||||
*
|
||||
* @param string aEvent
|
||||
* The event name to which we're connecting.
|
||||
* @param function aListener
|
||||
* (Optional) Called when the event is fired. Will be called at most
|
||||
* one time.
|
||||
* @return promise
|
||||
* A promise which is resolved when the event next happens. The
|
||||
* resolution value of the promise is the first event argument. If
|
||||
* you need access to second or subsequent event arguments (it's rare
|
||||
* that this is needed) then use aListener
|
||||
*/
|
||||
once: function EventEmitter_once(aEvent, aListener) {
|
||||
let deferred = promise.defer();
|
||||
|
||||
let handler = (aEvent, aFirstArg, ...aRest) => {
|
||||
this.off(aEvent, handler);
|
||||
if (aListener) {
|
||||
aListener.apply(null, [aEvent, aFirstArg, ...aRest]);
|
||||
}
|
||||
deferred.resolve(aFirstArg);
|
||||
};
|
||||
|
||||
handler._originalListener = aListener;
|
||||
this.on(aEvent, handler);
|
||||
|
||||
return deferred.promise;
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove a previously-registered event listener. Works for events
|
||||
* registered with either on or once.
|
||||
*
|
||||
* @param string aEvent
|
||||
* The event name whose listener we're disconnecting.
|
||||
* @param function aListener
|
||||
* The listener to remove.
|
||||
*/
|
||||
off: function EventEmitter_off(aEvent, aListener) {
|
||||
if (!this._eventEmitterListeners)
|
||||
return;
|
||||
let listeners = this._eventEmitterListeners.get(aEvent);
|
||||
if (listeners) {
|
||||
this._eventEmitterListeners.set(aEvent, listeners.filter(l => {
|
||||
return l !== aListener && l._originalListener !== aListener;
|
||||
}));
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Emit an event. All arguments to this method will
|
||||
* be sent to listener functions.
|
||||
*/
|
||||
emit: function EventEmitter_emit(aEvent) {
|
||||
this.logEvent(aEvent, arguments);
|
||||
|
||||
if (!this._eventEmitterListeners || !this._eventEmitterListeners.has(aEvent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let originalListeners = this._eventEmitterListeners.get(aEvent);
|
||||
for (let listener of this._eventEmitterListeners.get(aEvent)) {
|
||||
// If the object was destroyed during event emission, stop
|
||||
// emitting.
|
||||
if (!this._eventEmitterListeners) {
|
||||
break;
|
||||
}
|
||||
|
||||
// If listeners were removed during emission, make sure the
|
||||
// event handler we're going to fire wasn't removed.
|
||||
if (originalListeners === this._eventEmitterListeners.get(aEvent) ||
|
||||
this._eventEmitterListeners.get(aEvent).some(l => l === listener)) {
|
||||
try {
|
||||
listener.apply(null, arguments);
|
||||
}
|
||||
catch (ex) {
|
||||
// Prevent a bad listener from interfering with the others.
|
||||
let msg = ex + ": " + ex.stack;
|
||||
Cu.reportError(msg);
|
||||
dump(msg + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
logEvent: function(aEvent, args) {
|
||||
if (!loggingEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
let caller, func, path;
|
||||
if (!isWorker) {
|
||||
caller = components.stack.caller.caller;
|
||||
func = caller.name;
|
||||
let file = caller.filename;
|
||||
if (file.includes(" -> ")) {
|
||||
file = caller.filename.split(/ -> /)[1];
|
||||
}
|
||||
path = file + ":" + caller.lineNumber;
|
||||
}
|
||||
|
||||
let argOut = "(";
|
||||
if (args.length === 1) {
|
||||
argOut += aEvent;
|
||||
}
|
||||
|
||||
let out = "EMITTING: ";
|
||||
|
||||
// We need this try / catch to prevent any dead object errors.
|
||||
try {
|
||||
for (let i = 1; i < args.length; i++) {
|
||||
if (i === 1) {
|
||||
argOut = "(" + aEvent + ", ";
|
||||
} else {
|
||||
argOut += ", ";
|
||||
}
|
||||
|
||||
let arg = args[i];
|
||||
argOut += arg;
|
||||
|
||||
if (arg && arg.nodeName) {
|
||||
argOut += " (" + arg.nodeName;
|
||||
if (arg.id) {
|
||||
argOut += "#" + arg.id;
|
||||
}
|
||||
if (arg.className) {
|
||||
argOut += "." + arg.className;
|
||||
}
|
||||
argOut += ")";
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
// Object is dead so the toolbox is most likely shutting down,
|
||||
// do nothing.
|
||||
}
|
||||
|
||||
argOut += ")";
|
||||
out += "emit" + argOut + " from " + func + "() -> " + path + "\n";
|
||||
|
||||
dump(out);
|
||||
},
|
||||
};
|
||||
|
||||
// });
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -20,12 +20,20 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
let promise = null;
|
||||
var globalDebuggee = null;
|
||||
|
||||
var gTestGlobals = [];
|
||||
// const { ActorPool, appendExtraActors, createExtraActors } = require("devtools/server/actors/common");
|
||||
// const { RootActor } = require("devtools/server/actors/root");
|
||||
// const { ThreadActor } = require("devtools/server/actors/script");
|
||||
// const { DebuggerServer } = require("devtools/server/main");
|
||||
// const { TabSources } = require("devtools/server/actors/utils/TabSources");
|
||||
// const promise = require("promise");
|
||||
// const makeDebugger = require("devtools/server/actors/utils/make-debugger");
|
||||
|
||||
|
||||
let gTestGlobals = [];
|
||||
let needToSendNavigation = false;
|
||||
let testTab = null;
|
||||
|
||||
// A mock tab list, for use by tests. This simply presents each global in
|
||||
// gTestGlobals as a tab, and the list is fixed: it never calls its
|
||||
// onListChanged handler.
|
||||
|
@ -45,6 +53,7 @@ function TestTabList(aConnection) {
|
|||
|
||||
for (let global of gTestGlobals) {
|
||||
let actor = new TestTabActor(aConnection, global);
|
||||
testTab = actor;
|
||||
actor.selected = false;
|
||||
this._tabActors.push(actor);
|
||||
this._tabActorPool.addActor(actor);
|
||||
|
@ -59,26 +68,45 @@ function TestTabList(aConnection) {
|
|||
TestTabList.prototype = {
|
||||
constructor: TestTabList,
|
||||
getList: function () {
|
||||
return promise.resolve([tabActor for (tabActor of this._tabActors)]);
|
||||
return resolve([...this._tabActors]);
|
||||
}
|
||||
};
|
||||
|
||||
function createRootActor(aConnection)
|
||||
{
|
||||
let root = new RootActor(aConnection,
|
||||
{ tabList: new TestTabList(aConnection) });
|
||||
root.applicationType = "xpcshell-tests";
|
||||
let root = new RootActor(aConnection, {
|
||||
tabList: new TestTabList(aConnection),
|
||||
globalActorFactories: DebuggerServer.globalActorFactories,
|
||||
});
|
||||
|
||||
// root.applicationType = "xpcshell-tests";
|
||||
return root;
|
||||
}
|
||||
|
||||
function TestTabActor(aConnection, aGlobal)
|
||||
{
|
||||
this.makeDebugger = function() {
|
||||
let dbg = new Debugger();
|
||||
dbg.addDebuggee(this._global);
|
||||
return dbg;
|
||||
};
|
||||
|
||||
this.conn = aConnection;
|
||||
this._global = aGlobal;
|
||||
this._threadActor = new ThreadActor(this, this._global);
|
||||
this.conn.addActor(this._threadActor);
|
||||
this._global.wrappedJSObject = aGlobal;
|
||||
this.threadActor = new ThreadActor(this, this._global);
|
||||
this.conn.addActor(this.threadActor);
|
||||
this.consoleActor = new WebConsoleActor(this.conn, this);
|
||||
this.conn.addActor(this.consoleActor);
|
||||
this._attached = false;
|
||||
this._extraActors = {};
|
||||
// this.makeDebugger = makeDebugger.bind(null, {
|
||||
// findDebuggees: () => [this._global],
|
||||
// shouldAddNewGlobalAsDebuggee: g => g.hostAnnotations &&
|
||||
// g.hostAnnotations.type == "document" &&
|
||||
// g.hostAnnotations.element === this._global
|
||||
|
||||
// });
|
||||
}
|
||||
|
||||
TestTabActor.prototype = {
|
||||
|
@ -86,21 +114,33 @@ TestTabActor.prototype = {
|
|||
actorPrefix: "TestTabActor",
|
||||
|
||||
get window() {
|
||||
return { wrappedJSObject: this._global };
|
||||
return this._global;
|
||||
},
|
||||
|
||||
get url() {
|
||||
// return "http://cocos2d-x.org";
|
||||
return "about:cehome";
|
||||
},
|
||||
|
||||
get sources() {
|
||||
if (!this._sources) {
|
||||
this._sources = new TabSources(this.threadActor);
|
||||
}
|
||||
return this._sources;
|
||||
},
|
||||
|
||||
form: function() {
|
||||
let response = { actor: this.actorID, title: "Hello Cocos2d-X JSB", url: "http://cocos2d-x.org" };
|
||||
let response = { actor: this.actorID, title: "cocos project", 'consoleActor': this.consoleActor.actorID };
|
||||
|
||||
// Walk over tab actors added by extensions and add them to a new ActorPool.
|
||||
let actorPool = new ActorPool(this.conn);
|
||||
// this._createExtraActors(DebuggerServer.tabActorFactories, actorPool);
|
||||
// this._createExtraActors(DebuggerServer.tabActorFactories, actorPool);
|
||||
if (!actorPool.isEmpty()) {
|
||||
this._tabActorPool = actorPool;
|
||||
this.conn.addActorPool(this._tabActorPool);
|
||||
}
|
||||
|
||||
// this._appendExtraActors(response);
|
||||
// this._appendExtraActors(response);
|
||||
|
||||
return response;
|
||||
},
|
||||
|
@ -108,9 +148,10 @@ TestTabActor.prototype = {
|
|||
onAttach: function(aRequest) {
|
||||
this._attached = true;
|
||||
|
||||
let response = { type: "tabAttached", threadActor: this._threadActor.actorID };
|
||||
// this._appendExtraActors(response);
|
||||
let response = { type: "tabAttached", threadActor: this.threadActor.actorID};
|
||||
// this._appendExtraActors(response);
|
||||
|
||||
needToSendNavigation = true;
|
||||
return response;
|
||||
},
|
||||
|
||||
|
@ -121,83 +162,143 @@ TestTabActor.prototype = {
|
|||
return { type: "detached" };
|
||||
},
|
||||
|
||||
/* Support for DebuggerServer.addTabActor. */
|
||||
// _createExtraActors: CommonCreateExtraActors,
|
||||
// _appendExtraActors: CommonAppendExtraActors,
|
||||
|
||||
// Hooks for use by TestTabActors.
|
||||
addToParentPool: function(aActor) {
|
||||
this.conn.addActor(aActor);
|
||||
onReload: function(aRequest) {
|
||||
this.sources.reset({ sourceMaps: true });
|
||||
this.threadActor.clearDebuggees();
|
||||
this.threadActor.dbg.addDebuggees();
|
||||
return {};
|
||||
},
|
||||
|
||||
removeFromParentPool: function(aActor) {
|
||||
this.conn.removeActor(aActor);
|
||||
removeActorByName: function(aName) {
|
||||
const actor = this._extraActors[aName];
|
||||
if (this._tabActorPool) {
|
||||
this._tabActorPool.removeActor(actor);
|
||||
}
|
||||
delete this._extraActors[aName];
|
||||
},
|
||||
|
||||
/* Support for DebuggerServer.addTabActor. */
|
||||
// _createExtraActors: createExtraActors,
|
||||
// _appendExtraActors: appendExtraActors
|
||||
};
|
||||
|
||||
TestTabActor.prototype.requestTypes = {
|
||||
"attach": TestTabActor.prototype.onAttach,
|
||||
"detach": TestTabActor.prototype.onDetach
|
||||
"detach": TestTabActor.prototype.onDetach,
|
||||
"reload": TestTabActor.prototype.onReload
|
||||
};
|
||||
|
||||
let conn = null;
|
||||
let transport = null;
|
||||
|
||||
this.processInput = function (inputstr) {
|
||||
if (!inputstr) {
|
||||
if (needToSendNavigation) {
|
||||
transport.send({
|
||||
from: testTab.actorID,
|
||||
type: 'frameUpdate',
|
||||
frames: [{
|
||||
url: 'about:cehome',
|
||||
title: 'cocos',
|
||||
id: 10
|
||||
}]
|
||||
|
||||
});
|
||||
|
||||
needToSendNavigation = false;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (inputstr === "connected")
|
||||
{
|
||||
DebuggerServer.createRootActor = (conn => {
|
||||
return new RootActor(conn, { tabList: new TestTabList(conn) });
|
||||
});
|
||||
DebuggerServer.init(() => true);
|
||||
DebuggerServer.openListener(5086);
|
||||
if (debuggerServer && debuggerServer.onSocketAccepted)
|
||||
{
|
||||
var aTransport = {
|
||||
host: "127.0.0.1",
|
||||
port: 5086,
|
||||
openInputStream: function() {
|
||||
return {
|
||||
close: function(){}
|
||||
};
|
||||
},
|
||||
openOutputStream: function() {
|
||||
return {
|
||||
close: function(){},
|
||||
write: function(){},
|
||||
asyncWait: function(){}
|
||||
};
|
||||
},
|
||||
};
|
||||
debuggerServer.onSocketAccepted(null, aTransport);
|
||||
}
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.setRootActor(createRootActor);
|
||||
conn = DebuggerServer._onConnection(transport);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (DebuggerServer && DebuggerServer._transport && DebuggerServer._transport.onDataAvailable)
|
||||
{
|
||||
DebuggerServer._transport.onDataAvailable(inputstr);
|
||||
/**
|
||||
* Process incoming packets. Returns true if a packet has been received, either
|
||||
* if it was properly parsed or not. Returns false if the incoming stream does
|
||||
* not contain a full packet yet. After a proper packet is parsed, the dispatch
|
||||
* handler DebuggerTransport.hooks.onPacket is called with the packet as a
|
||||
* parameter.
|
||||
*/
|
||||
function _processIncoming(inputString) {
|
||||
// Well this is ugly.
|
||||
let sep = inputString.indexOf(':');
|
||||
if (sep < 0) {
|
||||
// Incoming packet length is too big anyway - drop the connection.
|
||||
if (inputString.length > 20) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
let count = inputString.substring(0, sep);
|
||||
// Check for a positive number with no garbage afterwards.
|
||||
if (!/^[0-9]+$/.exec(count)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
count = +count;
|
||||
if (inputString.length - (sep + 1) < count) {
|
||||
// Don't have a complete request yet.
|
||||
return false;
|
||||
}
|
||||
|
||||
// We have a complete request, pluck it out of the data and parse it.
|
||||
inputString = inputString.substring(sep + 1);
|
||||
let packet = inputString.substring(0, count);
|
||||
inputString = inputString.substring(count);
|
||||
|
||||
try {
|
||||
// packet = this._converter.ConvertToUnicode(packet);
|
||||
packet = DevToolsUtils.utf8to16(packet);
|
||||
var parsed = JSON.parse(packet);
|
||||
} catch(e) {
|
||||
let msg = "Error parsing incoming packet: " + packet + " (" + e + " - " + e.stack + ")";
|
||||
// if (Cu.reportError) {
|
||||
// Cu.reportError(msg);
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
|
||||
conn.onPacket(parsed);
|
||||
}
|
||||
|
||||
// log('receive: ' + inputstr);
|
||||
_processIncoming(inputstr);
|
||||
};
|
||||
|
||||
let globalDebuggee = null;
|
||||
this._prepareDebugger = function (global) {
|
||||
|
||||
globalDebuggee = global;
|
||||
require = global.require;
|
||||
cc = global.cc;
|
||||
// exports = global;
|
||||
|
||||
require('script/debugger/DevToolsUtils.js', "debug");
|
||||
require('script/debugger/core/promise.js', "debug");
|
||||
require('script/debugger/transport.js', "debug");
|
||||
require('script/debugger/actors/root.js', "debug");
|
||||
require('script/debugger/actors/script.js', "debug");
|
||||
require('script/debugger/main.js', "debug");
|
||||
// load all functions exported in DevToolsUtils to global(exports)
|
||||
require('script/debugger/DevToolsUtils.js', 'debug');
|
||||
require('script/debugger/event-emitter.js', 'debug');
|
||||
require('script/debugger/actors/utils/ScriptStore.js', 'debug');
|
||||
require('script/debugger/actors/common.js', 'debug');
|
||||
require('script/debugger/core/promise.js', 'debug');
|
||||
require('script/debugger/transport.js', 'debug');
|
||||
require('script/debugger/main.js', 'debug');
|
||||
require('script/debugger/actors/object.js', 'debug');
|
||||
require('script/debugger/actors/root.js', 'debug');
|
||||
require('script/debugger/actors/script.js', 'debug');
|
||||
require('script/debugger/actors/webconsole.js', 'debug')
|
||||
require('script/debugger/actors/utils/TabSources.js', 'debug');
|
||||
|
||||
promise = exports;
|
||||
//DebuggerServer.addTestGlobal = function(aGlobal) {
|
||||
gTestGlobals.push(global);
|
||||
//};
|
||||
|
||||
transport = new DebuggerTransport();
|
||||
};
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- Gets the ActionInterval of ActionFrame.<br>
|
||||
-- parame duration the duration time of ActionFrame<br>
|
||||
-- param duration the duration time of ActionFrame<br>
|
||||
-- return ActionInterval
|
||||
-- @function [parent=#ActionFadeFrame] getAction
|
||||
-- @param self
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- Set the ActionInterval easing parameter.<br>
|
||||
-- parame parameter the parameter for frame ease
|
||||
-- param parameter the parameter for frame ease
|
||||
-- @function [parent=#ActionFrame] setEasingParameter
|
||||
-- @param self
|
||||
-- @param #array_table parameter
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- Gets the ActionInterval of ActionFrame.<br>
|
||||
-- parame duration the duration time of ActionFrame<br>
|
||||
-- param duration the duration time of ActionFrame<br>
|
||||
-- return ActionInterval
|
||||
-- @function [parent=#ActionMoveFrame] getAction
|
||||
-- @param self
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- Gets the ActionInterval of ActionFrame.<br>
|
||||
-- parame duration the duration time of ActionFrame<br>
|
||||
-- param duration the duration time of ActionFrame<br>
|
||||
-- return ActionInterval
|
||||
-- @function [parent=#ActionScaleFrame] getAction
|
||||
-- @param self
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ActionTimeline
|
||||
-- @extend Action
|
||||
-- @extend Action,PlayableProtocol
|
||||
-- @parent_module ccs
|
||||
|
||||
--------------------------------
|
||||
|
@ -45,6 +45,12 @@
|
|||
-- @param self
|
||||
-- @return ActionTimeline#ActionTimeline self (return value: ccs.ActionTimeline)
|
||||
|
||||
--------------------------------
|
||||
-- / @{/ @name implement Playable Protocol
|
||||
-- @function [parent=#ActionTimeline] start
|
||||
-- @param self
|
||||
-- @return ActionTimeline#ActionTimeline self (return value: ccs.ActionTimeline)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimeline] init
|
||||
|
@ -226,13 +232,6 @@
|
|||
-- @param self
|
||||
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimeline] step
|
||||
-- @param self
|
||||
-- @param #float delta
|
||||
-- @return ActionTimeline#ActionTimeline self (return value: ccs.ActionTimeline)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimeline] startWithTarget
|
||||
|
@ -240,6 +239,13 @@
|
|||
-- @param #cc.Node target
|
||||
-- @return ActionTimeline#ActionTimeline self (return value: ccs.ActionTimeline)
|
||||
|
||||
--------------------------------
|
||||
-- Returns a reverse of ActionTimeline. <br>
|
||||
-- Not implement yet.
|
||||
-- @function [parent=#ActionTimeline] reverse
|
||||
-- @param self
|
||||
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
|
||||
|
||||
--------------------------------
|
||||
-- Returns a clone of ActionTimeline
|
||||
-- @function [parent=#ActionTimeline] clone
|
||||
|
@ -247,11 +253,17 @@
|
|||
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
|
||||
|
||||
--------------------------------
|
||||
-- Returns a reverse of ActionTimeline. <br>
|
||||
-- Not implement yet.
|
||||
-- @function [parent=#ActionTimeline] reverse
|
||||
--
|
||||
-- @function [parent=#ActionTimeline] stop
|
||||
-- @param self
|
||||
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
|
||||
-- @return ActionTimeline#ActionTimeline self (return value: ccs.ActionTimeline)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimeline] step
|
||||
-- @param self
|
||||
-- @param #float delta
|
||||
-- @return ActionTimeline#ActionTimeline self (return value: ccs.ActionTimeline)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
-- @param #string fileName
|
||||
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimelineCache] createActionFromContent
|
||||
-- @param self
|
||||
-- @param #string fileName
|
||||
-- @param #string content
|
||||
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimelineCache] purge
|
||||
|
@ -36,13 +44,6 @@
|
|||
-- @param self
|
||||
-- @return ActionTimelineCache#ActionTimelineCache self (return value: ccs.ActionTimelineCache)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimelineCache] loadAnimationActionWithFile
|
||||
-- @param self
|
||||
-- @param #string fileName
|
||||
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimelineCache] loadAnimationActionWithContent
|
||||
|
@ -51,6 +52,13 @@
|
|||
-- @param #string content
|
||||
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimelineCache] loadAnimationActionWithFile
|
||||
-- @param self
|
||||
-- @param #string fileName
|
||||
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
|
||||
|
||||
--------------------------------
|
||||
-- Remove action with filename, and also remove other resource relate with this file
|
||||
-- @function [parent=#ActionTimelineCache] removeAction
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- Gets the ActionInterval of ActionFrame.<br>
|
||||
-- parame duration the duration time of ActionFrame<br>
|
||||
-- param duration the duration time of ActionFrame<br>
|
||||
-- return ActionInterval
|
||||
-- @function [parent=#ActionTintFrame] getAction
|
||||
-- @param self
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- Set parent bone.<br>
|
||||
-- If parent is NUll, then also remove this bone from armature.<br>
|
||||
-- If parent is null, then also remove this bone from armature.<br>
|
||||
-- It will not set the Armature, if you want to add the bone to a Armature, you should use Armature::addBone(Bone *bone, const char* parentName).<br>
|
||||
-- param parent the parent bone.<br>
|
||||
-- nullptr : remove this bone from armature
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ComAudio
|
||||
-- @extend Component
|
||||
-- @extend Component,PlayableProtocol
|
||||
-- @parent_module ccs
|
||||
|
||||
--------------------------------
|
||||
|
@ -48,6 +48,12 @@
|
|||
-- @param self
|
||||
-- @return ComAudio#ComAudio self (return value: ccs.ComAudio)
|
||||
|
||||
--------------------------------
|
||||
-- / @{/ @name implement Playable Protocol
|
||||
-- @function [parent=#ComAudio] start
|
||||
-- @param self
|
||||
-- @return ComAudio#ComAudio self (return value: ccs.ComAudio)
|
||||
|
||||
--------------------------------
|
||||
-- @overload self
|
||||
-- @overload self, bool
|
||||
|
@ -103,6 +109,12 @@
|
|||
-- @param #bool bLoop
|
||||
-- @return ComAudio#ComAudio self (return value: ccs.ComAudio)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ComAudio] stop
|
||||
-- @param self
|
||||
-- @return ComAudio#ComAudio self (return value: ccs.ComAudio)
|
||||
|
||||
--------------------------------
|
||||
-- @overload self, char
|
||||
-- @overload self, char, bool
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- Find a widget with a specific action tag from root widget<br>
|
||||
-- This search will be recursive throught all child widgets.<br>
|
||||
-- This search will be recursive through all child widgets.<br>
|
||||
-- param root The be searched root widget.<br>
|
||||
-- param tag The widget action's tag.<br>
|
||||
-- return Widget instance pointer.
|
||||
|
@ -49,7 +49,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- Find a widget with a specific name from root widget.<br>
|
||||
-- This search will be recursive throught all child widgets.<br>
|
||||
-- This search will be recursive through all child widgets.<br>
|
||||
-- param root The be searched root widget.<br>
|
||||
-- param name The widget name.<br>
|
||||
-- return Widget instance pointer.
|
||||
|
@ -61,8 +61,8 @@
|
|||
|
||||
--------------------------------
|
||||
-- Find a widget with a specific tag from root widget.<br>
|
||||
-- This search will be recursive throught all child widgets.<br>
|
||||
-- param root The be seached root widget.<br>
|
||||
-- This search will be recursive through all child widgets.<br>
|
||||
-- param root The be searched root widget.<br>
|
||||
-- param tag The widget tag.<br>
|
||||
-- return Widget instance pointer.
|
||||
-- @function [parent=#Helper] seekWidgetByTag
|
||||
|
|
|
@ -121,6 +121,12 @@
|
|||
-- @param self
|
||||
-- @return size_table#size_table ret (return value: size_table)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Label] getLineSpacing
|
||||
-- @param self
|
||||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
-- Makes the Label to clip upper and lower margin for reduce height of Label.
|
||||
-- @function [parent=#Label] setClipMarginEnabled
|
||||
|
@ -144,6 +150,13 @@
|
|||
-- @param #string font
|
||||
-- @return Label#Label self (return value: cc.Label)
|
||||
|
||||
--------------------------------
|
||||
-- Query the wrap is enabled or not.<br>
|
||||
-- Note: System font will always return true.
|
||||
-- @function [parent=#Label] isWrapEnabled
|
||||
-- @param self
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- Return the outline effect size value.
|
||||
-- @function [parent=#Label] getOutlineSize
|
||||
|
@ -205,10 +218,12 @@
|
|||
-- @return Label#Label self (return value: cc.Label)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Label] getLineSpacing
|
||||
-- Enables strikethrough.<br>
|
||||
-- Underline and Strikethrough cannot be enabled at the same time.<br>
|
||||
-- Strikethough is like an underline but at the middle of the glyph
|
||||
-- @function [parent=#Label] enableStrikethrough
|
||||
-- @param self
|
||||
-- @return float#float ret (return value: float)
|
||||
-- @return Label#Label self (return value: cc.Label)
|
||||
|
||||
--------------------------------
|
||||
-- Update content immediately.
|
||||
|
@ -252,7 +267,7 @@
|
|||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
-- Return current effect color vlaue.
|
||||
-- Return current effect color value.
|
||||
-- @function [parent=#Label] getEffectColor
|
||||
-- @param self
|
||||
-- @return color4f_table#color4f_table ret (return value: color4f_table)
|
||||
|
@ -332,10 +347,10 @@
|
|||
-- @return _ttfConfig#_ttfConfig ret (return value: cc._ttfConfig)
|
||||
|
||||
--------------------------------
|
||||
-- Returns the Label's text vertical alignment.
|
||||
-- @function [parent=#Label] getVerticalAlignment
|
||||
-- Enable italics rendering
|
||||
-- @function [parent=#Label] enableItalics
|
||||
-- @param self
|
||||
-- @return int#int ret (return value: int)
|
||||
-- @return Label#Label self (return value: cc.Label)
|
||||
|
||||
--------------------------------
|
||||
-- Sets the text color of Label.<br>
|
||||
|
@ -384,6 +399,12 @@
|
|||
-- @param self
|
||||
-- @return int#int ret (return value: int)
|
||||
|
||||
--------------------------------
|
||||
-- Returns the Label's text vertical alignment.
|
||||
-- @function [parent=#Label] getVerticalAlignment
|
||||
-- @param self
|
||||
-- @return int#int ret (return value: int)
|
||||
|
||||
--------------------------------
|
||||
-- Sets the additional kerning of the Label.<br>
|
||||
-- warning Not support system font.<br>
|
||||
|
@ -426,11 +447,16 @@
|
|||
-- @return Label#Label self (return value: cc.Label)
|
||||
|
||||
--------------------------------
|
||||
-- Query the wrap is enabled or not.<br>
|
||||
-- Note: System font will always return true.
|
||||
-- @function [parent=#Label] isWrapEnabled
|
||||
-- Enable bold rendering
|
||||
-- @function [parent=#Label] enableBold
|
||||
-- @param self
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
-- @return Label#Label self (return value: cc.Label)
|
||||
|
||||
--------------------------------
|
||||
-- Enable underline
|
||||
-- @function [parent=#Label] enableUnderline
|
||||
-- @param self
|
||||
-- @return Label#Label self (return value: cc.Label)
|
||||
|
||||
--------------------------------
|
||||
-- Return current effect type.
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- Query the percent content size value.<br>
|
||||
-- return Percet (x,y) in Vec2.
|
||||
-- return Percent (x,y) in Vec2.
|
||||
-- @function [parent=#LayoutComponent] getPercentContentSize
|
||||
-- @param self
|
||||
-- @return vec2_table#vec2_table ret (return value: vec2_table)
|
||||
|
|
|
@ -20,14 +20,14 @@
|
|||
|
||||
--------------------------------
|
||||
-- brief Query the center item<br>
|
||||
-- return A item instance.
|
||||
-- return An item instance.
|
||||
-- @function [parent=#ListView] getCenterItemInCurrentView
|
||||
-- @param self
|
||||
-- @return Widget#Widget ret (return value: ccui.Widget)
|
||||
|
||||
--------------------------------
|
||||
-- brief Query current selected widget's idnex.<br>
|
||||
-- return A index of a selected item.
|
||||
-- brief Query current selected widget's index.<br>
|
||||
-- return An index of a selected item.
|
||||
-- @function [parent=#ListView] getCurSelectedIndex
|
||||
-- @param self
|
||||
-- @return long#long ret (return value: long)
|
||||
|
@ -70,7 +70,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- Insert a custom item into the end of ListView.<br>
|
||||
-- param item A item in `Widget*`.
|
||||
-- param item An item in `Widget*`.
|
||||
-- @function [parent=#ListView] pushBackCustomItem
|
||||
-- @param self
|
||||
-- @param #ccui.Widget item
|
||||
|
@ -78,7 +78,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- Insert a default item(create by cloning model) into listview at a give index.<br>
|
||||
-- param index A index in ssize_t.
|
||||
-- param index An index in ssize_t.
|
||||
-- @function [parent=#ListView] insertDefaultItem
|
||||
-- @param self
|
||||
-- @param #long index
|
||||
|
@ -92,7 +92,7 @@
|
|||
-- @return ListView#ListView self (return value: ccui.ListView)
|
||||
|
||||
--------------------------------
|
||||
-- Add a event click callback to ListView, then one item of Listview is clicked, the callback will be called.<br>
|
||||
-- Add an event click callback to ListView, then one item of Listview is clicked, the callback will be called.<br>
|
||||
-- param callback A callback function with type of `ccListViewCallback`.
|
||||
-- @function [parent=#ListView] addEventListener
|
||||
-- @param self
|
||||
|
@ -107,7 +107,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- brief Query the topmost item in horizontal list<br>
|
||||
-- return A item instance.
|
||||
-- return An item instance.
|
||||
-- @function [parent=#ListView] getTopmostItemInCurrentView
|
||||
-- @param self
|
||||
-- @return Widget#Widget ret (return value: ccui.Widget)
|
||||
|
@ -120,7 +120,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- brief Query the bottommost item in horizontal list<br>
|
||||
-- return A item instance.
|
||||
-- return An item instance.
|
||||
-- @function [parent=#ListView] getBottommostItemInCurrentView
|
||||
-- @param self
|
||||
-- @return Widget#Widget ret (return value: ccui.Widget)
|
||||
|
@ -134,7 +134,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- brief Query the leftmost item in horizontal list<br>
|
||||
-- return A item instance.
|
||||
-- return An item instance.
|
||||
-- @function [parent=#ListView] getLeftmostItemInCurrentView
|
||||
-- @param self
|
||||
-- @return Widget#Widget ret (return value: ccui.Widget)
|
||||
|
@ -154,7 +154,7 @@
|
|||
-- @return int#int ret (return value: int)
|
||||
|
||||
--------------------------------
|
||||
-- Return a item at a given index.<br>
|
||||
-- Return an item at a given index.<br>
|
||||
-- param index A given index in ssize_t.<br>
|
||||
-- return A widget instance.
|
||||
-- @function [parent=#ListView] getItem
|
||||
|
@ -163,7 +163,7 @@
|
|||
-- @return Widget#Widget ret (return value: ccui.Widget)
|
||||
|
||||
--------------------------------
|
||||
-- Remove a item at given index.<br>
|
||||
-- Remove an item at given index.<br>
|
||||
-- param index A given index in ssize_t.
|
||||
-- @function [parent=#ListView] removeItem
|
||||
-- @param self
|
||||
|
@ -197,7 +197,7 @@
|
|||
-- brief Query the closest item to a specific position in inner container.<br>
|
||||
-- param targetPosition Specifies the target position in inner container's coordinates.<br>
|
||||
-- param itemAnchorPoint Specifies an anchor point of each item for position to calculate distance.<br>
|
||||
-- return A item instance if list view is not empty. Otherwise, returns null.
|
||||
-- return An item instance if list view is not empty. Otherwise, returns null.
|
||||
-- @function [parent=#ListView] getClosestItemToPosition
|
||||
-- @param self
|
||||
-- @param #vec2_table targetPosition
|
||||
|
@ -206,7 +206,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- brief Query the rightmost item in horizontal list<br>
|
||||
-- return A item instance.
|
||||
-- return An item instance.
|
||||
-- @function [parent=#ListView] getRightmostItemInCurrentView
|
||||
-- @param self
|
||||
-- @return Widget#Widget ret (return value: ccui.Widget)
|
||||
|
@ -216,7 +216,7 @@
|
|||
-- For instance, to find the item in the center of view, call 'getClosestItemToPositionInCurrentView(Vec2::ANCHOR_MIDDLE, Vec2::ANCHOR_MIDDLE)'.<br>
|
||||
-- param positionRatioInView Specifies the target position with ratio in list view's content size.<br>
|
||||
-- param itemAnchorPoint Specifies an anchor point of each item for position to calculate distance.<br>
|
||||
-- return A item instance if list view is not empty. Otherwise, returns null.
|
||||
-- return An item instance if list view is not empty. Otherwise, returns null.
|
||||
-- @function [parent=#ListView] getClosestItemToPositionInCurrentView
|
||||
-- @param self
|
||||
-- @param #vec2_table positionRatioInView
|
||||
|
@ -224,7 +224,7 @@
|
|||
-- @return Widget#Widget ret (return value: ccui.Widget)
|
||||
|
||||
--------------------------------
|
||||
-- Set a item model for listview.<br>
|
||||
-- Set an item model for listview.<br>
|
||||
-- When calling `pushBackDefaultItem`, the model will be used as a blueprint and new model copy will be inserted into ListView.<br>
|
||||
-- param model Model in `Widget*`.
|
||||
-- @function [parent=#ListView] setItemModel
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ParticleSystem
|
||||
-- @extend Node,TextureProtocol
|
||||
-- @extend Node,TextureProtocol,PlayableProtocol
|
||||
-- @parent_module cc
|
||||
|
||||
--------------------------------
|
||||
|
@ -416,6 +416,12 @@
|
|||
-- @param #vec2_table pos
|
||||
-- @return ParticleSystem#ParticleSystem self (return value: cc.ParticleSystem)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ParticleSystem] stop
|
||||
-- @param self
|
||||
-- @return ParticleSystem#ParticleSystem self (return value: cc.ParticleSystem)
|
||||
|
||||
--------------------------------
|
||||
-- Update the verts position data of particle,<br>
|
||||
-- should be overridden by subclasses.
|
||||
|
@ -462,6 +468,12 @@
|
|||
-- @param #bool t
|
||||
-- @return ParticleSystem#ParticleSystem self (return value: cc.ParticleSystem)
|
||||
|
||||
--------------------------------
|
||||
-- / @{/ @name implement Playable Protocol
|
||||
-- @function [parent=#ParticleSystem] start
|
||||
-- @param self
|
||||
-- @return ParticleSystem#ParticleSystem self (return value: cc.ParticleSystem)
|
||||
|
||||
--------------------------------
|
||||
-- Sets the end size variance in pixels of each particle.<br>
|
||||
-- param sizeVar The end size variance in pixels of each particle.
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module PlayableFrame
|
||||
-- @extend Frame
|
||||
-- @parent_module ccs
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#PlayableFrame] setPlayableAct
|
||||
-- @param self
|
||||
-- @param #string playact
|
||||
-- @return PlayableFrame#PlayableFrame self (return value: ccs.PlayableFrame)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#PlayableFrame] getPlayableAct
|
||||
-- @param self
|
||||
-- @return string#string ret (return value: string)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#PlayableFrame] create
|
||||
-- @param self
|
||||
-- @return PlayableFrame#PlayableFrame ret (return value: ccs.PlayableFrame)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#PlayableFrame] clone
|
||||
-- @param self
|
||||
-- @return Frame#Frame ret (return value: ccs.Frame)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#PlayableFrame] PlayableFrame
|
||||
-- @param self
|
||||
-- @return PlayableFrame#PlayableFrame self (return value: ccs.PlayableFrame)
|
||||
|
||||
return nil
|
|
@ -11,16 +11,16 @@
|
|||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
-- get triangles count<br>
|
||||
-- return number of triangles
|
||||
-- @function [parent=#PolygonInfo] getTriaglesCount
|
||||
-- get vertex count<br>
|
||||
-- return number of vertices
|
||||
-- @function [parent=#PolygonInfo] getVertCount
|
||||
-- @param self
|
||||
-- @return unsigned int#unsigned int ret (return value: unsigned int)
|
||||
|
||||
--------------------------------
|
||||
-- get vertex count<br>
|
||||
-- return number of vertices
|
||||
-- @function [parent=#PolygonInfo] getVertCount
|
||||
-- get triangles count<br>
|
||||
-- return number of triangles
|
||||
-- @function [parent=#PolygonInfo] getTrianglesCount
|
||||
-- @param self
|
||||
-- @return unsigned int#unsigned int ret (return value: unsigned int)
|
||||
|
||||
|
|
|
@ -4,6 +4,13 @@
|
|||
-- @extend RichElement
|
||||
-- @parent_module ccui
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#RichElementImage] setHeight
|
||||
-- @param self
|
||||
-- @param #int height
|
||||
-- @return RichElementImage#RichElementImage self (return value: ccui.RichElementImage)
|
||||
|
||||
--------------------------------
|
||||
-- brief Initialize a RichElementImage with various arguments.<br>
|
||||
-- param tag A integer tag value.<br>
|
||||
|
@ -19,6 +26,13 @@
|
|||
-- @param #string filePath
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#RichElementImage] setWidth
|
||||
-- @param self
|
||||
-- @param #int width
|
||||
-- @return RichElementImage#RichElementImage self (return value: ccui.RichElementImage)
|
||||
|
||||
--------------------------------
|
||||
-- brief Create a RichElementImage with various arguments.<br>
|
||||
-- param tag A integer tag value.<br>
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
-- param text Content string.<br>
|
||||
-- param fontName Content font name.<br>
|
||||
-- param fontSize Content font size.<br>
|
||||
-- return True if initialize scucess, false otherwise.
|
||||
-- param flags: italics, bold, underline or strikethrough<br>
|
||||
-- return True if initialize success, false otherwise.
|
||||
-- @function [parent=#RichElementText] init
|
||||
-- @param self
|
||||
-- @param #int tag
|
||||
|
@ -21,6 +22,8 @@
|
|||
-- @param #string text
|
||||
-- @param #string fontName
|
||||
-- @param #float fontSize
|
||||
-- @param #unsigned int flags
|
||||
-- @param #string url
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
|
@ -31,6 +34,7 @@
|
|||
-- param text Content string.<br>
|
||||
-- param fontName Content font name.<br>
|
||||
-- param fontSize Content font size.<br>
|
||||
-- param flags: italics, bold, underline or strikethrough<br>
|
||||
-- return RichElementText instance.
|
||||
-- @function [parent=#RichElementText] create
|
||||
-- @param self
|
||||
|
@ -40,6 +44,8 @@
|
|||
-- @param #string text
|
||||
-- @param #string fontName
|
||||
-- @param #float fontSize
|
||||
-- @param #unsigned int flags
|
||||
-- @param #string url
|
||||
-- @return RichElementText#RichElementText ret (return value: ccui.RichElementText)
|
||||
|
||||
--------------------------------
|
||||
|
|
|
@ -22,6 +22,13 @@
|
|||
-- @param #ccui.RichElement element
|
||||
-- @return RichText#RichText self (return value: ccui.RichText)
|
||||
|
||||
--------------------------------
|
||||
-- @brief sets the wrapping mode: WRAP_PER_CHAR or WRAP_PER_WORD
|
||||
-- @function [parent=#RichText] setWrapMode
|
||||
-- @param self
|
||||
-- @param #int wrapMode
|
||||
-- @return RichText#RichText self (return value: ccui.RichText)
|
||||
|
||||
--------------------------------
|
||||
-- brief Set vertical space between each RichElement.<br>
|
||||
-- param space Point in float.
|
||||
|
@ -30,6 +37,12 @@
|
|||
-- @param #float space
|
||||
-- @return RichText#RichText self (return value: ccui.RichText)
|
||||
|
||||
--------------------------------
|
||||
-- @brief returns the current wrapping mode
|
||||
-- @function [parent=#RichText] getWrapMode
|
||||
-- @param self
|
||||
-- @return int#int ret (return value: int)
|
||||
|
||||
--------------------------------
|
||||
-- brief Rearrange all RichElement in the RichText.<br>
|
||||
-- It's usually called internally.
|
||||
|
@ -37,6 +50,13 @@
|
|||
-- @param self
|
||||
-- @return RichText#RichText self (return value: ccui.RichText)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#RichText] initWithXML
|
||||
-- @param self
|
||||
-- @param #string xml
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- @overload self, ccui.RichElement
|
||||
-- @overload self, int
|
||||
|
@ -52,6 +72,14 @@
|
|||
-- @param self
|
||||
-- @return RichText#RichText ret (return value: ccui.RichText)
|
||||
|
||||
--------------------------------
|
||||
-- brief Create a RichText from an XML<br>
|
||||
-- return RichText instance.
|
||||
-- @function [parent=#RichText] createWithXML
|
||||
-- @param self
|
||||
-- @param #string xml
|
||||
-- @return RichText#RichText ret (return value: ccui.RichText)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#RichText] init
|
||||
|
|
|
@ -246,6 +246,21 @@
|
|||
-- @param self
|
||||
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
|
||||
|
||||
--------------------------------
|
||||
-- brief Set the touch total time threshold<br>
|
||||
-- param the touch total time threshold
|
||||
-- @function [parent=#ScrollView] setTouchTotalTimeThreshold
|
||||
-- @param self
|
||||
-- @param #float touchTotalTimeThreshold
|
||||
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
|
||||
|
||||
--------------------------------
|
||||
-- brief Get the touch total time threshold<br>
|
||||
-- return the touch total time threshold
|
||||
-- @function [parent=#ScrollView] getTouchTotalTimeThreshold
|
||||
-- @param self
|
||||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
-- brief Get the horizontal scroll bar's position from right-top corner.<br>
|
||||
-- return positionFromCorner
|
||||
|
|
|
@ -163,7 +163,7 @@
|
|||
-- @return vec2_table#vec2_table ret (return value: vec2_table)
|
||||
|
||||
--------------------------------
|
||||
-- Check if anchor point is defined for frame.<br>
|
||||
-- Check if anchor point is defined for the frame.<br>
|
||||
-- return true if anchor point is available.
|
||||
-- @function [parent=#SpriteFrame] hasAnchorPoint
|
||||
-- @param self
|
||||
|
|
|
@ -170,7 +170,7 @@
|
|||
-- @return Text#Text self (return value: ccui.Text)
|
||||
|
||||
--------------------------------
|
||||
-- Return current effect color vlaue.
|
||||
-- Return current effect color value.
|
||||
-- @function [parent=#Text] getEffectColor
|
||||
-- @param self
|
||||
-- @return color4b_table#color4b_table ret (return value: color4b_table)
|
||||
|
|
|
@ -256,6 +256,11 @@
|
|||
-- @field [parent=#ccs] BlendFuncFrame#BlendFuncFrame BlendFuncFrame preloaded module
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
-- the ccs PlayableFrame
|
||||
-- @field [parent=#ccs] PlayableFrame#PlayableFrame PlayableFrame preloaded module
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
-- the ccs Timeline
|
||||
-- @field [parent=#ccs] Timeline#Timeline Timeline preloaded module
|
||||
|
|
|
@ -20465,53 +20465,6 @@ int lua_cocos2dx_PolygonInfo_getArea(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_PolygonInfo_getTriaglesCount(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::PolygonInfo* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.PolygonInfo",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::PolygonInfo*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_PolygonInfo_getTriaglesCount'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_PolygonInfo_getTriaglesCount'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
const unsigned int ret = cobj->getTriaglesCount();
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.PolygonInfo:getTriaglesCount",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_PolygonInfo_getTriaglesCount'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_PolygonInfo_getVertCount(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -20559,6 +20512,53 @@ int lua_cocos2dx_PolygonInfo_getVertCount(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_PolygonInfo_getTrianglesCount(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::PolygonInfo* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.PolygonInfo",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::PolygonInfo*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_PolygonInfo_getTrianglesCount'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_PolygonInfo_getTrianglesCount'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
const unsigned int ret = cobj->getTrianglesCount();
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.PolygonInfo:getTrianglesCount",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_PolygonInfo_getTrianglesCount'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_PolygonInfo_setQuad(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -20710,8 +20710,8 @@ int lua_register_cocos2dx_PolygonInfo(lua_State* tolua_S)
|
|||
tolua_beginmodule(tolua_S,"PolygonInfo");
|
||||
tolua_function(tolua_S,"new",lua_cocos2dx_PolygonInfo_constructor);
|
||||
tolua_function(tolua_S,"getArea",lua_cocos2dx_PolygonInfo_getArea);
|
||||
tolua_function(tolua_S,"getTriaglesCount",lua_cocos2dx_PolygonInfo_getTriaglesCount);
|
||||
tolua_function(tolua_S,"getVertCount",lua_cocos2dx_PolygonInfo_getVertCount);
|
||||
tolua_function(tolua_S,"getTrianglesCount",lua_cocos2dx_PolygonInfo_getTrianglesCount);
|
||||
tolua_function(tolua_S,"setQuad",lua_cocos2dx_PolygonInfo_setQuad);
|
||||
tolua_function(tolua_S,"setTriangles",lua_cocos2dx_PolygonInfo_setTriangles);
|
||||
tolua_endmodule(tolua_S);
|
||||
|
@ -51962,6 +51962,53 @@ int lua_cocos2dx_Label_getShadowOffset(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_getLineSpacing(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Label* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getLineSpacing'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getLineSpacing'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
double ret = cobj->getLineSpacing();
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getLineSpacing",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getLineSpacing'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_setClipMarginEnabled(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -52112,6 +52159,53 @@ int lua_cocos2dx_Label_setSystemFontName(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_isWrapEnabled(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Label* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_isWrapEnabled'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_isWrapEnabled'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
bool ret = cobj->isWrapEnabled();
|
||||
tolua_pushboolean(tolua_S,(bool)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:isWrapEnabled",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_isWrapEnabled'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_getOutlineSize(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -52638,7 +52732,7 @@ int lua_cocos2dx_Label_setOverflow(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_getLineSpacing(lua_State* tolua_S)
|
||||
int lua_cocos2dx_Label_enableStrikethrough(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Label* cobj = nullptr;
|
||||
|
@ -52658,7 +52752,7 @@ int lua_cocos2dx_Label_getLineSpacing(lua_State* tolua_S)
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getLineSpacing'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_enableStrikethrough'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -52668,19 +52762,19 @@ int lua_cocos2dx_Label_getLineSpacing(lua_State* tolua_S)
|
|||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getLineSpacing'", nullptr);
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_enableStrikethrough'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
double ret = cobj->getLineSpacing();
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
cobj->enableStrikethrough();
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getLineSpacing",argc, 0);
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:enableStrikethrough",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getLineSpacing'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_enableStrikethrough'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -53563,7 +53657,7 @@ int lua_cocos2dx_Label_getTTFConfig(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_getVerticalAlignment(lua_State* tolua_S)
|
||||
int lua_cocos2dx_Label_enableItalics(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Label* cobj = nullptr;
|
||||
|
@ -53583,7 +53677,7 @@ int lua_cocos2dx_Label_getVerticalAlignment(lua_State* tolua_S)
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getVerticalAlignment'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_enableItalics'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -53593,19 +53687,19 @@ int lua_cocos2dx_Label_getVerticalAlignment(lua_State* tolua_S)
|
|||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getVerticalAlignment'", nullptr);
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_enableItalics'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
int ret = (int)cobj->getVerticalAlignment();
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
cobj->enableItalics();
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getVerticalAlignment",argc, 0);
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:enableItalics",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getVerticalAlignment'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_enableItalics'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -53904,6 +53998,53 @@ int lua_cocos2dx_Label_getOverflow(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_getVerticalAlignment(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Label* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getVerticalAlignment'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getVerticalAlignment'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
int ret = (int)cobj->getVerticalAlignment();
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getVerticalAlignment",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getVerticalAlignment'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_setAdditionalKerning(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -54195,7 +54336,7 @@ int lua_cocos2dx_Label_setHorizontalAlignment(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_isWrapEnabled(lua_State* tolua_S)
|
||||
int lua_cocos2dx_Label_enableBold(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Label* cobj = nullptr;
|
||||
|
@ -54215,7 +54356,7 @@ int lua_cocos2dx_Label_isWrapEnabled(lua_State* tolua_S)
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_isWrapEnabled'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_enableBold'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -54225,19 +54366,66 @@ int lua_cocos2dx_Label_isWrapEnabled(lua_State* tolua_S)
|
|||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_isWrapEnabled'", nullptr);
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_enableBold'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
bool ret = cobj->isWrapEnabled();
|
||||
tolua_pushboolean(tolua_S,(bool)ret);
|
||||
cobj->enableBold();
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:isWrapEnabled",argc, 0);
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:enableBold",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_isWrapEnabled'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_enableBold'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_enableUnderline(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Label* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_enableUnderline'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_enableUnderline'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->enableUnderline();
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:enableUnderline",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_enableUnderline'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -54785,9 +54973,11 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"getMaxLineWidth",lua_cocos2dx_Label_getMaxLineWidth);
|
||||
tolua_function(tolua_S,"getHorizontalAlignment",lua_cocos2dx_Label_getHorizontalAlignment);
|
||||
tolua_function(tolua_S,"getShadowOffset",lua_cocos2dx_Label_getShadowOffset);
|
||||
tolua_function(tolua_S,"getLineSpacing",lua_cocos2dx_Label_getLineSpacing);
|
||||
tolua_function(tolua_S,"setClipMarginEnabled",lua_cocos2dx_Label_setClipMarginEnabled);
|
||||
tolua_function(tolua_S,"setString",lua_cocos2dx_Label_setString);
|
||||
tolua_function(tolua_S,"setSystemFontName",lua_cocos2dx_Label_setSystemFontName);
|
||||
tolua_function(tolua_S,"isWrapEnabled",lua_cocos2dx_Label_isWrapEnabled);
|
||||
tolua_function(tolua_S,"getOutlineSize",lua_cocos2dx_Label_getOutlineSize);
|
||||
tolua_function(tolua_S,"setBMFontFilePath",lua_cocos2dx_Label_setBMFontFilePath);
|
||||
tolua_function(tolua_S,"initWithTTF",lua_cocos2dx_Label_initWithTTF);
|
||||
|
@ -54795,7 +54985,7 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"setLineHeight",lua_cocos2dx_Label_setLineHeight);
|
||||
tolua_function(tolua_S,"setSystemFontSize",lua_cocos2dx_Label_setSystemFontSize);
|
||||
tolua_function(tolua_S,"setOverflow",lua_cocos2dx_Label_setOverflow);
|
||||
tolua_function(tolua_S,"getLineSpacing",lua_cocos2dx_Label_getLineSpacing);
|
||||
tolua_function(tolua_S,"enableStrikethrough",lua_cocos2dx_Label_enableStrikethrough);
|
||||
tolua_function(tolua_S,"updateContent",lua_cocos2dx_Label_updateContent);
|
||||
tolua_function(tolua_S,"getStringLength",lua_cocos2dx_Label_getStringLength);
|
||||
tolua_function(tolua_S,"setLineBreakWithoutSpace",lua_cocos2dx_Label_setLineBreakWithoutSpace);
|
||||
|
@ -54813,20 +55003,22 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"getLineHeight",lua_cocos2dx_Label_getLineHeight);
|
||||
tolua_function(tolua_S,"getShadowColor",lua_cocos2dx_Label_getShadowColor);
|
||||
tolua_function(tolua_S,"getTTFConfig",lua_cocos2dx_Label_getTTFConfig);
|
||||
tolua_function(tolua_S,"getVerticalAlignment",lua_cocos2dx_Label_getVerticalAlignment);
|
||||
tolua_function(tolua_S,"enableItalics",lua_cocos2dx_Label_enableItalics);
|
||||
tolua_function(tolua_S,"setTextColor",lua_cocos2dx_Label_setTextColor);
|
||||
tolua_function(tolua_S,"getLetter",lua_cocos2dx_Label_getLetter);
|
||||
tolua_function(tolua_S,"setHeight",lua_cocos2dx_Label_setHeight);
|
||||
tolua_function(tolua_S,"isShadowEnabled",lua_cocos2dx_Label_isShadowEnabled);
|
||||
tolua_function(tolua_S,"enableGlow",lua_cocos2dx_Label_enableGlow);
|
||||
tolua_function(tolua_S,"getOverflow",lua_cocos2dx_Label_getOverflow);
|
||||
tolua_function(tolua_S,"getVerticalAlignment",lua_cocos2dx_Label_getVerticalAlignment);
|
||||
tolua_function(tolua_S,"setAdditionalKerning",lua_cocos2dx_Label_setAdditionalKerning);
|
||||
tolua_function(tolua_S,"getSystemFontSize",lua_cocos2dx_Label_getSystemFontSize);
|
||||
tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_Label_setBlendFunc);
|
||||
tolua_function(tolua_S,"getTextAlignment",lua_cocos2dx_Label_getTextAlignment);
|
||||
tolua_function(tolua_S,"getBMFontFilePath",lua_cocos2dx_Label_getBMFontFilePath);
|
||||
tolua_function(tolua_S,"setHorizontalAlignment",lua_cocos2dx_Label_setHorizontalAlignment);
|
||||
tolua_function(tolua_S,"isWrapEnabled",lua_cocos2dx_Label_isWrapEnabled);
|
||||
tolua_function(tolua_S,"enableBold",lua_cocos2dx_Label_enableBold);
|
||||
tolua_function(tolua_S,"enableUnderline",lua_cocos2dx_Label_enableUnderline);
|
||||
tolua_function(tolua_S,"getLabelEffectType",lua_cocos2dx_Label_getLabelEffectType);
|
||||
tolua_function(tolua_S,"setAlignment",lua_cocos2dx_Label_setAlignment);
|
||||
tolua_function(tolua_S,"requestSystemFontRefresh",lua_cocos2dx_Label_requestSystemFontRefresh);
|
||||
|
@ -64656,6 +64848,53 @@ int lua_cocos2dx_ParticleSystem_setSourcePosition(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ParticleSystem_stop(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ParticleSystem* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.ParticleSystem",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ParticleSystem*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ParticleSystem_stop'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ParticleSystem_stop'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->stop();
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.ParticleSystem:stop",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ParticleSystem_stop'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ParticleSystem_updateParticleQuads(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -64950,6 +65189,53 @@ int lua_cocos2dx_ParticleSystem_setRotationIsDir(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ParticleSystem_start(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ParticleSystem* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.ParticleSystem",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ParticleSystem*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ParticleSystem_start'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ParticleSystem_start'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->start();
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.ParticleSystem:start",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ParticleSystem_start'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ParticleSystem_setEndSizeVar(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -66927,12 +67213,14 @@ int lua_register_cocos2dx_ParticleSystem(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"setEmitterMode",lua_cocos2dx_ParticleSystem_setEmitterMode);
|
||||
tolua_function(tolua_S,"getDuration",lua_cocos2dx_ParticleSystem_getDuration);
|
||||
tolua_function(tolua_S,"setSourcePosition",lua_cocos2dx_ParticleSystem_setSourcePosition);
|
||||
tolua_function(tolua_S,"stop",lua_cocos2dx_ParticleSystem_stop);
|
||||
tolua_function(tolua_S,"updateParticleQuads",lua_cocos2dx_ParticleSystem_updateParticleQuads);
|
||||
tolua_function(tolua_S,"getEndSpinVar",lua_cocos2dx_ParticleSystem_getEndSpinVar);
|
||||
tolua_function(tolua_S,"setBlendAdditive",lua_cocos2dx_ParticleSystem_setBlendAdditive);
|
||||
tolua_function(tolua_S,"setLife",lua_cocos2dx_ParticleSystem_setLife);
|
||||
tolua_function(tolua_S,"setAngleVar",lua_cocos2dx_ParticleSystem_setAngleVar);
|
||||
tolua_function(tolua_S,"setRotationIsDir",lua_cocos2dx_ParticleSystem_setRotationIsDir);
|
||||
tolua_function(tolua_S,"start",lua_cocos2dx_ParticleSystem_start);
|
||||
tolua_function(tolua_S,"setEndSizeVar",lua_cocos2dx_ParticleSystem_setEndSizeVar);
|
||||
tolua_function(tolua_S,"setAngle",lua_cocos2dx_ParticleSystem_setAngle);
|
||||
tolua_function(tolua_S,"setBatchNode",lua_cocos2dx_ParticleSystem_setBatchNode);
|
||||
|
|
|
@ -2170,6 +2170,15 @@ int register_all_cocos2dx(lua_State* tolua_S);
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "base/ccConfig.h"
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && !defined(CC_TARGET_OS_TVOS)
|
||||
#ifndef __cocos2dx_experimental_video_h__
|
||||
#define __cocos2dx_experimental_video_h__
|
||||
|
||||
|
@ -30,4 +30,4 @@ int register_all_cocos2dx_experimental_video(lua_State* tolua_S);
|
|||
|
||||
|
||||
#endif // __cocos2dx_experimental_video_h__
|
||||
#endif //#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
#endif //#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && !defined(CC_TARGET_OS_TVOS)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "base/ccConfig.h"
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && !defined(CC_TARGET_OS_TVOS)
|
||||
#ifndef __cocos2dx_experimental_webview_h__
|
||||
#define __cocos2dx_experimental_webview_h__
|
||||
|
||||
|
@ -30,4 +30,4 @@ int register_all_cocos2dx_experimental_webview(lua_State* tolua_S);
|
|||
|
||||
|
||||
#endif // __cocos2dx_experimental_webview_h__
|
||||
#endif //#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
#endif //#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && !defined(CC_TARGET_OS_TVOS)
|
||||
|
|
|
@ -13107,6 +13107,53 @@ int lua_cocos2dx_studio_ComAudio_end(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ComAudio_start(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::ComAudio* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccs.ComAudio",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocostudio::ComAudio*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ComAudio_start'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ComAudio_start'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->start();
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ComAudio:start",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ComAudio_start'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ComAudio_stopBackgroundMusic(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -13510,6 +13557,53 @@ int lua_cocos2dx_studio_ComAudio_playBackgroundMusic(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ComAudio_stop(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::ComAudio* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccs.ComAudio",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocostudio::ComAudio*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ComAudio_stop'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ComAudio_stop'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->stop();
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ComAudio:stop",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ComAudio_stop'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ComAudio_playEffect(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -14155,6 +14249,7 @@ int lua_register_cocos2dx_studio_ComAudio(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"willPlayBackgroundMusic",lua_cocos2dx_studio_ComAudio_willPlayBackgroundMusic);
|
||||
tolua_function(tolua_S,"setBackgroundMusicVolume",lua_cocos2dx_studio_ComAudio_setBackgroundMusicVolume);
|
||||
tolua_function(tolua_S,"end",lua_cocos2dx_studio_ComAudio_end);
|
||||
tolua_function(tolua_S,"start",lua_cocos2dx_studio_ComAudio_start);
|
||||
tolua_function(tolua_S,"stopBackgroundMusic",lua_cocos2dx_studio_ComAudio_stopBackgroundMusic);
|
||||
tolua_function(tolua_S,"pauseBackgroundMusic",lua_cocos2dx_studio_ComAudio_pauseBackgroundMusic);
|
||||
tolua_function(tolua_S,"isBackgroundMusicPlaying",lua_cocos2dx_studio_ComAudio_isBackgroundMusicPlaying);
|
||||
|
@ -14163,6 +14258,7 @@ int lua_register_cocos2dx_studio_ComAudio(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"pauseAllEffects",lua_cocos2dx_studio_ComAudio_pauseAllEffects);
|
||||
tolua_function(tolua_S,"preloadBackgroundMusic",lua_cocos2dx_studio_ComAudio_preloadBackgroundMusic);
|
||||
tolua_function(tolua_S,"playBackgroundMusic",lua_cocos2dx_studio_ComAudio_playBackgroundMusic);
|
||||
tolua_function(tolua_S,"stop",lua_cocos2dx_studio_ComAudio_stop);
|
||||
tolua_function(tolua_S,"playEffect",lua_cocos2dx_studio_ComAudio_playEffect);
|
||||
tolua_function(tolua_S,"preloadEffect",lua_cocos2dx_studio_ComAudio_preloadEffect);
|
||||
tolua_function(tolua_S,"setLoop",lua_cocos2dx_studio_ComAudio_setLoop);
|
||||
|
@ -15349,6 +15445,59 @@ int lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFlatBuffersFi
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimelineCache_createActionFromContent(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::ActionTimelineCache* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimelineCache",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocostudio::timeline::ActionTimelineCache*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimelineCache_createActionFromContent'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 2)
|
||||
{
|
||||
std::string arg0;
|
||||
std::string arg1;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccs.ActionTimelineCache:createActionFromContent");
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 3,&arg1, "ccs.ActionTimelineCache:createActionFromContent");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimelineCache_createActionFromContent'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocostudio::timeline::ActionTimeline* ret = cobj->createActionFromContent(arg0, arg1);
|
||||
object_to_luaval<cocostudio::timeline::ActionTimeline>(tolua_S, "ccs.ActionTimeline",(cocostudio::timeline::ActionTimeline*)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimelineCache:createActionFromContent",argc, 2);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineCache_createActionFromContent'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimelineCache_purge(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -15443,56 +15592,6 @@ int lua_cocos2dx_studio_ActionTimelineCache_init(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFile(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::ActionTimelineCache* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimelineCache",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocostudio::timeline::ActionTimelineCache*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFile'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccs.ActionTimelineCache:loadAnimationActionWithFile");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFile'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocostudio::timeline::ActionTimeline* ret = cobj->loadAnimationActionWithFile(arg0);
|
||||
object_to_luaval<cocostudio::timeline::ActionTimeline>(tolua_S, "ccs.ActionTimeline",(cocostudio::timeline::ActionTimeline*)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimelineCache:loadAnimationActionWithFile",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFile'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithContent(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -15546,6 +15645,56 @@ int lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithContent(lua_S
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFile(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::ActionTimelineCache* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimelineCache",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocostudio::timeline::ActionTimelineCache*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFile'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccs.ActionTimelineCache:loadAnimationActionWithFile");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFile'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocostudio::timeline::ActionTimeline* ret = cobj->loadAnimationActionWithFile(arg0);
|
||||
object_to_luaval<cocostudio::timeline::ActionTimeline>(tolua_S, "ccs.ActionTimeline",(cocostudio::timeline::ActionTimeline*)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimelineCache:loadAnimationActionWithFile",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFile'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimelineCache_removeAction(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -15731,10 +15880,11 @@ int lua_register_cocos2dx_studio_ActionTimelineCache(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"createActionFromJson",lua_cocos2dx_studio_ActionTimelineCache_createActionFromJson);
|
||||
tolua_function(tolua_S,"createActionWithFlatBuffersFile",lua_cocos2dx_studio_ActionTimelineCache_createActionWithFlatBuffersFile);
|
||||
tolua_function(tolua_S,"loadAnimationActionWithFlatBuffersFile",lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFlatBuffersFile);
|
||||
tolua_function(tolua_S,"createActionFromContent",lua_cocos2dx_studio_ActionTimelineCache_createActionFromContent);
|
||||
tolua_function(tolua_S,"purge",lua_cocos2dx_studio_ActionTimelineCache_purge);
|
||||
tolua_function(tolua_S,"init",lua_cocos2dx_studio_ActionTimelineCache_init);
|
||||
tolua_function(tolua_S,"loadAnimationActionWithFile",lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFile);
|
||||
tolua_function(tolua_S,"loadAnimationActionWithContent",lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithContent);
|
||||
tolua_function(tolua_S,"loadAnimationActionWithFile",lua_cocos2dx_studio_ActionTimelineCache_loadAnimationActionWithFile);
|
||||
tolua_function(tolua_S,"removeAction",lua_cocos2dx_studio_ActionTimelineCache_removeAction);
|
||||
tolua_function(tolua_S,"createActionWithFlatBuffersForSimulator",lua_cocos2dx_studio_ActionTimelineCache_createActionWithFlatBuffersForSimulator);
|
||||
tolua_function(tolua_S,"destroyInstance", lua_cocos2dx_studio_ActionTimelineCache_destroyInstance);
|
||||
|
@ -19975,6 +20125,197 @@ int lua_register_cocos2dx_studio_BlendFuncFrame(lua_State* tolua_S)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int lua_cocos2dx_studio_PlayableFrame_setPlayableAct(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::PlayableFrame* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccs.PlayableFrame",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocostudio::timeline::PlayableFrame*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_PlayableFrame_setPlayableAct'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccs.PlayableFrame:setPlayableAct");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_PlayableFrame_setPlayableAct'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setPlayableAct(arg0);
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.PlayableFrame:setPlayableAct",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_PlayableFrame_setPlayableAct'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_PlayableFrame_getPlayableAct(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::PlayableFrame* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccs.PlayableFrame",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocostudio::timeline::PlayableFrame*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_PlayableFrame_getPlayableAct'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_PlayableFrame_getPlayableAct'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
std::string ret = cobj->getPlayableAct();
|
||||
tolua_pushcppstring(tolua_S,ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.PlayableFrame:getPlayableAct",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_PlayableFrame_getPlayableAct'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_PlayableFrame_create(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertable(tolua_S,1,"ccs.PlayableFrame",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S) - 1;
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_PlayableFrame_create'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocostudio::timeline::PlayableFrame* ret = cocostudio::timeline::PlayableFrame::create();
|
||||
object_to_luaval<cocostudio::timeline::PlayableFrame>(tolua_S, "ccs.PlayableFrame",(cocostudio::timeline::PlayableFrame*)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "ccs.PlayableFrame:create",argc, 0);
|
||||
return 0;
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_PlayableFrame_create'.",&tolua_err);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_PlayableFrame_constructor(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::PlayableFrame* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_PlayableFrame_constructor'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj = new cocostudio::timeline::PlayableFrame();
|
||||
cobj->autorelease();
|
||||
int ID = (int)cobj->_ID ;
|
||||
int* luaID = &cobj->_luaID ;
|
||||
toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)cobj,"ccs.PlayableFrame");
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.PlayableFrame:PlayableFrame",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_PlayableFrame_constructor'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lua_cocos2dx_studio_PlayableFrame_finalize(lua_State* tolua_S)
|
||||
{
|
||||
printf("luabindings: finalizing LUA object (PlayableFrame)");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lua_register_cocos2dx_studio_PlayableFrame(lua_State* tolua_S)
|
||||
{
|
||||
tolua_usertype(tolua_S,"ccs.PlayableFrame");
|
||||
tolua_cclass(tolua_S,"PlayableFrame","ccs.PlayableFrame","ccs.Frame",nullptr);
|
||||
|
||||
tolua_beginmodule(tolua_S,"PlayableFrame");
|
||||
tolua_function(tolua_S,"new",lua_cocos2dx_studio_PlayableFrame_constructor);
|
||||
tolua_function(tolua_S,"setPlayableAct",lua_cocos2dx_studio_PlayableFrame_setPlayableAct);
|
||||
tolua_function(tolua_S,"getPlayableAct",lua_cocos2dx_studio_PlayableFrame_getPlayableAct);
|
||||
tolua_function(tolua_S,"create", lua_cocos2dx_studio_PlayableFrame_create);
|
||||
tolua_endmodule(tolua_S);
|
||||
std::string typeName = typeid(cocostudio::timeline::PlayableFrame).name();
|
||||
g_luaType[typeName] = "ccs.PlayableFrame";
|
||||
g_typeCast["PlayableFrame"] = "ccs.PlayableFrame";
|
||||
return 1;
|
||||
}
|
||||
|
||||
int lua_cocos2dx_studio_Timeline_clone(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -21257,6 +21598,53 @@ int lua_cocos2dx_studio_ActionTimeline_pause(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimeline_start(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::ActionTimeline* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_start'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimeline_start'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->start();
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:start",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_start'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimeline_init(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -22593,6 +22981,7 @@ int lua_register_cocos2dx_studio_ActionTimeline(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"getCurrentFrame",lua_cocos2dx_studio_ActionTimeline_getCurrentFrame);
|
||||
tolua_function(tolua_S,"getStartFrame",lua_cocos2dx_studio_ActionTimeline_getStartFrame);
|
||||
tolua_function(tolua_S,"pause",lua_cocos2dx_studio_ActionTimeline_pause);
|
||||
tolua_function(tolua_S,"start",lua_cocos2dx_studio_ActionTimeline_start);
|
||||
tolua_function(tolua_S,"init",lua_cocos2dx_studio_ActionTimeline_init);
|
||||
tolua_function(tolua_S,"removeTimeline",lua_cocos2dx_studio_ActionTimeline_removeTimeline);
|
||||
tolua_function(tolua_S,"clearFrameEventCallFunc",lua_cocos2dx_studio_ActionTimeline_clearFrameEventCallFunc);
|
||||
|
@ -24671,17 +25060,17 @@ TOLUA_API int register_all_cocos2dx_studio(lua_State* tolua_S)
|
|||
tolua_module(tolua_S,"ccs",0);
|
||||
tolua_beginmodule(tolua_S,"ccs");
|
||||
|
||||
lua_register_cocos2dx_studio_Frame(tolua_S);
|
||||
lua_register_cocos2dx_studio_PlayableFrame(tolua_S);
|
||||
lua_register_cocos2dx_studio_ActionTimelineNode(tolua_S);
|
||||
lua_register_cocos2dx_studio_ActionFrame(tolua_S);
|
||||
lua_register_cocos2dx_studio_ActionRotationFrame(tolua_S);
|
||||
lua_register_cocos2dx_studio_Frame(tolua_S);
|
||||
lua_register_cocos2dx_studio_BlendFuncFrame(tolua_S);
|
||||
lua_register_cocos2dx_studio_BoneNode(tolua_S);
|
||||
lua_register_cocos2dx_studio_SkeletonNode(tolua_S);
|
||||
lua_register_cocos2dx_studio_ScaleFrame(tolua_S);
|
||||
lua_register_cocos2dx_studio_Tween(tolua_S);
|
||||
lua_register_cocos2dx_studio_ContourData(tolua_S);
|
||||
lua_register_cocos2dx_studio_ComAudio(tolua_S);
|
||||
lua_register_cocos2dx_studio_ActionTimeline(tolua_S);
|
||||
lua_register_cocos2dx_studio_InnerActionFrame(tolua_S);
|
||||
lua_register_cocos2dx_studio_ActionTimelineData(tolua_S);
|
||||
|
@ -24723,6 +25112,7 @@ TOLUA_API int register_all_cocos2dx_studio(lua_State* tolua_S)
|
|||
lua_register_cocos2dx_studio_SceneReader(tolua_S);
|
||||
lua_register_cocos2dx_studio_ActionTimelineCache(tolua_S);
|
||||
lua_register_cocos2dx_studio_AlphaFrame(tolua_S);
|
||||
lua_register_cocos2dx_studio_ComAudio(tolua_S);
|
||||
lua_register_cocos2dx_studio_ComExtensionData(tolua_S);
|
||||
lua_register_cocos2dx_studio_AnimationData(tolua_S);
|
||||
lua_register_cocos2dx_studio_AnchorPointFrame(tolua_S);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue