This commit is contained in:
2youyou2 2014-06-12 16:43:04 +08:00
commit 7eda0ae999
22 changed files with 268 additions and 403 deletions

View File

@ -841,6 +841,7 @@ Developers:
sachingarg05 sachingarg05
Re-added orientation change callback in java activity Re-added orientation change callback in java activity
GLProgram should not abort() if shader compilation fails, returning false is better.
dplusic dplusic
Fixed that cc.pGetAngle may return wrong value Fixed that cc.pGetAngle may return wrong value
@ -881,6 +882,12 @@ Developers:
zhouxiaoxiaoxujian zhouxiaoxiaoxujian
Added TextField::getStringLength() Added TextField::getStringLength()
Add shadow, outline, glow filter support for UIText Add shadow, outline, glow filter support for UIText
QiuleiWang
Fix the bug that calculated height of multi-line string was incorrect on iOS
Rumist
Fix the bug that the result of Director->convertToUI() is error.
Retired Core Developers: Retired Core Developers:
WenSheng Yang WenSheng Yang

View File

@ -1,4 +1,5 @@
cocos2d-x-3.2 ??? cocos2d-x-3.2 ???
[NEW] Console: add a command to show engine version
[NEW] Node: added setter/getter for NormalizedPosition(). Allows to set positions in normalized values (between 0 and 1) [NEW] Node: added setter/getter for NormalizedPosition(). Allows to set positions in normalized values (between 0 and 1)
[NEW] Scene: Added createWithSize() method [NEW] Scene: Added createWithSize() method
[NEW] TextField: added getStringLength() [NEW] TextField: added getStringLength()
@ -10,11 +11,15 @@ cocos2d-x-3.2 ???
[FIX] Android: 3d model will be black when coming from background [FIX] Android: 3d model will be black when coming from background
[FIX] Android: don't trigger EVENT_COME_TO_BACKGROUND event when go to background [FIX] Android: don't trigger EVENT_COME_TO_BACKGROUND event when go to background
[FIX] Cocos2dxGLSurfaceView.java: prevent flickering when opening another activity [FIX] Cocos2dxGLSurfaceView.java: prevent flickering when opening another activity
[FIX] Director: Director->convertToUI() returns wrong value.
[FIX] GLProgram: not abort if shader compilation fails, just retuan false.
[FIX] GLProgramState: sampler can not be changed [FIX] GLProgramState: sampler can not be changed
[FIX] Image: Set jpeg save quality to 90 [FIX] Image: Set jpeg save quality to 90
[FIX] Image: premultiply alpha when loading png file to resolve black border issue [FIX] Image: premultiply alpha when loading png file to resolve black border issue
[FIX] Label: label is unsharp if it's created by smaller font [FIX] Label: label is unsharp if it's created by smaller font
[FIX] Label: Label's display may go bonkers if invoking Label::setString() with outline feature enabled [FIX] Label: Label's display may go bonkers if invoking Label::setString() with outline feature enabled
[FIX] Label: don't release cached texture in time
[FIX] Label: calculated height of multi-line string was incorrect on iOS
[FIX] Lua-binding: compiling error on release mode [FIX] Lua-binding: compiling error on release mode
[FIX] Lua-binding: Add xxtea encrypt support [FIX] Lua-binding: Add xxtea encrypt support
[FIX] Node: setPhysicsBody() can not work correctly if it is added to a Node [FIX] Node: setPhysicsBody() can not work correctly if it is added to a Node
@ -26,6 +31,7 @@ cocos2d-x-3.2 ???
[FIX] Schedule: schedulePerFrame() can not be called twice [FIX] Schedule: schedulePerFrame() can not be called twice
[FIX] SpriteFrameCache: fix memory leak [FIX] SpriteFrameCache: fix memory leak
[FIX] Texture2D: use image's pixel format to create texture [FIX] Texture2D: use image's pixel format to create texture
[FIX] TextureCache: addImageAsync() may repeatedly generate Image for the same image file
[FIX] WP8: will restart if app goes to background, then touches icon to go to foreground [FIX] WP8: will restart if app goes to background, then touches icon to go to foreground
[FIX] WP8: will be black if: 1. 3rd pops up a view; 2. go to background; 3. come to foreground [FIX] WP8: will be black if: 1. 3rd pops up a view; 2. go to background; 3. come to foreground
[FIX] WP8: project name of new project created by console is wrong [FIX] WP8: project name of new project created by console is wrong

View File

@ -392,16 +392,12 @@ void Label::setFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled /* = false *
if (_reusedLetter == nullptr) if (_reusedLetter == nullptr)
{ {
_reusedLetter = Sprite::createWithTexture(_fontAtlas->getTexture(0)); _reusedLetter = Sprite::create();
_reusedLetter->setOpacityModifyRGB(_isOpacityModifyRGB); _reusedLetter->setOpacityModifyRGB(_isOpacityModifyRGB);
_reusedLetter->retain(); _reusedLetter->retain();
_reusedLetter->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT); _reusedLetter->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT);
_reusedLetter->setBatchNode(this);
}
else
{
_reusedLetter->setTexture(_fontAtlas->getTexture(0));
} }
_reusedLetter->setBatchNode(this);
if (_fontAtlas) if (_fontAtlas)
{ {

View File

@ -280,6 +280,7 @@
<ClCompile Include="..\base\ccUtils.cpp" /> <ClCompile Include="..\base\ccUtils.cpp" />
<ClCompile Include="..\base\CCValue.cpp" /> <ClCompile Include="..\base\CCValue.cpp" />
<ClCompile Include="..\base\etc1.cpp" /> <ClCompile Include="..\base\etc1.cpp" />
<ClCompile Include="..\base\ObjectFactory.cpp" />
<ClCompile Include="..\base\s3tc.cpp" /> <ClCompile Include="..\base\s3tc.cpp" />
<ClCompile Include="..\base\TGAlib.cpp" /> <ClCompile Include="..\base\TGAlib.cpp" />
<ClCompile Include="..\base\ZipUtils.cpp" /> <ClCompile Include="..\base\ZipUtils.cpp" />
@ -476,6 +477,7 @@
<ClInclude Include="..\base\CCVector.h" /> <ClInclude Include="..\base\CCVector.h" />
<ClInclude Include="..\base\etc1.h" /> <ClInclude Include="..\base\etc1.h" />
<ClInclude Include="..\base\firePngData.h" /> <ClInclude Include="..\base\firePngData.h" />
<ClInclude Include="..\base\ObjectFactory.h" />
<ClInclude Include="..\base\s3tc.h" /> <ClInclude Include="..\base\s3tc.h" />
<ClInclude Include="..\base\TGAlib.h" /> <ClInclude Include="..\base\TGAlib.h" />
<ClInclude Include="..\base\uthash.h" /> <ClInclude Include="..\base\uthash.h" />

View File

@ -593,6 +593,9 @@
<Filter>renderer</Filter> <Filter>renderer</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\platform\wp8\pch.cpp" /> <ClCompile Include="..\platform\wp8\pch.cpp" />
<ClCompile Include="..\base\ObjectFactory.cpp">
<Filter>base</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\physics\CCPhysicsBody.h"> <ClInclude Include="..\physics\CCPhysicsBody.h">
@ -1205,6 +1208,9 @@
<Filter>renderer</Filter> <Filter>renderer</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\platform\wp8\pch.h" /> <ClInclude Include="..\platform\wp8\pch.h" />
<ClInclude Include="..\base\ObjectFactory.h">
<Filter>base</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\math\Mat4.inl"> <None Include="..\math\Mat4.inl">

View File

@ -65,6 +65,7 @@
#include "base/base64.h" #include "base/base64.h"
NS_CC_BEGIN NS_CC_BEGIN
extern const char* cocos2dVersion(void);
//TODO: these general utils should be in a seperate class //TODO: these general utils should be in a seperate class
// //
// Trimming functions were taken from: http://stackoverflow.com/a/217605 // Trimming functions were taken from: http://stackoverflow.com/a/217605
@ -295,6 +296,9 @@ Console::Console()
{ "director", "director commands, type -h or [director help] to list supported directives", std::bind(&Console::commandDirector, this, std::placeholders::_1, std::placeholders::_2) }, { "director", "director commands, type -h or [director help] to list supported directives", std::bind(&Console::commandDirector, this, std::placeholders::_1, std::placeholders::_2) },
{ "touch", "simulate touch event via console, type -h or [touch help] to list supported directives", std::bind(&Console::commandTouch, this, std::placeholders::_1, std::placeholders::_2) }, { "touch", "simulate touch event via console, type -h or [touch help] to list supported directives", std::bind(&Console::commandTouch, this, std::placeholders::_1, std::placeholders::_2) },
{ "upload", "upload file. Args: [filename base64_encoded_data]", std::bind(&Console::commandUpload, this, std::placeholders::_1) }, { "upload", "upload file. Args: [filename base64_encoded_data]", std::bind(&Console::commandUpload, this, std::placeholders::_1) },
{ "version", "print version string ", [](int fd, const std::string& args) {
mydprintf(fd, "%s\n", cocos2dVersion());
} },
}; };
; ;

View File

@ -1,4 +1,4 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2013 cocos2d-x.org Copyright (c) 2010-2013 cocos2d-x.org
Copyright (c) 2011 Zynga Inc. Copyright (c) 2011 Zynga Inc.
@ -763,6 +763,18 @@ Vec2 Director::convertToUI(const Vec2& glPoint)
Vec4 glCoord(glPoint.x, glPoint.y, 0.0, 1); Vec4 glCoord(glPoint.x, glPoint.y, 0.0, 1);
transform.transformVector(glCoord, &clipCoord); transform.transformVector(glCoord, &clipCoord);
/*
BUG-FIX #5506
a = (Vx, Vy, Vz, 1)
b = (a×M)T
Out = 1 bw(bx, by, bz)
*/
clipCoord.x = clipCoord.x / clipCoord.w;
clipCoord.y = clipCoord.y / clipCoord.w;
clipCoord.z = clipCoord.z / clipCoord.w;
Size glSize = _openGLView->getDesignResolutionSize(); Size glSize = _openGLView->getDesignResolutionSize();
float factor = 1.0/glCoord.w; float factor = 1.0/glCoord.w;
return Vec2(glSize.width*(clipCoord.x*0.5 + 0.5) * factor, glSize.height*(-clipCoord.y*0.5 + 0.5) * factor); return Vec2(glSize.width*(clipCoord.x*0.5 + 0.5) * factor, glSize.height*(-clipCoord.y*0.5 + 0.5) * factor);

View File

@ -215,26 +215,14 @@ static inline void lazyCheckIOS7()
static CGSize _calculateStringSize(NSString *str, id font, CGSize *constrainSize) static CGSize _calculateStringSize(NSString *str, id font, CGSize *constrainSize)
{ {
NSArray *listItems = [str componentsSeparatedByString: @"\n"];
CGSize dim = CGSizeZero;
CGSize textRect = CGSizeZero; CGSize textRect = CGSizeZero;
textRect.width = constrainSize->width > 0 ? constrainSize->width textRect.width = constrainSize->width > 0 ? constrainSize->width
: 0x7fffffff; : 0x7fffffff;
textRect.height = constrainSize->height > 0 ? constrainSize->height textRect.height = constrainSize->height > 0 ? constrainSize->height
: 0x7fffffff; : 0x7fffffff;
for (NSString *s in listItems) CGSize dim = [str sizeWithFont:font constrainedToSize:textRect];
{
CGSize tmp = [s sizeWithFont:font constrainedToSize:textRect];
if (tmp.width > dim.width)
{
dim.width = tmp.width;
}
dim.height += tmp.height;
}
dim.width = ceilf(dim.width); dim.width = ceilf(dim.width);
dim.height = ceilf(dim.height); dim.height = ceilf(dim.height);

View File

@ -138,9 +138,17 @@ GLProgram::~GLProgram()
{ {
CCLOGINFO("%s %d deallocing GLProgram: %p", __FUNCTION__, __LINE__, this); CCLOGINFO("%s %d deallocing GLProgram: %p", __FUNCTION__, __LINE__, this);
// there is no need to delete the shaders. They should have been already deleted. if (_vertShader)
CCASSERT(_vertShader == 0, "Vertex Shaders should have been already deleted"); {
CCASSERT(_fragShader == 0, "Fragment Shaders should have been already deleted"); glDeleteShader(_vertShader);
}
if (_fragShader)
{
glDeleteShader(_fragShader);
}
_vertShader = _fragShader = 0;
if (_program) if (_program)
{ {
@ -436,7 +444,7 @@ bool GLProgram::compileShader(GLuint * shader, GLenum type, const GLchar* source
} }
free(src); free(src);
abort(); return false;;
} }
return (status == GL_TRUE); return (status == GL_TRUE);
} }

View File

@ -206,11 +206,11 @@ void TextureCache::loadImage()
for (; pos < infoSize; pos++) for (; pos < infoSize; pos++)
{ {
imageInfo = (*_imageInfoQueue)[pos]; imageInfo = (*_imageInfoQueue)[pos];
if(imageInfo->asyncStruct->filename.compare(asyncStruct->filename)) if(imageInfo->asyncStruct->filename.compare(asyncStruct->filename) == 0)
break; break;
} }
_imageInfoMutex.unlock(); _imageInfoMutex.unlock();
if(infoSize == 0 || pos < infoSize) if(infoSize == 0 || pos == infoSize)
generateImage = true; generateImage = true;
} }

View File

@ -19,19 +19,10 @@
-- @param #cc.Texture2D texture2d -- @param #cc.Texture2D texture2d
-------------------------------- --------------------------------
-- overload function: initWithTexture(cc.Texture2D, rect_table, bool, vec2_table, size_table) -- @function [parent=#SpriteFrame] getOffset
--
-- overload function: initWithTexture(cc.Texture2D, rect_table)
--
-- @function [parent=#SpriteFrame] initWithTexture
-- @param self -- @param self
-- @param #cc.Texture2D texture2d -- @return vec2_table#vec2_table ret (return value: vec2_table)
-- @param #rect_table rect
-- @param #bool bool
-- @param #vec2_table vec2
-- @param #size_table size
-- @return bool#bool ret (retunr value: bool)
-------------------------------- --------------------------------
-- @function [parent=#SpriteFrame] setRectInPixels -- @function [parent=#SpriteFrame] setRectInPixels
-- @param self -- @param self
@ -77,30 +68,11 @@
-- @param self -- @param self
-- @param #vec2_table vec2 -- @param #vec2_table vec2
--------------------------------
-- @function [parent=#SpriteFrame] getOffset
-- @param self
-- @return vec2_table#vec2_table ret (return value: vec2_table)
-------------------------------- --------------------------------
-- @function [parent=#SpriteFrame] isRotated -- @function [parent=#SpriteFrame] isRotated
-- @param self -- @param self
-- @return bool#bool ret (return value: bool) -- @return bool#bool ret (return value: bool)
--------------------------------
-- overload function: initWithTextureFilename(string, rect_table, bool, vec2_table, size_table)
--
-- overload function: initWithTextureFilename(string, rect_table)
--
-- @function [parent=#SpriteFrame] initWithTextureFilename
-- @param self
-- @param #string str
-- @param #rect_table rect
-- @param #bool bool
-- @param #vec2_table vec2
-- @param #size_table size
-- @return bool#bool ret (retunr value: bool)
-------------------------------- --------------------------------
-- @function [parent=#SpriteFrame] setRect -- @function [parent=#SpriteFrame] setRect
-- @param self -- @param self

View File

@ -18065,77 +18065,46 @@ int lua_cocos2dx_SpriteFrame_setTexture(lua_State* tolua_S)
return 0; return 0;
} }
int lua_cocos2dx_SpriteFrame_initWithTexture(lua_State* tolua_S) int lua_cocos2dx_SpriteFrame_getOffset(lua_State* tolua_S)
{ {
int argc = 0; int argc = 0;
cocos2d::SpriteFrame* cobj = nullptr; cocos2d::SpriteFrame* cobj = nullptr;
bool ok = true; bool ok = true;
#if COCOS2D_DEBUG >= 1 #if COCOS2D_DEBUG >= 1
tolua_Error tolua_err; tolua_Error tolua_err;
#endif #endif
#if COCOS2D_DEBUG >= 1 #if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.SpriteFrame",0,&tolua_err)) goto tolua_lerror; if (!tolua_isusertype(tolua_S,1,"cc.SpriteFrame",0,&tolua_err)) goto tolua_lerror;
#endif #endif
cobj = (cocos2d::SpriteFrame*)tolua_tousertype(tolua_S,1,0); cobj = (cocos2d::SpriteFrame*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1 #if COCOS2D_DEBUG >= 1
if (!cobj) if (!cobj)
{ {
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_SpriteFrame_initWithTexture'", nullptr); tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_SpriteFrame_getOffset'", nullptr);
return 0; return 0;
} }
#endif #endif
argc = lua_gettop(tolua_S)-1; argc = lua_gettop(tolua_S)-1;
do{ if (argc == 0)
if (argc == 5) { {
cocos2d::Texture2D* arg0; if(!ok)
ok &= luaval_to_object<cocos2d::Texture2D>(tolua_S, 2, "cc.Texture2D",&arg0); return 0;
const cocos2d::Vec2& ret = cobj->getOffset();
if (!ok) { break; } vec2_to_luaval(tolua_S, ret);
cocos2d::Rect arg1; return 1;
ok &= luaval_to_rect(tolua_S, 3, &arg1); }
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getOffset",argc, 0);
if (!ok) { break; }
bool arg2;
ok &= luaval_to_boolean(tolua_S, 4,&arg2);
if (!ok) { break; }
cocos2d::Vec2 arg3;
ok &= luaval_to_vec2(tolua_S, 5, &arg3);
if (!ok) { break; }
cocos2d::Size arg4;
ok &= luaval_to_size(tolua_S, 6, &arg4);
if (!ok) { break; }
bool ret = cobj->initWithTexture(arg0, arg1, arg2, arg3, arg4);
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
}while(0);
ok = true;
do{
if (argc == 2) {
cocos2d::Texture2D* arg0;
ok &= luaval_to_object<cocos2d::Texture2D>(tolua_S, 2, "cc.Texture2D",&arg0);
if (!ok) { break; }
cocos2d::Rect arg1;
ok &= luaval_to_rect(tolua_S, 3, &arg1);
if (!ok) { break; }
bool ret = cobj->initWithTexture(arg0, arg1);
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
}while(0);
ok = true;
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "initWithTexture",argc, 2);
return 0; return 0;
#if COCOS2D_DEBUG >= 1 #if COCOS2D_DEBUG >= 1
tolua_lerror: tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_SpriteFrame_initWithTexture'.",&tolua_err); tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_SpriteFrame_getOffset'.",&tolua_err);
#endif #endif
return 0; return 0;
@ -18546,50 +18515,6 @@ int lua_cocos2dx_SpriteFrame_setOffset(lua_State* tolua_S)
return 0; return 0;
} }
int lua_cocos2dx_SpriteFrame_getOffset(lua_State* tolua_S)
{
int argc = 0;
cocos2d::SpriteFrame* 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.SpriteFrame",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::SpriteFrame*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_SpriteFrame_getOffset'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
const cocos2d::Vec2& ret = cobj->getOffset();
vec2_to_luaval(tolua_S, ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getOffset",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_SpriteFrame_getOffset'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_SpriteFrame_isRotated(lua_State* tolua_S) int lua_cocos2dx_SpriteFrame_isRotated(lua_State* tolua_S)
{ {
int argc = 0; int argc = 0;
@ -18634,81 +18559,6 @@ int lua_cocos2dx_SpriteFrame_isRotated(lua_State* tolua_S)
return 0; return 0;
} }
int lua_cocos2dx_SpriteFrame_initWithTextureFilename(lua_State* tolua_S)
{
int argc = 0;
cocos2d::SpriteFrame* 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.SpriteFrame",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::SpriteFrame*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_SpriteFrame_initWithTextureFilename'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
do{
if (argc == 5) {
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0);
if (!ok) { break; }
cocos2d::Rect arg1;
ok &= luaval_to_rect(tolua_S, 3, &arg1);
if (!ok) { break; }
bool arg2;
ok &= luaval_to_boolean(tolua_S, 4,&arg2);
if (!ok) { break; }
cocos2d::Vec2 arg3;
ok &= luaval_to_vec2(tolua_S, 5, &arg3);
if (!ok) { break; }
cocos2d::Size arg4;
ok &= luaval_to_size(tolua_S, 6, &arg4);
if (!ok) { break; }
bool ret = cobj->initWithTextureFilename(arg0, arg1, arg2, arg3, arg4);
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
}while(0);
ok = true;
do{
if (argc == 2) {
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0);
if (!ok) { break; }
cocos2d::Rect arg1;
ok &= luaval_to_rect(tolua_S, 3, &arg1);
if (!ok) { break; }
bool ret = cobj->initWithTextureFilename(arg0, arg1);
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
}while(0);
ok = true;
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "initWithTextureFilename",argc, 2);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_SpriteFrame_initWithTextureFilename'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_SpriteFrame_setRect(lua_State* tolua_S) int lua_cocos2dx_SpriteFrame_setRect(lua_State* tolua_S)
{ {
int argc = 0; int argc = 0;
@ -18984,7 +18834,7 @@ int lua_register_cocos2dx_SpriteFrame(lua_State* tolua_S)
tolua_function(tolua_S,"clone",lua_cocos2dx_SpriteFrame_clone); tolua_function(tolua_S,"clone",lua_cocos2dx_SpriteFrame_clone);
tolua_function(tolua_S,"setRotated",lua_cocos2dx_SpriteFrame_setRotated); tolua_function(tolua_S,"setRotated",lua_cocos2dx_SpriteFrame_setRotated);
tolua_function(tolua_S,"setTexture",lua_cocos2dx_SpriteFrame_setTexture); tolua_function(tolua_S,"setTexture",lua_cocos2dx_SpriteFrame_setTexture);
tolua_function(tolua_S,"initWithTexture",lua_cocos2dx_SpriteFrame_initWithTexture); tolua_function(tolua_S,"getOffset",lua_cocos2dx_SpriteFrame_getOffset);
tolua_function(tolua_S,"setRectInPixels",lua_cocos2dx_SpriteFrame_setRectInPixels); tolua_function(tolua_S,"setRectInPixels",lua_cocos2dx_SpriteFrame_setRectInPixels);
tolua_function(tolua_S,"getTexture",lua_cocos2dx_SpriteFrame_getTexture); tolua_function(tolua_S,"getTexture",lua_cocos2dx_SpriteFrame_getTexture);
tolua_function(tolua_S,"getRect",lua_cocos2dx_SpriteFrame_getRect); tolua_function(tolua_S,"getRect",lua_cocos2dx_SpriteFrame_getRect);
@ -18994,9 +18844,7 @@ int lua_register_cocos2dx_SpriteFrame(lua_State* tolua_S)
tolua_function(tolua_S,"getOriginalSizeInPixels",lua_cocos2dx_SpriteFrame_getOriginalSizeInPixels); tolua_function(tolua_S,"getOriginalSizeInPixels",lua_cocos2dx_SpriteFrame_getOriginalSizeInPixels);
tolua_function(tolua_S,"setOriginalSizeInPixels",lua_cocos2dx_SpriteFrame_setOriginalSizeInPixels); tolua_function(tolua_S,"setOriginalSizeInPixels",lua_cocos2dx_SpriteFrame_setOriginalSizeInPixels);
tolua_function(tolua_S,"setOffset",lua_cocos2dx_SpriteFrame_setOffset); tolua_function(tolua_S,"setOffset",lua_cocos2dx_SpriteFrame_setOffset);
tolua_function(tolua_S,"getOffset",lua_cocos2dx_SpriteFrame_getOffset);
tolua_function(tolua_S,"isRotated",lua_cocos2dx_SpriteFrame_isRotated); tolua_function(tolua_S,"isRotated",lua_cocos2dx_SpriteFrame_isRotated);
tolua_function(tolua_S,"initWithTextureFilename",lua_cocos2dx_SpriteFrame_initWithTextureFilename);
tolua_function(tolua_S,"setRect",lua_cocos2dx_SpriteFrame_setRect); tolua_function(tolua_S,"setRect",lua_cocos2dx_SpriteFrame_setRect);
tolua_function(tolua_S,"getOffsetInPixels",lua_cocos2dx_SpriteFrame_getOffsetInPixels); tolua_function(tolua_S,"getOffsetInPixels",lua_cocos2dx_SpriteFrame_getOffsetInPixels);
tolua_function(tolua_S,"getOriginalSize",lua_cocos2dx_SpriteFrame_getOriginalSize); tolua_function(tolua_S,"getOriginalSize",lua_cocos2dx_SpriteFrame_getOriginalSize);

View File

@ -1612,8 +1612,6 @@ int register_all_cocos2dx(lua_State* tolua_S);

View File

@ -383,165 +383,183 @@ cc.LabelEffect =
GLOW = 3, GLOW = 3,
} }
cc.KeyCodeKey =
{
"KEY_NONE",
"KEY_PAUSE",
"KEY_SCROLL_LOCK",
"KEY_PRINT",
"KEY_SYSREQ",
"KEY_BREAK",
"KEY_ESCAPE",
"KEY_BACKSPACE",
"KEY_TAB",
"KEY_BACK_TAB",
"KEY_RETURN",
"KEY_CAPS_LOCK",
"KEY_SHIFT",
"KEY_CTRL",
"KEY_ALT",
"KEY_MENU",
"KEY_HYPER",
"KEY_INSERT",
"KEY_HOME",
"KEY_PG_UP",
"KEY_DELETE",
"KEY_END",
"KEY_PG_DOWN",
"KEY_LEFT_ARROW",
"KEY_RIGHT_ARROW",
"KEY_UP_ARROW",
"KEY_DOWN_ARROW",
"KEY_NUM_LOCK",
"KEY_KP_PLUS",
"KEY_KP_MINUS",
"KEY_KP_MULTIPLY",
"KEY_KP_DIVIDE",
"KEY_KP_ENTER",
"KEY_KP_HOME",
"KEY_KP_UP",
"KEY_KP_PG_UP",
"KEY_KP_LEFT",
"KEY_KP_FIVE",
"KEY_KP_RIGHT",
"KEY_KP_END",
"KEY_KP_DOWN",
"KEY_KP_PG_DOWN",
"KEY_KP_INSERT",
"KEY_KP_DELETE",
"KEY_F1",
"KEY_F2",
"KEY_F3",
"KEY_F4",
"KEY_F5",
"KEY_F6",
"KEY_F7",
"KEY_F8",
"KEY_F9",
"KEY_F10",
"KEY_F11",
"KEY_F12",
"KEY_SPACE",
"KEY_EXCLAM",
"KEY_QUOTE",
"KEY_NUMBER",
"KEY_DOLLAR",
"KEY_PERCENT",
"KEY_CIRCUMFLEX",
"KEY_AMPERSAND",
"KEY_APOSTROPHE",
"KEY_LEFT_PARENTHESIS",
"KEY_RIGHT_PARENTHESIS",
"KEY_ASTERISK",
"KEY_PLUS",
"KEY_COMMA",
"KEY_MINUS",
"KEY_PERIOD",
"KEY_SLASH",
"KEY_0",
"KEY_1",
"KEY_2",
"KEY_3",
"KEY_4",
"KEY_5",
"KEY_6",
"KEY_7",
"KEY_8",
"KEY_9",
"KEY_COLON",
"KEY_SEMICOLON",
"KEY_LESS_THAN",
"KEY_EQUAL",
"KEY_GREATER_THAN",
"KEY_QUESTION",
"KEY_AT",
"KEY_CAPITAL_A",
"KEY_CAPITAL_B",
"KEY_CAPITAL_C",
"KEY_CAPITAL_D",
"KEY_CAPITAL_E",
"KEY_CAPITAL_F",
"KEY_CAPITAL_G",
"KEY_CAPITAL_H",
"KEY_CAPITAL_I",
"KEY_CAPITAL_J",
"KEY_CAPITAL_K",
"KEY_CAPITAL_L",
"KEY_CAPITAL_M",
"KEY_CAPITAL_N",
"KEY_CAPITAL_O",
"KEY_CAPITAL_P",
"KEY_CAPITAL_Q",
"KEY_CAPITAL_R",
"KEY_CAPITAL_S",
"KEY_CAPITAL_T",
"KEY_CAPITAL_U",
"KEY_CAPITAL_V",
"KEY_CAPITAL_W",
"KEY_CAPITAL_X",
"KEY_CAPITAL_Y",
"KEY_CAPITAL_Z",
"KEY_LEFT_BRACKET",
"KEY_BACK_SLASH",
"KEY_RIGHT_BRACKET",
"KEY_UNDERSCORE",
"KEY_GRAVE",
"KEY_A",
"KEY_B",
"KEY_C",
"KEY_D",
"KEY_E",
"KEY_F",
"KEY_G",
"KEY_H",
"KEY_I",
"KEY_J",
"KEY_K",
"KEY_L",
"KEY_M",
"KEY_N",
"KEY_O",
"KEY_P",
"KEY_Q",
"KEY_R",
"KEY_S",
"KEY_T",
"KEY_U",
"KEY_V",
"KEY_W",
"KEY_X",
"KEY_Y",
"KEY_Z",
"KEY_LEFT_BRACE",
"KEY_BAR",
"KEY_RIGHT_BRACE",
"KEY_TILDE",
"KEY_EURO",
"KEY_POUND",
"KEY_YEN",
"KEY_MIDDLE_DOT",
"KEY_SEARCH",
"KEY_DPAD_LEFT",
"KEY_DPAD_RIGHT",
"KEY_DPAD_UP",
"KEY_DPAD_DOWN",
"KEY_DPAD_CENTER",
"KEY_ENTER",
"KEY_PLAY",
}
cc.KeyCode = cc.KeyCode =
{ {
KEY_NONE = 0,
KEY_PAUSE = 0x0013, }
KEY_SCROLL_LOCK = 0x1014,
KEY_PRINT = 0x1061, for k,v in ipairs(cc.KeyCodeKey) do
KEY_SYSREQ = 0x106A, cc.KeyCode[v] = k - 1
KEY_BREAK = 0x106B, end
KEY_ESCAPE = 0x001B,
KEY_BACKSPACE = 0x0008, cc.KeyCode.KEY_BACK = cc.KeyCode.KEY_ESCAPE
KEY_TAB = 0x0009,
KEY_BACK_TAB = 0x0089,
KEY_RETURN = 0x000D,
KEY_CAPS_LOCK = 0x00E5,
KEY_SHIFT = 0x00E1,
KEY_CTRL = 0x00E3,
KEY_ALT = 0x00E9,
KEY_MENU = 0x1067,
KEY_HYPER = 0x10ED,
KEY_INSERT = 0x1063,
KEY_HOME = 0x1050,
KEY_PG_UP = 0x1055,
KEY_DELETE = 0x10FF,
KEY_END = 0x1057,
KEY_PG_DOWN = 0x1056,
KEY_LEFT_ARROW = 0x1051,
KEY_RIGHT_ARROW = 0x1053,
KEY_UP_ARROW = 0x1052,
KEY_DOWN_ARROW = 0x1054,
KEY_NUM_LOCK = 0x107F,
KEY_KP_PLUS = 0x10AB,
KEY_KP_MINUS = 0x10AD,
KEY_KP_MULTIPLY = 0x10AA,
KEY_KP_DIVIDE = 0x10AF,
KEY_KP_ENTER = 0x108D,
KEY_KP_HOME = 0x10B7,
KEY_KP_UP = 0x10B8,
KEY_KP_PG_UP = 0x10B9,
KEY_KP_LEFT = 0x10B4,
KEY_KP_FIVE = 0x10B5,
KEY_KP_RIGHT = 0x10B6,
KEY_KP_END = 0x10B1,
KEY_KP_DOWN = 0x10B2,
KEY_KP_PG_DOWN = 0x10B3,
KEY_KP_INSERT = 0x10B0,
KEY_KP_DELETE = 0x10AE,
KEY_F1 = 0x00BE,
KEY_F2 = 0x00BF,
KEY_F3 = 0x00C0,
KEY_F4 = 0x00C1,
KEY_F5 = 0x00C2,
KEY_F6 = 0x00C3,
KEY_F7 = 0x00C4,
KEY_F8 = 0x00C5,
KEY_F9 = 0x00C6,
KEY_F10 = 0x00C7,
KEY_F11 = 0x00C8,
KEY_F12 = 0x00C9,
KEY_SPACE = ' ',
KEY_EXCLAM = '!',
KEY_QUOTE = '"',
KEY_NUMBER = '#',
KEY_DOLLAR = '$',
KEY_PERCENT = '%',
KEY_CIRCUMFLEX = '^',
KEY_AMPERSAND = '&',
KEY_APOSTROPHE = '\'',
KEY_LEFT_PARENTHESIS = '(',
KEY_RIGHT_PARENTHESIS = ')',
KEY_ASTERISK = '*',
KEY_PLUS = '+',
KEY_COMMA = ',',
KEY_MINUS = '-',
KEY_PERIOD = '.',
KEY_SLASH = '/',
KEY_0 = '0',
KEY_1 = '1',
KEY_2 = '2',
KEY_3 = '3',
KEY_4 = '4',
KEY_5 = '5',
KEY_6 = '6',
KEY_7 = '7',
KEY_8 = '8',
KEY_9 = '9',
KEY_COLON = ':',
KEY_SEMICOLON = ';',
KEY_LESS_THAN = '<',
KEY_EQUAL = '=',
KEY_GREATER_THAN = '>',
KEY_QUESTION = '?',
KEY_AT = '@',
KEY_CAPITAL_A = 'A',
KEY_CAPITAL_B = 'B',
KEY_CAPITAL_C = 'C',
KEY_CAPITAL_D = 'D',
KEY_CAPITAL_E = 'E',
KEY_CAPITAL_F = 'F',
KEY_CAPITAL_G = 'G',
KEY_CAPITAL_H = 'H',
KEY_CAPITAL_I = 'I',
KEY_CAPITAL_J = 'J',
KEY_CAPITAL_K = 'K',
KEY_CAPITAL_L = 'L',
KEY_CAPITAL_M = 'M',
KEY_CAPITAL_N = 'N',
KEY_CAPITAL_O = 'O',
KEY_CAPITAL_P = 'P',
KEY_CAPITAL_Q = 'Q',
KEY_CAPITAL_R = 'R',
KEY_CAPITAL_S = 'S',
KEY_CAPITAL_T = 'T',
KEY_CAPITAL_U = 'U',
KEY_CAPITAL_V = 'V',
KEY_CAPITAL_W = 'W',
KEY_CAPITAL_X = 'X',
KEY_CAPITAL_Y = 'Y',
KEY_CAPITAL_Z = 'Z',
KEY_LEFT_BRACKET = '[',
KEY_BACK_SLASH = '\\',
KEY_RIGHT_BRACKET = ']',
KEY_UNDERSCORE = '_',
KEY_GRAVE = '`',
KEY_A = 'a',
KEY_B = 'b',
KEY_C = 'c',
KEY_D = 'd',
KEY_E = 'e',
KEY_F = 'f',
KEY_G = 'g',
KEY_H = 'h',
KEY_I = 'i',
KEY_J = 'j',
KEY_K = 'k',
KEY_L = 'l',
KEY_M = 'm',
KEY_N = 'n',
KEY_O = 'o',
KEY_P = 'p',
KEY_Q = 'q',
KEY_R = 'r',
KEY_S = 's',
KEY_T = 't',
KEY_U = 'u',
KEY_V = 'v',
KEY_W = 'w',
KEY_X = 'x',
KEY_Y = 'y',
KEY_Z = 'z',
KEY_LEFT_BRACE = '{',
KEY_BAR = '|',
KEY_RIGHT_BRACE = '}',
KEY_TILDE = '~',
KEY_EURO = 0x20AC,
KEY_POUND = 0x00A3,
KEY_YEN = 0x00A5,
KEY_MIDDLE_DOT = 0x0095,
KEY_SEARCH = 0xFFAA,
};

View File

@ -1986,10 +1986,10 @@ void TextureMemoryAlloc::updateImage(cocos2d::Ref *sender)
file = "Images/fire_rgba8888.pvr"; file = "Images/fire_rgba8888.pvr";
break; break;
case 2: case 2:
file = "Images/grossini_prv_rgba8888.pvr"; file = "Images/grossini_pvr_rgba8888.pvr";
break; break;
case 3: case 3:
file = "Images/grossini_prv_rgba4444.pvr"; file = "Images/grossini_pvr_rgba4444.pvr";
break; break;
case 4: case 4:
file = "Images/test_image_a8.pvr"; file = "Images/test_image_a8.pvr";

View File

@ -16,7 +16,7 @@ local function KeypadMainLayer()
local function onKeyReleased(keyCode, event) local function onKeyReleased(keyCode, event)
local label = event:getCurrentTarget() local label = event:getCurrentTarget()
if keyCode == cc.KeyCode.KEY_BACKSPACE then if keyCode == cc.KeyCode.KEY_BACK then
label:setString("BACK clicked!") label:setString("BACK clicked!")
elseif keyCode == cc.KeyCode.KEY_MENU then elseif keyCode == cc.KeyCode.KEY_MENU then
label:setString("MENU clicked!") label:setString("MENU clicked!")

View File

@ -665,13 +665,13 @@ function LabelKeyboardEventTest:onEnter()
self:addChild(statusLabel) self:addChild(statusLabel)
local function onKeyPressed(keyCode, event) local function onKeyPressed(keyCode, event)
local buf = string.format("Key %s was pressed!",string.char(keyCode)) local buf = string.format("Key %d was pressed!",keyCode)
local label = event:getCurrentTarget() local label = event:getCurrentTarget()
label:setString(buf) label:setString(buf)
end end
local function onKeyReleased(keyCode, event) local function onKeyReleased(keyCode, event)
local buf = string.format("Key %s was released!",string.char(keyCode)) local buf = string.format("Key %d was released!",keyCode)
local label = event:getCurrentTarget() local label = event:getCurrentTarget()
label:setString(buf) label:setString(buf)
end end

View File

@ -1263,19 +1263,18 @@ local function TextureMemoryAlloc()
end end
cc.Director:getInstance():getTextureCache():removeUnusedTextures() cc.Director:getInstance():getTextureCache():removeUnusedTextures()
local targetPlatform = cc.Application:getInstance():getTargetPlatform()
local file = "" local file = ""
local targetPlatform = cc.Application:getInstance():getTargetPlatform() if targetPlatform == cc.PLATFORM_OS_ANDROID then
if cc.PLATFORM_OS_ANDROID == targetPlatform then
if tag == 0 then if tag == 0 then
file = "Images/background.png" file = "Images/background.png"
elseif tag == 1 then elseif tag == 1 then
file = "Images/fire_rgba8888.pvr" file = "Images/fire_rgba8888.pvr"
elseif tag == 2 then elseif tag == 2 then
file = "Images/grossini_prv_rgba8888.pvr" file = "Images/grossini_pvr_rgba8888.pvr"
elseif tag == 3 then elseif tag == 3 then
file = "Images/grossini_prv_rgba4444.pvr" file = "Images/grossini_pvr_rgba4444.pvr"
elseif tag == 4 then elseif tag == 4 then
file = "Images/test_image_a8.pvr" file = "Images/test_image_a8.pvr"
end end

View File

@ -79,7 +79,7 @@ def main():
print 'pull request #' + str(pr_num) + ' is '+action+', no build triggered' print 'pull request #' + str(pr_num) + ' is '+action+', no build triggered'
return(0) return(0)
data = {"state":"pending", "target_url":target_url} data = {"state":"pending", "target_url":target_url, "context":"Jenkins CI", "description":"Wait available build machine..."}
access_token = os.environ['GITHUB_ACCESS_TOKEN'] access_token = os.environ['GITHUB_ACCESS_TOKEN']
Headers = {"Authorization":"token " + access_token} Headers = {"Authorization":"token " + access_token}

View File

@ -90,7 +90,7 @@ def main():
print 'skip build for pull request #' + str(pr_num) print 'skip build for pull request #' + str(pr_num)
return(0) return(0)
data = {"state":"pending", "target_url":target_url} data = {"state":"pending", "target_url":target_url, "context":"Jenkins CI", "description":"Waiting available build machine..."}
access_token = os.environ['GITHUB_ACCESS_TOKEN'] access_token = os.environ['GITHUB_ACCESS_TOKEN']
Headers = {"Authorization":"token " + access_token} Headers = {"Authorization":"token " + access_token}

View File

@ -18,7 +18,7 @@ statuses_url = payload['statuses_url']
J = Jenkins(os.environ['JENKINS_URL']) J = Jenkins(os.environ['JENKINS_URL'])
target_url = os.environ['BUILD_URL'] target_url = os.environ['BUILD_URL']
build_number = int(os.environ['BUILD_NUMBER']) build_number = int(os.environ['BUILD_NUMBER'])
data = {"state":"pending", "target_url":target_url} data = {"state":"pending", "target_url":target_url, "context":"Jenkins CI", "description":"Build finished!"}
access_token = os.environ['GITHUB_ACCESS_TOKEN'] access_token = os.environ['GITHUB_ACCESS_TOKEN']
Headers = {"Authorization":"token " + access_token} Headers = {"Authorization":"token " + access_token}
@ -26,9 +26,10 @@ result = J[os.environ['JOB_NAME']].get_build(build_number).get_status()
if(result == STATUS_SUCCESS): if(result == STATUS_SUCCESS):
data['state'] = "success" data['state'] = "success"
data['description'] = "Build successfully!"
else: else:
data['state'] = "failure" data['state'] = "failure"
data['description'] = "Build failed!"
http_proxy = '' http_proxy = ''
if(os.environ.has_key('HTTP_PROXY')): if(os.environ.has_key('HTTP_PROXY')):
http_proxy = os.environ['HTTP_PROXY'] http_proxy = os.environ['HTTP_PROXY']

View File

@ -104,7 +104,7 @@ def main():
set_description(pr_desc, target_url) set_description(pr_desc, target_url)
data = {"state":"pending", "target_url":target_url} data = {"state":"pending", "target_url":target_url, "context":"Jenkins CI", "description":"Build started..."}
access_token = os.environ['GITHUB_ACCESS_TOKEN'] access_token = os.environ['GITHUB_ACCESS_TOKEN']
Headers = {"Authorization":"token " + access_token} Headers = {"Authorization":"token " + access_token}