mirror of https://github.com/axmolengine/axmol.git
Merge remote-tracking branch 'upstream/v3' into v3
This commit is contained in:
commit
99b37c3048
10
CHANGELOG
10
CHANGELOG
|
@ -1,10 +1,18 @@
|
|||
cocos2d-x-3.1 ???
|
||||
cocos2d-x-3.2 ???
|
||||
[NEW] TextureCache: added unbindImageAsync() and unbindAllImageAsync()
|
||||
|
||||
[FIX] Image: Set jpeg save quality to 90
|
||||
|
||||
cocos2d-x-3.1 May.24 2014
|
||||
[FIX] EventKeyboard::KeyCode: key code for back button changed from KEY_BACKSPACE to KEY_ESCAPE
|
||||
[FIX] Label: may crash when using outline effect
|
||||
[FIX] Label: using outline and invoking 'Director::setContentScaleFactor' cause label show nothing
|
||||
[FIX] ProgressTo: will start from 0 when it reaches 100
|
||||
[FIX] Physics integration: may crashes if remove bodies at physics contact callback
|
||||
[FIX] UIWidget: copyProperties() lost copy some properties
|
||||
[FIX] WP8: orientation is not correct when it is set to portrait
|
||||
[FIX] WP8: fix for precompiled shaders and precompiled headers
|
||||
[FIX] WP8: template supports orientation
|
||||
|
||||
cocos2d-x-3.1-rc0 May.18 2014
|
||||
[NEW] Cocos2dxActivity: Adds a virtual method to load native libraries.
|
||||
|
|
|
@ -4022,11 +4022,6 @@
|
|||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0510;
|
||||
TargetAttributes = {
|
||||
1ABCA2CC18CD93580087CE3A = {
|
||||
DevelopmentTeam = NQ596S94Q5;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "cocos2d_tests" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
|
@ -5427,14 +5422,12 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
CC_TARGET_OS_IPHONE,
|
||||
);
|
||||
INFOPLIST_FILE = "$(SRCROOT)/../tests/lua-tests/project/proj.ios_mac/ios/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
|
||||
PROVISIONING_PROFILE = "";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../cocos/scripting/lua-bindings/manual $(SRCROOT)/../cocos/scripting/lua-bindings/auto";
|
||||
|
@ -5445,14 +5438,12 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
CC_TARGET_OS_IPHONE,
|
||||
);
|
||||
INFOPLIST_FILE = "$(SRCROOT)/../tests/lua-tests/project/proj.ios_mac/ios/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
|
||||
PROVISIONING_PROFILE = "";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../cocos/scripting/lua-bindings/manual $(SRCROOT)/../cocos/scripting/lua-bindings/auto";
|
||||
|
|
|
@ -296,18 +296,18 @@ unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, long &outWid
|
|||
break;
|
||||
}
|
||||
|
||||
long outlineWidth = (bbox.xMax - bbox.xMin)>>6;
|
||||
long outlineHeight = (bbox.yMax - bbox.yMin)>>6;
|
||||
auto outlineWidth = (bbox.xMax - bbox.xMin)>>6;
|
||||
auto outlineHeight = (bbox.yMax - bbox.yMin)>>6;
|
||||
|
||||
long blendWidth = outlineWidth > outWidth ? outlineWidth : outWidth;
|
||||
long blendHeight = outlineHeight > outHeight ? outlineHeight : outHeight;
|
||||
auto blendWidth = outlineWidth > outWidth ? outlineWidth : outWidth;
|
||||
auto blendHeight = outlineHeight > outHeight ? outlineHeight : outHeight;
|
||||
|
||||
long index,index2;
|
||||
auto blendImage = new unsigned char[blendWidth * blendHeight * 2];
|
||||
memset(blendImage, 0, blendWidth * blendHeight * 2);
|
||||
|
||||
int px = (blendWidth - outlineWidth) / 2;
|
||||
int py = (blendHeight - outlineHeight) / 2;
|
||||
auto px = (blendWidth - outlineWidth) / 2;
|
||||
auto py = (blendHeight - outlineHeight) / 2;
|
||||
for (int x = 0; x < outlineWidth; ++x)
|
||||
{
|
||||
for (int y = 0; y < outlineHeight; ++y)
|
||||
|
|
|
@ -31,7 +31,7 @@ NS_CC_BEGIN
|
|||
|
||||
const char* cocos2dVersion()
|
||||
{
|
||||
return "cocos2d-x 3.1rc0";
|
||||
return "cocos2d-x 3.1";
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -2120,6 +2120,7 @@ bool Image::saveImageToJPG(const std::string& filePath)
|
|||
cinfo.in_color_space = JCS_RGB; /* colorspace of input image */
|
||||
|
||||
jpeg_set_defaults(&cinfo);
|
||||
jpeg_set_quality(&cinfo, 90, TRUE);
|
||||
|
||||
jpeg_start_compress(&cinfo, TRUE);
|
||||
|
||||
|
|
|
@ -141,6 +141,31 @@ void TextureCache::addImageAsync(const std::string &path, const std::function<vo
|
|||
_sleepCondition.notify_one();
|
||||
}
|
||||
|
||||
void TextureCache::unbindImageAsync(const std::string& filename)
|
||||
{
|
||||
_imageInfoMutex.lock();
|
||||
if (_imageInfoQueue && !_imageInfoQueue->empty())
|
||||
{
|
||||
std::string fullpath = FileUtils::getInstance()->fullPathForFilename(filename);
|
||||
auto found = std::find_if(_imageInfoQueue->begin(), _imageInfoQueue->end(), [&fullpath](ImageInfo* ptr)->bool{ return ptr->asyncStruct->filename == fullpath; });
|
||||
if (found != _imageInfoQueue->end())
|
||||
{
|
||||
(*found)->asyncStruct->callback = nullptr;
|
||||
}
|
||||
}
|
||||
_imageInfoMutex.unlock();
|
||||
}
|
||||
|
||||
void TextureCache::unbindAllImageAsync()
|
||||
{
|
||||
_imageInfoMutex.lock();
|
||||
if (_imageInfoQueue && !_imageInfoQueue->empty())
|
||||
{
|
||||
std::for_each(_imageInfoQueue->begin(), _imageInfoQueue->end(), [](ImageInfo* ptr) { ptr->asyncStruct->callback = nullptr; });
|
||||
}
|
||||
_imageInfoMutex.unlock();
|
||||
}
|
||||
|
||||
void TextureCache::loadImage()
|
||||
{
|
||||
AsyncStruct *asyncStruct = nullptr;
|
||||
|
|
|
@ -119,6 +119,18 @@ public:
|
|||
*/
|
||||
virtual void addImageAsync(const std::string &filepath, const std::function<void(Texture2D*)>& callback);
|
||||
|
||||
/* Unbind a specified bound image asynchronous callback
|
||||
* In the case an object who was bound to an image asynchronous callback was destroyed before the callback is invoked,
|
||||
* the object always need to unbind this callback manually.
|
||||
* @since v3.1
|
||||
*/
|
||||
virtual void unbindImageAsync(const std::string &filename);
|
||||
|
||||
/* Unbind all bound image asynchronous load callbacks
|
||||
* @since v3.1
|
||||
*/
|
||||
virtual void unbindAllImageAsync();
|
||||
|
||||
/** Returns a Texture2D object given an Image.
|
||||
* If the image was not previously loaded, it will create a new Texture2D object and it will return it.
|
||||
* Otherwise it will return a reference of a previously loaded image.
|
||||
|
|
|
@ -43,4 +43,11 @@
|
|||
-- @param #cc.Node node
|
||||
-- @return ClippingNode#ClippingNode ret (retunr value: cc.ClippingNode)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ClippingNode] visit
|
||||
-- @param self
|
||||
-- @param #cc.Renderer renderer
|
||||
-- @param #cc.Mat4 mat4
|
||||
-- @param #bool bool
|
||||
|
||||
return nil
|
||||
|
|
|
@ -301,6 +301,13 @@
|
|||
-- @param self
|
||||
-- @param #cc.BlendFunc blendfunc
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Label] visit
|
||||
-- @param self
|
||||
-- @param #cc.Renderer renderer
|
||||
-- @param #cc.Mat4 mat4
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Label] getScaleX
|
||||
-- @param self
|
||||
|
|
|
@ -177,6 +177,13 @@
|
|||
-- @param self
|
||||
-- @return size_table#size_table ret (return value: size_table)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#LabelTTF] visit
|
||||
-- @param self
|
||||
-- @param #cc.Renderer renderer
|
||||
-- @param #cc.Mat4 mat4
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#LabelTTF] LabelTTF
|
||||
-- @param self
|
||||
|
|
|
@ -315,6 +315,17 @@
|
|||
-- @param #cc.Component component
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- overload function: visit()
|
||||
--
|
||||
-- overload function: visit(cc.Renderer, cc.Mat4, bool)
|
||||
--
|
||||
-- @function [parent=#Node] visit
|
||||
-- @param self
|
||||
-- @param #cc.Renderer renderer
|
||||
-- @param #cc.Mat4 mat4
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Node] isOpacityModifyRGB
|
||||
-- @param self
|
||||
|
|
|
@ -27,4 +27,11 @@
|
|||
-- @param self
|
||||
-- @return NodeGrid#NodeGrid ret (return value: cc.NodeGrid)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#NodeGrid] visit
|
||||
-- @param self
|
||||
-- @param #cc.Renderer renderer
|
||||
-- @param #cc.Mat4 mat4
|
||||
-- @param #bool bool
|
||||
|
||||
return nil
|
||||
|
|
|
@ -33,6 +33,13 @@
|
|||
-- @param #int int
|
||||
-- @param #int int
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ParallaxNode] visit
|
||||
-- @param self
|
||||
-- @param #cc.Renderer renderer
|
||||
-- @param #cc.Mat4 mat4
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ParallaxNode] removeChild
|
||||
-- @param self
|
||||
|
|
|
@ -73,6 +73,13 @@
|
|||
-- @param #cc.Mat4 mat4
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ParticleBatchNode] visit
|
||||
-- @param self
|
||||
-- @param #cc.Renderer renderer
|
||||
-- @param #cc.Mat4 mat4
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ParticleBatchNode] reorderChild
|
||||
-- @param self
|
||||
|
|
|
@ -62,6 +62,13 @@
|
|||
-- @param self
|
||||
-- @return ProtectedNode#ProtectedNode ret (return value: cc.ProtectedNode)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ProtectedNode] visit
|
||||
-- @param self
|
||||
-- @param #cc.Renderer renderer
|
||||
-- @param #cc.Mat4 mat4
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ProtectedNode] updateDisplayedOpacity
|
||||
-- @param self
|
||||
|
|
|
@ -172,6 +172,13 @@
|
|||
-- @param #cc.Mat4 mat4
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#RenderTexture] visit
|
||||
-- @param self
|
||||
-- @param #cc.Renderer renderer
|
||||
-- @param #cc.Mat4 mat4
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#RenderTexture] RenderTexture
|
||||
-- @param self
|
||||
|
|
|
@ -126,6 +126,13 @@
|
|||
-- @param self
|
||||
-- @return string#string ret (return value: string)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#SpriteBatchNode] visit
|
||||
-- @param self
|
||||
-- @param #cc.Renderer renderer
|
||||
-- @param #cc.Mat4 mat4
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#SpriteBatchNode] sortAllChildren
|
||||
-- @param self
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
-- @param #string str
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#TextureCache] unbindAllImageAsync
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#TextureCache] removeTextureForKey
|
||||
-- @param self
|
||||
|
@ -39,6 +43,11 @@
|
|||
-- @param #string str
|
||||
-- @return Texture2D#Texture2D ret (retunr value: cc.Texture2D)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#TextureCache] unbindImageAsync
|
||||
-- @param self
|
||||
-- @param #string str
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#TextureCache] getTextureForKey
|
||||
-- @param self
|
||||
|
|
|
@ -6330,6 +6330,63 @@ int lua_cocos2dx_Node_addComponent(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Node_visit(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Node* 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.Node",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
cobj = (cocos2d::Node*)tolua_tousertype(tolua_S,1,0);
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Node_visit'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
do{
|
||||
if (argc == 0) {
|
||||
cobj->visit();
|
||||
return 0;
|
||||
}
|
||||
}while(0);
|
||||
ok = true;
|
||||
do{
|
||||
if (argc == 3) {
|
||||
cocos2d::Renderer* arg0;
|
||||
ok &= luaval_to_object<cocos2d::Renderer>(tolua_S, 2, "cc.Renderer",&arg0);
|
||||
|
||||
if (!ok) { break; }
|
||||
cocos2d::Mat4 arg1;
|
||||
ok &= luaval_to_mat4(tolua_S, 3, &arg1);
|
||||
|
||||
if (!ok) { break; }
|
||||
bool arg2;
|
||||
ok &= luaval_to_boolean(tolua_S, 4,&arg2);
|
||||
|
||||
if (!ok) { break; }
|
||||
cobj->visit(arg0, arg1, arg2);
|
||||
return 0;
|
||||
}
|
||||
}while(0);
|
||||
ok = true;
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "visit",argc, 3);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_visit'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Node_isOpacityModifyRGB(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -9311,6 +9368,7 @@ int lua_register_cocos2dx_Node(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"getChildrenCount",lua_cocos2dx_Node_getChildrenCount);
|
||||
tolua_function(tolua_S,"convertToNodeSpaceAR",lua_cocos2dx_Node_convertToNodeSpaceAR);
|
||||
tolua_function(tolua_S,"addComponent",lua_cocos2dx_Node_addComponent);
|
||||
tolua_function(tolua_S,"visit",lua_cocos2dx_Node_visit);
|
||||
tolua_function(tolua_S,"isOpacityModifyRGB",lua_cocos2dx_Node_isOpacityModifyRGB);
|
||||
tolua_function(tolua_S,"getRotation",lua_cocos2dx_Node_getRotation);
|
||||
tolua_function(tolua_S,"getAnchorPointInPoints",lua_cocos2dx_Node_getAnchorPointInPoints);
|
||||
|
@ -56704,6 +56762,49 @@ int lua_cocos2dx_TextureCache_reloadTexture(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_TextureCache_unbindAllImageAsync(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::TextureCache* 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.TextureCache",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::TextureCache*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TextureCache_unbindAllImageAsync'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
return 0;
|
||||
cobj->unbindAllImageAsync();
|
||||
return 0;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "unbindAllImageAsync",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TextureCache_unbindAllImageAsync'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_TextureCache_removeTextureForKey(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -56940,6 +57041,52 @@ int lua_cocos2dx_TextureCache_addImage(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_TextureCache_unbindImageAsync(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::TextureCache* 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.TextureCache",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::TextureCache*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TextureCache_unbindImageAsync'", 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);
|
||||
if(!ok)
|
||||
return 0;
|
||||
cobj->unbindImageAsync(arg0);
|
||||
return 0;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "unbindImageAsync",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TextureCache_unbindImageAsync'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_TextureCache_getTextureForKey(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -57166,11 +57313,13 @@ int lua_register_cocos2dx_TextureCache(lua_State* tolua_S)
|
|||
|
||||
tolua_beginmodule(tolua_S,"TextureCache");
|
||||
tolua_function(tolua_S,"reloadTexture",lua_cocos2dx_TextureCache_reloadTexture);
|
||||
tolua_function(tolua_S,"unbindAllImageAsync",lua_cocos2dx_TextureCache_unbindAllImageAsync);
|
||||
tolua_function(tolua_S,"removeTextureForKey",lua_cocos2dx_TextureCache_removeTextureForKey);
|
||||
tolua_function(tolua_S,"removeAllTextures",lua_cocos2dx_TextureCache_removeAllTextures);
|
||||
tolua_function(tolua_S,"getDescription",lua_cocos2dx_TextureCache_getDescription);
|
||||
tolua_function(tolua_S,"getCachedTextureInfo",lua_cocos2dx_TextureCache_getCachedTextureInfo);
|
||||
tolua_function(tolua_S,"addImage",lua_cocos2dx_TextureCache_addImage);
|
||||
tolua_function(tolua_S,"unbindImageAsync",lua_cocos2dx_TextureCache_unbindImageAsync);
|
||||
tolua_function(tolua_S,"getTextureForKey",lua_cocos2dx_TextureCache_getTextureForKey);
|
||||
tolua_function(tolua_S,"removeUnusedTextures",lua_cocos2dx_TextureCache_removeUnusedTextures);
|
||||
tolua_function(tolua_S,"removeTexture",lua_cocos2dx_TextureCache_removeTexture);
|
||||
|
|
|
@ -1607,6 +1607,9 @@ int register_all_cocos2dx(lua_State* tolua_S);
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5348,6 +5348,59 @@ static int lua_cocos2dx_GLProgramState_setVertexAttribPointer(lua_State* tolua_S
|
|||
cobj->setVertexAttribPointer(arg0, arg1, arg2, arg3, arg4, (void*)arg5);
|
||||
return 0;
|
||||
}
|
||||
else if (argc == 7)
|
||||
{
|
||||
std::string arg0;
|
||||
int arg1;
|
||||
unsigned int arg2;
|
||||
bool arg3;
|
||||
int arg4;
|
||||
GLfloat* arg5;
|
||||
int arg6;
|
||||
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0);
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1);
|
||||
|
||||
ok &= luaval_to_uint32(tolua_S, 4,&arg2);
|
||||
|
||||
ok &= luaval_to_boolean(tolua_S, 5, &arg3);
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 6,(int *)&arg4);
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 8, (int *)&arg6);
|
||||
|
||||
size_t len = lua_objlen(tolua_S, 7);
|
||||
|
||||
if (len != arg6)
|
||||
{
|
||||
CCLOG("table size is %zu,but input size is %d \n", len, arg6);
|
||||
return 0;
|
||||
}
|
||||
|
||||
arg5 = new GLfloat[len];
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
lua_pushnumber(tolua_S,i + 1);
|
||||
lua_gettable(tolua_S,7);
|
||||
if (tolua_isnumber(tolua_S, -1, 0, &tolua_err))
|
||||
{
|
||||
arg5[i] = tolua_tonumber(tolua_S, -1, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
arg5[i] = 0;
|
||||
}
|
||||
lua_pop(tolua_S, 1);
|
||||
}
|
||||
|
||||
cobj->setVertexAttribPointer(arg0, arg1, arg2, arg3, arg4, (void*)arg5);
|
||||
|
||||
CC_SAFE_DELETE(arg5);
|
||||
|
||||
return 0;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setVertexAttribPointer",argc, 6);
|
||||
return 0;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1195,4 +1195,13 @@ end
|
|||
rawset(ccui.Text,"getStringValue", TextBMFontDeprecated.getStringValue)
|
||||
--functions of ccui.TextBMFont will be deprecated begin
|
||||
|
||||
--functions of cc.ShaderCache will be deprecated begin
|
||||
local ShaderCacheDeprecated = { }
|
||||
function ShaderCacheDeprecated.getProgram(self,strShader)
|
||||
deprecatedTip("cc.ShaderCache:getProgram","cc.ShaderCache:getGLProgram")
|
||||
return self:getGLProgram(strShader)
|
||||
end
|
||||
rawset(cc.ShaderCache,"getProgram", ShaderCacheDeprecated.getProgram)
|
||||
--functions of ccui.TextBMFont will be deprecated begin
|
||||
|
||||
|
||||
|
|
|
@ -2187,4 +2187,22 @@ end
|
|||
_G["cc.EGLView"] = DeprecatedClass.EGLView()
|
||||
--EGLView class will be Deprecated,end
|
||||
|
||||
--EGLView class will be Deprecated,begin
|
||||
function DeprecatedClass.EGLView()
|
||||
deprecatedTip("cc.EGLView","cc.GLView")
|
||||
print(cc.GLView)
|
||||
return cc.GLView
|
||||
end
|
||||
_G["cc.EGLView"] = DeprecatedClass.EGLView()
|
||||
--EGLView class will be Deprecated,end
|
||||
|
||||
--ShaderCache class will be Deprecated,begin
|
||||
function DeprecatedClass.ShaderCache()
|
||||
deprecatedTip("cc.ShaderCache","cc.GLProgramCache")
|
||||
return cc.GLProgramCache
|
||||
end
|
||||
cc.ShaderCache = DeprecatedClass.ShaderCache()
|
||||
--ShaderCache class will be Deprecated,end
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -615,6 +615,9 @@ void CheckBox::copySpecialProperties(Widget *widget)
|
|||
loadTextureBackGroundDisabled(checkBox->_backGroundDisabledFileName, checkBox->_backGroundDisabledTexType);
|
||||
loadTextureFrontCrossDisabled(checkBox->_frontCrossDisabledFileName, checkBox->_frontCrossDisabledTexType);
|
||||
setSelectedState(checkBox->_isSelected);
|
||||
_checkBoxEventListener = checkBox->_checkBoxEventListener;
|
||||
_checkBoxEventSelector = checkBox->_checkBoxEventSelector;
|
||||
_checkBoxEventCallback = checkBox->_checkBoxEventCallback;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1515,6 +1515,8 @@ void Layout::copySpecialProperties(Widget *widget)
|
|||
setLayoutType(layout->_layoutType);
|
||||
setClippingEnabled(layout->_clippingEnabled);
|
||||
setClippingType(layout->_clippingType);
|
||||
_loopFocus = layout->_loopFocus;
|
||||
_passFocusToChild = layout->_passFocusToChild;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -502,6 +502,9 @@ void ListView::copySpecialProperties(Widget *widget)
|
|||
setItemModel(listViewEx->_model);
|
||||
setItemsMargin(listViewEx->_itemsMargin);
|
||||
setGravity(listViewEx->_gravity);
|
||||
_listViewEventListener = listViewEx->_listViewEventListener;
|
||||
_listViewEventSelector = listViewEx->_listViewEventSelector;
|
||||
_eventCallback = listViewEx->_eventCallback;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -626,6 +626,9 @@ void PageView::copySpecialProperties(Widget *widget)
|
|||
if (pageView)
|
||||
{
|
||||
Layout::copySpecialProperties(widget);
|
||||
_eventCallback = pageView->_eventCallback;
|
||||
_pageViewEventListener = pageView->_pageViewEventListener;
|
||||
_pageViewEventSelector = pageView->_pageViewEventSelector;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1738,6 +1738,9 @@ void ScrollView::copySpecialProperties(Widget *widget)
|
|||
setDirection(scrollView->_direction);
|
||||
setBounceEnabled(scrollView->_bounceEnabled);
|
||||
setInertiaScrollEnabled(scrollView->_inertiaScrollEnabled);
|
||||
_scrollViewEventListener = scrollView->_scrollViewEventListener;
|
||||
_scrollViewEventSelector = scrollView->_scrollViewEventSelector;
|
||||
_eventCallback = scrollView->_eventCallback;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -627,6 +627,9 @@ void Slider::copySpecialProperties(Widget *widget)
|
|||
loadSlidBallTexturePressed(slider->_slidBallPressedTextureFile, slider->_ballPTexType);
|
||||
loadSlidBallTextureDisabled(slider->_slidBallDisabledTextureFile, slider->_ballDTexType);
|
||||
setPercent(slider->getPercent());
|
||||
_sliderEventListener = slider->_sliderEventListener;
|
||||
_sliderEventSelector = slider->_sliderEventSelector;
|
||||
_eventCallback = slider->_eventCallback;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -842,6 +842,9 @@ void TextField::copySpecialProperties(Widget *widget)
|
|||
setDetachWithIME(textField->getDetachWithIME());
|
||||
setInsertText(textField->getInsertText());
|
||||
setDeleteBackward(textField->getDeleteBackward());
|
||||
_eventCallback = textField->_eventCallback;
|
||||
_textFieldEventListener = textField->_textFieldEventListener;
|
||||
_textFieldEventSelector = textField->_textFieldEventSelector;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,6 +77,9 @@ namespace experimental{
|
|||
virtual void draw(Renderer *renderer, const Mat4& transform, bool transformUpdated) override;
|
||||
|
||||
protected:
|
||||
virtual cocos2d::ui::Widget* createCloneInstance() override;
|
||||
virtual void copySpecialProperties(Widget* model) override;
|
||||
|
||||
VideoPlayer();
|
||||
virtual ~VideoPlayer();
|
||||
|
||||
|
|
|
@ -355,6 +355,28 @@ void VideoPlayer::onPlayEvent(VideoPlayer::EventType event)
|
|||
}
|
||||
}
|
||||
|
||||
cocos2d::ui::Widget* VideoPlayer::createCloneInstance()
|
||||
{
|
||||
return VideoPlayer::create();
|
||||
}
|
||||
|
||||
void VideoPlayer::copySpecialProperties(Widget *widget)
|
||||
{
|
||||
VideoPlayer* videoPlayer = dynamic_cast<VideoPlayer*>(widget);
|
||||
if (videoPlayer)
|
||||
{
|
||||
_isPlaying = videoPlayer->_isPlaying;
|
||||
_fullScreenEnabled = videoPlayer->_fullScreenEnabled;
|
||||
_fullScreenDirty = videoPlayer->_fullScreenDirty;
|
||||
_videoURL = videoPlayer->_videoURL;
|
||||
_keepAspectRatioEnabled = videoPlayer->_keepAspectRatioEnabled;
|
||||
_videoSource = videoPlayer->_videoSource;
|
||||
_videoPlayerIndex = videoPlayer->_videoPlayerIndex;
|
||||
_eventCallback = videoPlayer->_eventCallback;
|
||||
_videoView = videoPlayer->_videoView;
|
||||
}
|
||||
}
|
||||
|
||||
void executeVideoCallback(int index,int event)
|
||||
{
|
||||
auto it = s_allVideoPlayers.find(index);
|
||||
|
|
|
@ -461,4 +461,26 @@ void VideoPlayer::onPlayEvent(VideoPlayer::EventType event)
|
|||
}
|
||||
}
|
||||
|
||||
cocos2d::ui::Widget* VideoPlayer::createCloneInstance()
|
||||
{
|
||||
return VideoPlayer::create();
|
||||
}
|
||||
|
||||
void VideoPlayer::copySpecialProperties(Widget *widget)
|
||||
{
|
||||
VideoPlayer* videoPlayer = dynamic_cast<VideoPlayer*>(widget);
|
||||
if (videoPlayer)
|
||||
{
|
||||
_isPlaying = videoPlayer->_isPlaying;
|
||||
_fullScreenEnabled = videoPlayer->_fullScreenEnabled;
|
||||
_fullScreenDirty = videoPlayer->_fullScreenDirty;
|
||||
_videoURL = videoPlayer->_videoURL;
|
||||
_keepAspectRatioEnabled = videoPlayer->_keepAspectRatioEnabled;
|
||||
_videoSource = videoPlayer->_videoSource;
|
||||
_videoPlayerIndex = videoPlayer->_videoPlayerIndex;
|
||||
_eventCallback = videoPlayer->_eventCallback;
|
||||
_videoView = videoPlayer->_videoView;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -925,7 +925,6 @@ void Widget::copyProperties(Widget *widget)
|
|||
_ignoreSize = widget->_ignoreSize;
|
||||
_size = widget->_size;
|
||||
_customSize = widget->_customSize;
|
||||
copySpecialProperties(widget);
|
||||
_sizeType = widget->getSizeType();
|
||||
_sizePercent = widget->_sizePercent;
|
||||
_positionType = widget->_positionType;
|
||||
|
@ -941,6 +940,14 @@ void Widget::copyProperties(Widget *widget)
|
|||
setFlippedY(widget->isFlippedY());
|
||||
setColor(widget->getColor());
|
||||
setOpacity(widget->getOpacity());
|
||||
_touchEventCallback = widget->_touchEventCallback;
|
||||
_touchEventListener = widget->_touchEventListener;
|
||||
_touchEventSelector = widget->_touchEventSelector;
|
||||
_focused = widget->_focused;
|
||||
_focusEnabled = widget->_focusEnabled;
|
||||
|
||||
copySpecialProperties(widget);
|
||||
|
||||
//FIXME:copy focus properties, also make sure all the subclass the copy behavior is correct
|
||||
Map<int, LayoutParameter*>& layoutParameterDic = widget->_layoutParameterDictionary;
|
||||
for (auto iter = layoutParameterDic.begin(); iter != layoutParameterDic.end(); ++iter)
|
||||
|
|
|
@ -24,6 +24,7 @@ using Microsoft.Phone.Shell;
|
|||
using Windows.UI.Input;
|
||||
using System.Windows.Threading;
|
||||
using Microsoft.Phone.Info;
|
||||
using Windows.Graphics.Display;
|
||||
|
||||
namespace PhoneDirect3DXamlAppInterop
|
||||
{
|
||||
|
@ -53,7 +54,30 @@ namespace PhoneDirect3DXamlAppInterop
|
|||
{
|
||||
if (m_d3dInterop == null)
|
||||
{
|
||||
m_d3dInterop = new Direct3DInterop();
|
||||
PageOrientation pageOrientation = (PageOrientation)GetValue(OrientationProperty);
|
||||
DisplayOrientations displayOrientation;
|
||||
|
||||
switch(pageOrientation)
|
||||
{
|
||||
case PageOrientation.Portrait:
|
||||
case PageOrientation.PortraitUp:
|
||||
displayOrientation = DisplayOrientations.Portrait;
|
||||
break;
|
||||
case PageOrientation.PortraitDown:
|
||||
displayOrientation = DisplayOrientations.PortraitFlipped;
|
||||
break;
|
||||
case PageOrientation.Landscape:
|
||||
case PageOrientation.LandscapeLeft:
|
||||
displayOrientation = DisplayOrientations.Landscape;
|
||||
break;
|
||||
case PageOrientation.LandscapeRight:
|
||||
displayOrientation = DisplayOrientations.LandscapeFlipped;
|
||||
break;
|
||||
default:
|
||||
displayOrientation = DisplayOrientations.Landscape;
|
||||
break;
|
||||
}
|
||||
m_d3dInterop = new Direct3DInterop(displayOrientation);
|
||||
|
||||
// Set WindowBounds to size of DrawingSurface
|
||||
m_d3dInterop.WindowBounds = new Windows.Foundation.Size(
|
||||
|
|
|
@ -40,6 +40,21 @@
|
|||
"*.lua"
|
||||
]
|
||||
},
|
||||
{
|
||||
"from": "templates/lua-template-runtime/runtime/rtres",
|
||||
"to": "runtime/mac/PrebuiltRuntimeLua.app/Contents/Resources/rtres",
|
||||
"exclude": []
|
||||
},
|
||||
{
|
||||
"from": "templates/lua-template-runtime/runtime/rtres",
|
||||
"to": "runtime/ios/PrebuiltRuntimeLua.app/rtres",
|
||||
"exclude": []
|
||||
},
|
||||
{
|
||||
"from": "templates/lua-template-runtime/runtime/rtres",
|
||||
"to": "runtime/win32/rtres",
|
||||
"exclude": []
|
||||
},
|
||||
{
|
||||
"from": "cocos/scripting/lua-bindings/script",
|
||||
"to": "runtime/mac/PrebuiltRuntimeLua.app/Contents/Resources",
|
||||
|
|
|
@ -51,6 +51,13 @@ void ConfigParser::readConfig()
|
|||
{
|
||||
_initViewSize.width = objectInitView["width"].GetUint();
|
||||
_initViewSize.height = objectInitView["height"].GetUint();
|
||||
if (_initViewSize.height>_initViewSize.width)
|
||||
{
|
||||
float tmpvalue =_initViewSize.height;
|
||||
_initViewSize.height = _initViewSize.width;
|
||||
_initViewSize.width = tmpvalue;
|
||||
}
|
||||
|
||||
}
|
||||
if (objectInitView.HasMember("name") && objectInitView["name"].IsString())
|
||||
{
|
||||
|
|
|
@ -99,50 +99,114 @@ bool reloadScript(const string& modulefile)
|
|||
class ConnectWaitLayer: public Layer
|
||||
{
|
||||
private:
|
||||
LabelTTF* pLabelUploadFile;
|
||||
Label* _labelUploadFile;
|
||||
public:
|
||||
|
||||
ConnectWaitLayer()
|
||||
{
|
||||
string strip = getIPAddress();
|
||||
char szIPAddress[512]={0};
|
||||
sprintf(szIPAddress, "LocalIP: %s",strip.c_str());
|
||||
auto label = LabelTTF::create(szIPAddress, "Arial", 24);
|
||||
addChild(label, 9999);
|
||||
label->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 30) );
|
||||
|
||||
string strShowMsg ="";
|
||||
if (CC_PLATFORM_WIN32 == CC_TARGET_PLATFORM || CC_PLATFORM_MAC == CC_TARGET_PLATFORM)
|
||||
int designWidth = 1280;
|
||||
int designHeight = 800;
|
||||
Director::getInstance()->getOpenGLView()->setDesignResolutionSize(designWidth,designHeight,ResolutionPolicy::EXACT_FIT);
|
||||
string playEnbleFile = "rtres/Play1.png";
|
||||
string shineFile = "rtres/shine.png";
|
||||
string backgroundFile = "rtres/landscape.png";
|
||||
if (!ConfigParser::getInstance()->isLanscape())
|
||||
{
|
||||
strShowMsg = "waiting for debugger to connect ...";
|
||||
backgroundFile = "rtres/portrait.png";
|
||||
Director::getInstance()->getOpenGLView()->setDesignResolutionSize(designHeight,designWidth,ResolutionPolicy::EXACT_FIT);
|
||||
}
|
||||
|
||||
auto background = Sprite::create(backgroundFile.c_str());
|
||||
if (background)
|
||||
{
|
||||
background->setAnchorPoint(Vec2(0,0));
|
||||
addChild(background,9999);
|
||||
}
|
||||
|
||||
auto playSprite = Sprite::create(playEnbleFile.c_str());
|
||||
if (playSprite)
|
||||
{
|
||||
playSprite->setPosition(Vec2(902,400));
|
||||
addChild(playSprite,9999);
|
||||
}else
|
||||
{
|
||||
strShowMsg = "waiting for file transfer ...";
|
||||
}
|
||||
auto labelwait = LabelTTF::create(strShowMsg.c_str(), "Arial", 22);
|
||||
addChild(labelwait, 10000);
|
||||
labelwait->setPosition( Point(VisibleRect::center().x, VisibleRect::center().y) );
|
||||
|
||||
pLabelUploadFile = LabelTTF::create("", "Arial", 22);
|
||||
addChild(pLabelUploadFile, 10000);
|
||||
pLabelUploadFile->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 60) );
|
||||
|
||||
auto labelPlay = LabelTTF::create("play", "Arial", 36);
|
||||
auto labelPlay = LabelTTF::create("play", "Arial", 108);
|
||||
auto menuItem = MenuItemLabel::create(labelPlay, CC_CALLBACK_1(ConnectWaitLayer::playerCallback, this));
|
||||
auto menu = Menu::create(menuItem, NULL);
|
||||
|
||||
menu->setPosition( Point::ZERO );
|
||||
menuItem->setPosition( Point( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
|
||||
menuItem->setPosition(Vec2(902,400));
|
||||
if (!ConfigParser::getInstance()->isLanscape()) menuItem->setPosition(Vec2(400,500));
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
||||
auto shineSprite = Sprite::create(shineFile.c_str());
|
||||
if (shineSprite)
|
||||
{
|
||||
shineSprite->setPosition(Vec2(902,400));
|
||||
shineSprite->runAction(RepeatForever::create(Sequence::createWithTwoActions(ScaleBy::create(1.0f, 1.08f),ScaleTo::create(1.0f, 1))));
|
||||
addChild(shineSprite,9999);
|
||||
}
|
||||
|
||||
string strip = getIPAddress();
|
||||
char szIPAddress[512]={0};
|
||||
sprintf(szIPAddress, "IP: %s",strip.c_str());
|
||||
auto IPlabel = Label::create(szIPAddress, "Arial", 72);
|
||||
IPlabel->setAnchorPoint(Vec2(0,0));
|
||||
int spaceSizex = 72;
|
||||
int spaceSizey = 200;
|
||||
IPlabel->setPosition( Point(VisibleRect::leftTop().x+spaceSizex, VisibleRect::top().y -spaceSizey) );
|
||||
addChild(IPlabel, 9999);
|
||||
|
||||
string strShowMsg = "waiting for file transfer ...";
|
||||
if (CC_PLATFORM_WIN32 == CC_TARGET_PLATFORM || CC_PLATFORM_MAC == CC_TARGET_PLATFORM)
|
||||
{
|
||||
strShowMsg = "waiting for debugger to connect ...";
|
||||
}
|
||||
|
||||
_labelUploadFile = Label::create(strShowMsg.c_str(), "Arial", 36);
|
||||
_labelUploadFile->setAnchorPoint(Vec2(0,0));
|
||||
_labelUploadFile->setPosition( Point(VisibleRect::leftTop().x+spaceSizex, IPlabel->getPositionY()-spaceSizex) );
|
||||
_labelUploadFile->setAlignment(TextHAlignment::LEFT);
|
||||
addChild(_labelUploadFile, 10000);
|
||||
|
||||
if (!ConfigParser::getInstance()->isLanscape())
|
||||
{
|
||||
if (playSprite) playSprite->setPosition(400,500);
|
||||
if (shineSprite) shineSprite->setPosition(400,500);
|
||||
_labelUploadFile->setAlignment(TextHAlignment::LEFT);
|
||||
}
|
||||
|
||||
if (playSprite)
|
||||
{
|
||||
auto listener = EventListenerTouchOneByOne::create();
|
||||
listener->onTouchBegan = [](Touch* touch, Event *event)->bool{
|
||||
auto target = static_cast<Sprite*>(event->getCurrentTarget());
|
||||
Vec2 point = target->convertToNodeSpace(Director::getInstance()->convertToGL(touch->getLocationInView()));
|
||||
auto rect = Rect(0, 0, target->getContentSize().width, target->getContentSize().height);
|
||||
if (!rect.containsPoint(point)) return false;
|
||||
target->stopAllActions();
|
||||
target->runAction(Sequence::createWithTwoActions(ScaleBy::create(0.05f, 0.9f),ScaleTo::create(0.125f, 1)));
|
||||
return true;
|
||||
};
|
||||
listener->onTouchEnded = [](Touch* touch, Event *event){
|
||||
auto target = static_cast<Sprite*>(event->getCurrentTarget());
|
||||
Vec2 point = target->convertToNodeSpace(Director::getInstance()->convertToGL(touch->getLocationInView()));
|
||||
auto rect = Rect(0, 0, target->getContentSize().width, target->getContentSize().height);
|
||||
if (!rect.containsPoint(point)) return;
|
||||
startScript("");
|
||||
};
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, playSprite);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void playerCallback(Object* sender)
|
||||
{
|
||||
startScript("");
|
||||
}
|
||||
|
||||
void showCurRcvFile(string fileName) {
|
||||
pLabelUploadFile->setString(fileName);
|
||||
_labelUploadFile->setString(fileName);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -30,6 +30,10 @@
|
|||
"from": "../../../config.json",
|
||||
"to": ""
|
||||
},
|
||||
{
|
||||
"from": "../../../runtime/rtres",
|
||||
"to": "rtres"
|
||||
},
|
||||
{
|
||||
"from": "../../cocos2d-x/external/lua/luasocket",
|
||||
"to": "",
|
||||
|
|
|
@ -128,6 +128,8 @@
|
|||
C09BA7E718BC929700A85A3E /* WorkSpaceDialog.xib in Resources */ = {isa = PBXBuildFile; fileRef = C09BA7E418BC929700A85A3E /* WorkSpaceDialog.xib */; };
|
||||
C09BA7E818BC929700A85A3E /* WorkSpaceDialogController.mm in Sources */ = {isa = PBXBuildFile; fileRef = C09BA7E618BC929700A85A3E /* WorkSpaceDialogController.mm */; };
|
||||
C09BA7EE18BCA49600A85A3E /* NSAppSheetAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = C09BA7ED18BCA49600A85A3E /* NSAppSheetAdditions.m */; };
|
||||
C0F9D4BC192F3E6A0066134A /* rtres in Resources */ = {isa = PBXBuildFile; fileRef = C0F9D4BB192F3E6A0066134A /* rtres */; };
|
||||
C0F9D4BD192F3E6A0066134A /* rtres in Resources */ = {isa = PBXBuildFile; fileRef = C0F9D4BB192F3E6A0066134A /* rtres */; };
|
||||
D6B061351803AC000077942B /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6B061341803AC000077942B /* CoreMotion.framework */; };
|
||||
F293B3CD15EB7BE500256477 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3CC15EB7BE500256477 /* QuartzCore.framework */; };
|
||||
F293B3D115EB7BE500256477 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3D015EB7BE500256477 /* OpenAL.framework */; };
|
||||
|
@ -394,6 +396,7 @@
|
|||
C09BA7E618BC929700A85A3E /* WorkSpaceDialogController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WorkSpaceDialogController.mm; sourceTree = "<group>"; };
|
||||
C09BA7EC18BCA49600A85A3E /* NSAppSheetAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSAppSheetAdditions.h; sourceTree = "<group>"; };
|
||||
C09BA7ED18BCA49600A85A3E /* NSAppSheetAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSAppSheetAdditions.m; sourceTree = "<group>"; };
|
||||
C0F9D4BB192F3E6A0066134A /* rtres */ = {isa = PBXFileReference; lastKnownFileType = folder; name = rtres; path = ../../../runtime/rtres; sourceTree = "<group>"; };
|
||||
D6B061341803AC000077942B /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/CoreMotion.framework; sourceTree = DEVELOPER_DIR; };
|
||||
F293B3C815EB7BE500256477 /* HelloLua iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "HelloLua iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F293B3CC15EB7BE500256477 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
|
||||
|
@ -642,6 +645,7 @@
|
|||
F293BC4615EB859D00256477 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C0F9D4BB192F3E6A0066134A /* rtres */,
|
||||
C05D1C111923449100B808A4 /* config.json */,
|
||||
C03781B718BF655400FE4F13 /* res */,
|
||||
C03781B818BF655400FE4F13 /* src */,
|
||||
|
@ -852,6 +856,7 @@
|
|||
C08D5D5D18E567C6009071A4 /* ltn12.lua in Resources */,
|
||||
C03781EC18BF656A00FE4F13 /* luaoc.lua in Resources */,
|
||||
C07828F918B4D72E00BD2287 /* MainMenu.xib in Resources */,
|
||||
C0F9D4BD192F3E6A0066134A /* rtres in Resources */,
|
||||
5023817617EBBE3400990C9B /* Icon.icns in Resources */,
|
||||
C03781D218BF656A00FE4F13 /* CCBReaderLoad.lua in Resources */,
|
||||
C08D5D5F18E567C6009071A4 /* mbox.lua in Resources */,
|
||||
|
@ -894,6 +899,7 @@
|
|||
C03781F118BF656A00FE4F13 /* StudioConstants.lua in Resources */,
|
||||
5023811F17EBBCAC00990C9B /* Icon-152.png in Resources */,
|
||||
C03781D118BF656A00FE4F13 /* CCBReaderLoad.lua in Resources */,
|
||||
C0F9D4BC192F3E6A0066134A /* rtres in Resources */,
|
||||
5023812017EBBCAC00990C9B /* Icon-57.png in Resources */,
|
||||
C03781CF18BF656A00FE4F13 /* AudioEngine.lua in Resources */,
|
||||
C03781B918BF655400FE4F13 /* res in Resources */,
|
||||
|
|
|
@ -98,16 +98,16 @@ std::string getCurAppPath(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if(!g_landscape)
|
||||
{
|
||||
float tmpvalue =width;
|
||||
width = height;
|
||||
height = tmpvalue;
|
||||
}
|
||||
|
||||
g_eglView = GLView::createWithRect([viewName cStringUsingEncoding:NSUTF8StringEncoding],cocos2d::Rect(0.0f,0.0f,width,height),frameZoomFactor);
|
||||
auto director = Director::getInstance();
|
||||
director->setOpenGLView(g_eglView);
|
||||
g_landscape = false;
|
||||
g_screenSize.width = width;
|
||||
g_screenSize.height = height;
|
||||
if (width > height)
|
||||
{
|
||||
g_landscape = true;
|
||||
}
|
||||
|
||||
window = glfwGetCocoaWindow(g_eglView->getWindow());
|
||||
[NSApp setDelegate: self];
|
||||
|
@ -124,12 +124,15 @@ void createSimulator(const char* viewName, float width, float height,bool isLand
|
|||
{
|
||||
if(g_nsAppDelegate)
|
||||
{
|
||||
if((isLandscape && height > width) || (!isLandscape && width > height))
|
||||
g_landscape = isLandscape;
|
||||
if(height > width)
|
||||
{
|
||||
float tmpvalue =width;
|
||||
width = height;
|
||||
height = tmpvalue;
|
||||
}
|
||||
g_screenSize.width = width;
|
||||
g_screenSize.height = height;
|
||||
|
||||
[g_nsAppDelegate createSimulator:[NSString stringWithUTF8String:viewName] viewWidth:width viewHeight:height factor:frameZoomFactor];
|
||||
}
|
||||
|
|
|
@ -109,9 +109,11 @@ if exist "$(OutDir)\Resource" rd /s /q "$(OutDir)\Resource"
|
|||
mkdir "$(OutDir)\Resource"
|
||||
mkdir "$(OutDir)\Resource\src"
|
||||
mkdir "$(OutDir)\Resource\res"
|
||||
mkdir "$(OutDir)\Resource\rtres"
|
||||
xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script" "$(OutDir)\Resource" /e /Y
|
||||
xcopy "$(ProjectDir)..\..\..\src" "$(OutDir)\Resource\src" /e /Y
|
||||
xcopy "$(ProjectDir)..\..\..\res" "$(OutDir)\Resource\res" /e /Y
|
||||
xcopy "$(ProjectDir)..\..\..\runtime\rtres" "$(OutDir)\Resource\rtres" /e /Y
|
||||
copy "$(ProjectDir)..\..\..\config.json" "$(OutDir)\Resource\config.json" /Y
|
||||
xcopy "$(ProjectDir)..\..\cocos2d-x\external\lua\luasocket\*.lua" "$(OutDir)\Resource" /e /Y</Command>
|
||||
<Message>copy files</Message>
|
||||
|
@ -165,9 +167,11 @@ if exist "$(OutDir)\Resource" rd /s /q "$(OutDir)\Resource"
|
|||
mkdir "$(OutDir)\Resource"
|
||||
mkdir "$(OutDir)\Resource\src"
|
||||
mkdir "$(OutDir)\Resource\res"
|
||||
mkdir "$(OutDir)\Resource\rtres"
|
||||
xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script" "$(OutDir)\Resource" /e /Y
|
||||
xcopy "$(ProjectDir)..\..\..\src" "$(OutDir)\Resource\src" /e /Y
|
||||
xcopy "$(ProjectDir)..\..\..\res" "$(OutDir)\Resource\res" /e /Y
|
||||
xcopy "$(ProjectDir)..\..\..\runtime\rtres" "$(OutDir)\Resource\rtres" /e /Y
|
||||
copy "$(ProjectDir)..\..\..\config.json" "$(OutDir)\Resource\config.json" /Y
|
||||
xcopy "$(ProjectDir)..\..\cocos2d-x\external\lua\luasocket\*.lua" "$(OutDir)\Resource" /e /Y</Command>
|
||||
<Message>copy files</Message>
|
||||
|
|
|
@ -308,7 +308,17 @@ void createSimulator(const char* viewName, float width, float height, bool isLan
|
|||
return;
|
||||
}
|
||||
|
||||
if((isLandscape && height > width) || (!isLandscape && width > height))
|
||||
g_landscape = isLandscape;
|
||||
if(height > width)
|
||||
{
|
||||
float tmpvalue =width;
|
||||
width = height;
|
||||
height = tmpvalue;
|
||||
}
|
||||
g_screenSize.width = width;
|
||||
g_screenSize.height = height;
|
||||
|
||||
if(!g_landscape)
|
||||
{
|
||||
float tmpvalue =width;
|
||||
width = height;
|
||||
|
@ -318,13 +328,6 @@ void createSimulator(const char* viewName, float width, float height, bool isLan
|
|||
g_eglView = GLView::createWithRect(viewName,Rect(0,0,width,height),frameZoomFactor);
|
||||
auto director = Director::getInstance();
|
||||
director->setOpenGLView(g_eglView);
|
||||
g_landscape = false;
|
||||
g_screenSize.width = width;
|
||||
g_screenSize.height = height;
|
||||
if (width > height)
|
||||
{
|
||||
g_landscape = true;
|
||||
}
|
||||
|
||||
HWND hWnd=glfwGetWin32Window(g_eglView->getWindow());
|
||||
HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_MENU_COCOS));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"version":"v3-lua-runtime-1.1.1",
|
||||
"zip_file_size":"20854899",
|
||||
"version":"v3-lua-runtime-1.1.2",
|
||||
"zip_file_size":"21402175",
|
||||
"repo_name":"cocos-runtime-bin",
|
||||
"repo_parent":"https://github.com/chukong/"
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
Binary file not shown.
After Width: | Height: | Size: 147 KiB |
Binary file not shown.
After Width: | Height: | Size: 131 KiB |
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
|
@ -373,7 +373,7 @@ void Effect3DOutline::drawWithSprite(EffectSprite3D* sprite, const Mat4 &transfo
|
|||
glBindBuffer(GL_ARRAY_BUFFER, mesh->getVertexBuffer());
|
||||
_glProgramState->apply(transform);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh->getIndexBuffer());
|
||||
glDrawElements((GLenum)mesh->getPrimitiveType(), mesh->getIndexCount(), (GLenum)mesh->getIndexFormat(), 0);
|
||||
glDrawElements((GLenum)mesh->getPrimitiveType(), (GLsizei)mesh->getIndexCount(), (GLenum)mesh->getIndexFormat(), 0);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
|
|
@ -1533,6 +1533,7 @@ void TextureAsync::onEnter()
|
|||
|
||||
TextureAsync::~TextureAsync()
|
||||
{
|
||||
Director::getInstance()->getTextureCache()->unbindAllImageAsync();
|
||||
Director::getInstance()->getTextureCache()->removeAllTextures();
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
|
@ -70,6 +70,8 @@
|
|||
</array>
|
||||
<key>UIPrerenderedIcon</key>
|
||||
<true/>
|
||||
<key>UIStatusBarHidden</key>
|
||||
<true/>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
|
|
|
@ -1,6 +1,25 @@
|
|||
require "OpenglConstants"
|
||||
require "Cocos2dConstants"
|
||||
require "Opengl"
|
||||
|
||||
local vertDefaultSource = "\n".."\n" ..
|
||||
"attribute vec4 a_position;\n" ..
|
||||
"attribute vec2 a_texCoord;\n" ..
|
||||
"attribute vec4 a_color;\n\n" ..
|
||||
"\n#ifdef GL_ES\n" ..
|
||||
"varying lowp vec4 v_fragmentColor;\n" ..
|
||||
"varying mediump vec2 v_texCoord;\n" ..
|
||||
"\n#else\n" ..
|
||||
"varying vec4 v_fragmentColor;" ..
|
||||
"varying vec2 v_texCoord;" ..
|
||||
"\n#endif\n" ..
|
||||
"void main()\n" ..
|
||||
"{\n" ..
|
||||
" gl_Position = CC_MVPMatrix * a_position;\n"..
|
||||
" v_fragmentColor = a_color;\n"..
|
||||
" v_texCoord = a_texCoord;\n" ..
|
||||
"} \n"
|
||||
|
||||
local function OpenGLTestMainLayer()
|
||||
local kItemTagBasic = 1000
|
||||
local testCount = 16
|
||||
|
@ -174,122 +193,80 @@ local function OpenGLTestMainLayer()
|
|||
end
|
||||
|
||||
local function createShaderMajoriTest()
|
||||
local uniformCenter = 0
|
||||
local uniformResolution = 0
|
||||
local time = 0
|
||||
local squareVertexPositionBuffer = {}
|
||||
local majorLayer = cc.Layer:create()
|
||||
|
||||
InitTitle(majorLayer)
|
||||
--loadShaderVertex
|
||||
local shader = cc.GLProgram:create("Shaders/example_Monjori.vsh", "Shaders/example_Monjori.fsh")
|
||||
|
||||
shader:bindAttribLocation("aVertex", cc.VERTEX_ATTRIB_POSITION)
|
||||
shader:link()
|
||||
shader:updateUniforms()
|
||||
local fileUtiles = cc.FileUtils:getInstance()
|
||||
|
||||
local program = shader:getProgram()
|
||||
local vertSource = vertDefaultSource
|
||||
local fragSource = fileUtiles:getStringFromFile("Shaders/example_Monjori.fsh")
|
||||
local glProgam = cc.GLProgram:createWithByteArrays(vertSource, fragSource)
|
||||
local glprogramstate = cc.GLProgramState:getOrCreateWithGLProgram(glProgam)
|
||||
local resolution = cc.p(256, 256)
|
||||
|
||||
local glNode = gl.glNodeCreate()
|
||||
glNode:setContentSize(cc.size(256, 256))
|
||||
glNode:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
uniformCenter = gl.getUniformLocation(program,"center")
|
||||
uniformResolution = gl.getUniformLocation( program, "resolution")
|
||||
glNode:setGLProgram(shader)
|
||||
|
||||
local function initBuffer()
|
||||
squareVertexPositionBuffer = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer)
|
||||
local vertices = { 256,256,0,256,256,0,0,0}
|
||||
gl.bufferData(gl.ARRAY_BUFFER,8,vertices,gl.STATIC_DRAW)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, 0)
|
||||
end
|
||||
glNode:setGLProgramState(glprogramstate)
|
||||
glNode:getGLProgramState():setUniformVec2("resolution", resolution)
|
||||
|
||||
local function updateMajori(fTime)
|
||||
time = time + fTime
|
||||
end
|
||||
|
||||
local function majoriDraw(transform, transformUpdated)
|
||||
if nil ~= shader then
|
||||
shader:use()
|
||||
shader:setUniformsForBuiltins(transform)
|
||||
--Uniforms
|
||||
shader:setUniformLocationF32( uniformCenter, size.width/2, size.height/2)
|
||||
shader:setUniformLocationF32( uniformResolution, 256, 256)
|
||||
local w = 256
|
||||
local h = 256
|
||||
|
||||
gl.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION)
|
||||
local vertices ={ 0,0, w,0, w,h, 0,0, 0,h, w,h }
|
||||
local glProgramState = glNode:getGLProgramState()
|
||||
glProgramState:setVertexAttribPointer("a_position", 2, gl.FLOAT, false, 0, vertices, #vertices)
|
||||
glProgramState:apply(transform)
|
||||
gl.drawArrays(gl.TRIANGLES, 0, 6)
|
||||
end
|
||||
|
||||
--Draw fullscreen Square
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer)
|
||||
gl.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0)
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP,0,4)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,0)
|
||||
end
|
||||
end
|
||||
initBuffer()
|
||||
majorLayer:scheduleUpdateWithPriorityLua(updateMajori,0)
|
||||
glNode:registerScriptDrawHandler(majoriDraw)
|
||||
time = 0
|
||||
majorLayer:addChild(glNode,-10)
|
||||
print("pos is ", size.width/2, size.height/2)
|
||||
glNode:setPosition( size.width/2, size.height/2)
|
||||
return majorLayer
|
||||
end
|
||||
|
||||
local function createShaderMandelbrotTest()
|
||||
local uniformCenter = 0
|
||||
local uniformResolution = 0
|
||||
local time = 0
|
||||
local squareVertexPositionBuffer = {}
|
||||
local mandelbrotLayer = cc.Layer:create()
|
||||
|
||||
InitTitle(mandelbrotLayer)
|
||||
--loadShaderVertex
|
||||
local shader = cc.GLProgram:create("Shaders/example_Mandelbrot.vsh", "Shaders/example_Mandelbrot.fsh")
|
||||
|
||||
shader:bindAttribLocation("aVertex", 0)
|
||||
shader:link()
|
||||
shader:updateUniforms()
|
||||
|
||||
local program = shader:getProgram()
|
||||
local fileUtiles = cc.FileUtils:getInstance()
|
||||
local vertSource = vertDefaultSource
|
||||
local fragSource = fileUtiles:getStringFromFile("Shaders/example_Mandelbrot.fsh")
|
||||
local glProgam = cc.GLProgram:createWithByteArrays(vertSource, fragSource)
|
||||
local glprogramstate = cc.GLProgramState:getOrCreateWithGLProgram(glProgam)
|
||||
local resolution = cc.p(256, 256)
|
||||
|
||||
local glNode = gl.glNodeCreate()
|
||||
glNode:setContentSize(cc.size(256,256))
|
||||
glNode:setContentSize(cc.size(256, 256))
|
||||
glNode:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
uniformCenter = gl.getUniformLocation(program,"center")
|
||||
uniformResolution = gl.getUniformLocation( program, "resolution")
|
||||
glNode:setGLProgram(shader)
|
||||
|
||||
local function initBuffer()
|
||||
squareVertexPositionBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
local vertices = { 256,256,0,256,256,0,0,0}
|
||||
gl.bufferData(gl.ARRAY_BUFFER,8,vertices,gl.STATIC_DRAW)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, 0)
|
||||
end
|
||||
glNode:setGLProgramState(glprogramstate)
|
||||
glNode:getGLProgramState():setUniformVec2("resolution", resolution)
|
||||
|
||||
local function updateMandelbrot(fTime)
|
||||
time = time + fTime
|
||||
end
|
||||
|
||||
local function mandelbrotDraw(transform, transformUpdated)
|
||||
if nil ~= shader then
|
||||
shader:use()
|
||||
shader:setUniformsForBuiltins(transform)
|
||||
--Uniforms
|
||||
shader:setUniformLocationF32( uniformCenter, size.width/2, size.height/2)
|
||||
shader:setUniformLocationF32( uniformResolution, 256, 256)
|
||||
local w = 256
|
||||
local h = 256
|
||||
|
||||
gl.glEnableVertexAttribs(0x1)
|
||||
local vertices ={ 0,0, w,0, w,h, 0,0, 0,h, w,h }
|
||||
local glProgramState = glNode:getGLProgramState()
|
||||
glProgramState:setVertexAttribPointer("a_position", 2, gl.FLOAT, false, 0, vertices, #vertices)
|
||||
glProgramState:apply(transform)
|
||||
gl.drawArrays(gl.TRIANGLES, 0, 6)
|
||||
end
|
||||
|
||||
--Draw fullscreen Square
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0)
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP,0,4)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,0)
|
||||
end
|
||||
end
|
||||
initBuffer()
|
||||
mandelbrotLayer:scheduleUpdateWithPriorityLua(updateMandelbrot,0)
|
||||
glNode:registerScriptDrawHandler(mandelbrotDraw)
|
||||
time = 0
|
||||
|
@ -299,59 +276,39 @@ local function OpenGLTestMainLayer()
|
|||
end
|
||||
|
||||
local function createShaderHeartTest()
|
||||
local uniformCenter = 0
|
||||
local uniformResolution = 0
|
||||
local time = 0
|
||||
local squareVertexPositionBuffer = {}
|
||||
|
||||
local heartLayer = cc.Layer:create()
|
||||
|
||||
InitTitle(heartLayer)
|
||||
--loadShaderVertex
|
||||
local shader = cc.GLProgram:create("Shaders/example_Heart.vsh", "Shaders/example_Heart.fsh")
|
||||
|
||||
shader:bindAttribLocation("aVertex", 0)
|
||||
shader:link()
|
||||
shader:updateUniforms()
|
||||
|
||||
local program = shader:getProgram()
|
||||
local fileUtiles = cc.FileUtils:getInstance()
|
||||
local vertSource = vertDefaultSource
|
||||
local fragSource = fileUtiles:getStringFromFile("Shaders/example_Heart.fsh")
|
||||
local glProgam = cc.GLProgram:createWithByteArrays(vertSource, fragSource)
|
||||
local glprogramstate = cc.GLProgramState:getOrCreateWithGLProgram(glProgam)
|
||||
local resolution = cc.p(256, 256)
|
||||
|
||||
local glNode = gl.glNodeCreate()
|
||||
glNode:setContentSize(cc.size(256,256))
|
||||
glNode:setContentSize(cc.size(256, 256))
|
||||
glNode:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
uniformCenter = gl.getUniformLocation(program,"center")
|
||||
uniformResolution = gl.getUniformLocation( program, "resolution")
|
||||
glNode:setGLProgram(shader)
|
||||
|
||||
local function initBuffer()
|
||||
squareVertexPositionBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
local vertices = { 256,256,0,256,256,0,0,0}
|
||||
gl.bufferData(gl.ARRAY_BUFFER,8,vertices,gl.STATIC_DRAW)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, 0)
|
||||
end
|
||||
glNode:setGLProgramState(glprogramstate)
|
||||
glNode:getGLProgramState():setUniformVec2("resolution", resolution)
|
||||
|
||||
local function updateHeart(fTime)
|
||||
time = time + fTime
|
||||
end
|
||||
|
||||
local function heartDraw(transform, transformUpdated)
|
||||
if nil ~= shader then
|
||||
shader:use()
|
||||
shader:setUniformsForBuiltins(transform)
|
||||
--Uniforms
|
||||
shader:setUniformLocationF32( uniformCenter, size.width/2, size.height/2)
|
||||
shader:setUniformLocationF32( uniformResolution, 256, 256)
|
||||
local w = 256
|
||||
local h = 256
|
||||
|
||||
gl.glEnableVertexAttribs(0x1)
|
||||
local vertices ={ 0,0, w,0, w,h, 0,0, 0,h, w,h }
|
||||
local glProgramState = glNode:getGLProgramState()
|
||||
glProgramState:setVertexAttribPointer("a_position", 2, gl.FLOAT, false, 0, vertices, #vertices)
|
||||
glProgramState:apply(transform)
|
||||
gl.drawArrays(gl.TRIANGLES, 0, 6)
|
||||
end
|
||||
|
||||
--Draw fullscreen Square
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0)
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP,0,4)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,0)
|
||||
end
|
||||
end
|
||||
initBuffer()
|
||||
heartLayer:scheduleUpdateWithPriorityLua(updateHeart,0)
|
||||
glNode:registerScriptDrawHandler(heartDraw)
|
||||
time = 0
|
||||
|
@ -361,59 +318,40 @@ local function OpenGLTestMainLayer()
|
|||
end
|
||||
|
||||
local function createShaderPlasmaTest()
|
||||
local uniformCenter = 0
|
||||
local uniformResolution = 0
|
||||
local time = 0
|
||||
local squareVertexPositionBuffer = {}
|
||||
|
||||
local plasmaLayer = cc.Layer:create()
|
||||
|
||||
InitTitle(plasmaLayer)
|
||||
--loadShaderVertex
|
||||
local shader = cc.GLProgram:create("Shaders/example_Plasma.vsh", "Shaders/example_Plasma.fsh")
|
||||
|
||||
shader:bindAttribLocation("aVertex", 0)
|
||||
shader:link()
|
||||
shader:updateUniforms()
|
||||
|
||||
local program = shader:getProgram()
|
||||
local fileUtiles = cc.FileUtils:getInstance()
|
||||
local vertSource = vertDefaultSource
|
||||
local fragSource = fileUtiles:getStringFromFile("Shaders/example_Plasma.fsh")
|
||||
local glProgam = cc.GLProgram:createWithByteArrays(vertSource, fragSource)
|
||||
local glprogramstate = cc.GLProgramState:getOrCreateWithGLProgram(glProgam)
|
||||
local resolution = cc.p(256, 256)
|
||||
|
||||
local glNode = gl.glNodeCreate()
|
||||
glNode:setContentSize(cc.size(256,256))
|
||||
glNode:setContentSize(cc.size(256, 256))
|
||||
glNode:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
uniformCenter = gl.getUniformLocation(program,"center")
|
||||
uniformResolution = gl.getUniformLocation( program, "resolution")
|
||||
glNode:setGLProgram(shader)
|
||||
glNode:setGLProgramState(glprogramstate)
|
||||
glNode:getGLProgramState():setUniformVec2("resolution", resolution)
|
||||
|
||||
local function initBuffer()
|
||||
squareVertexPositionBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
local vertices = { 256,256,0,256,256,0,0,0}
|
||||
gl.bufferData(gl.ARRAY_BUFFER,8,vertices,gl.STATIC_DRAW)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, 0)
|
||||
end
|
||||
|
||||
local function updatePlasma(fTime)
|
||||
time = time + fTime
|
||||
end
|
||||
|
||||
local function plasmaDraw(transform, transformUpdated)
|
||||
if nil ~= shader then
|
||||
shader:use()
|
||||
shader:setUniformsForBuiltins(transform)
|
||||
--Uniforms
|
||||
shader:setUniformLocationF32( uniformCenter, size.width/2, size.height/2)
|
||||
shader:setUniformLocationF32( uniformResolution, 256, 256)
|
||||
local w = 256
|
||||
local h = 256
|
||||
|
||||
gl.glEnableVertexAttribs(0x1)
|
||||
local vertices ={ 0,0, w,0, w,h, 0,0, 0,h, w,h }
|
||||
local glProgramState = glNode:getGLProgramState()
|
||||
glProgramState:setVertexAttribPointer("a_position", 2, gl.FLOAT, false, 0, vertices, #vertices)
|
||||
glProgramState:apply(transform)
|
||||
gl.drawArrays(gl.TRIANGLES, 0, 6)
|
||||
end
|
||||
|
||||
--Draw fullscreen Square
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0)
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP,0,4)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,0)
|
||||
end
|
||||
end
|
||||
initBuffer()
|
||||
plasmaLayer:scheduleUpdateWithPriorityLua(updatePlasma,0)
|
||||
glNode:registerScriptDrawHandler(plasmaDraw)
|
||||
time = 0
|
||||
|
@ -423,59 +361,39 @@ local function OpenGLTestMainLayer()
|
|||
end
|
||||
|
||||
local function createShaderFlowerTest()
|
||||
local uniformCenter = 0
|
||||
local uniformResolution = 0
|
||||
local time = 0
|
||||
local squareVertexPositionBuffer = {}
|
||||
|
||||
local flowerLayer = cc.Layer:create()
|
||||
|
||||
InitTitle(flowerLayer)
|
||||
--loadShaderVertex
|
||||
local shader = cc.GLProgram:create("Shaders/example_Flower.vsh", "Shaders/example_Flower.fsh")
|
||||
|
||||
shader:bindAttribLocation("aVertex", 0)
|
||||
shader:link()
|
||||
shader:updateUniforms()
|
||||
|
||||
local program = shader:getProgram()
|
||||
local fileUtiles = cc.FileUtils:getInstance()
|
||||
local vertSource = vertDefaultSource
|
||||
local fragSource = fileUtiles:getStringFromFile("Shaders/example_Flower.fsh")
|
||||
local glProgam = cc.GLProgram:createWithByteArrays(vertSource, fragSource)
|
||||
local glprogramstate = cc.GLProgramState:getOrCreateWithGLProgram(glProgam)
|
||||
local resolution = cc.p(256, 256)
|
||||
|
||||
local glNode = gl.glNodeCreate()
|
||||
glNode:setContentSize(cc.size(256,256))
|
||||
glNode:setContentSize(cc.size(256, 256))
|
||||
glNode:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
uniformCenter = gl.getUniformLocation(program,"center")
|
||||
uniformResolution = gl.getUniformLocation( program, "resolution")
|
||||
glNode:setGLProgram(shader)
|
||||
|
||||
local function initBuffer()
|
||||
squareVertexPositionBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
local vertices = { 256,256,0,256,256,0,0,0}
|
||||
gl.bufferData(gl.ARRAY_BUFFER,8,vertices,gl.STATIC_DRAW)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, 0)
|
||||
end
|
||||
glNode:setGLProgramState(glprogramstate)
|
||||
glNode:getGLProgramState():setUniformVec2("resolution", resolution)
|
||||
|
||||
local function updateFlower(fTime)
|
||||
time = time + fTime
|
||||
end
|
||||
|
||||
local function flowerDraw(transform, transformUpdated)
|
||||
if nil ~= shader then
|
||||
shader:use()
|
||||
shader:setUniformsForBuiltins(transform)
|
||||
--Uniforms
|
||||
shader:setUniformLocationF32( uniformCenter, size.width/2, size.height/2)
|
||||
shader:setUniformLocationF32( uniformResolution, 256, 256)
|
||||
local w = 256
|
||||
local h = 256
|
||||
|
||||
gl.glEnableVertexAttribs(0x1)
|
||||
local vertices ={ 0,0, w,0, w,h, 0,0, 0,h, w,h }
|
||||
local glProgramState = glNode:getGLProgramState()
|
||||
glProgramState:setVertexAttribPointer("a_position", 2, gl.FLOAT, false, 0, vertices, #vertices)
|
||||
glProgramState:apply(transform)
|
||||
gl.drawArrays(gl.TRIANGLES, 0, 6)
|
||||
end
|
||||
|
||||
--Draw fullscreen Square
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0)
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP,0,4)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,0)
|
||||
end
|
||||
end
|
||||
initBuffer()
|
||||
flowerLayer:scheduleUpdateWithPriorityLua(updateFlower,0)
|
||||
glNode:registerScriptDrawHandler(flowerDraw)
|
||||
time = 0
|
||||
|
@ -485,59 +403,39 @@ local function OpenGLTestMainLayer()
|
|||
end
|
||||
|
||||
local function createShaderJuliaTest()
|
||||
local uniformCenter = 0
|
||||
local uniformResolution = 0
|
||||
local time = 0
|
||||
local squareVertexPositionBuffer = {}
|
||||
|
||||
local juliaLayer = cc.Layer:create()
|
||||
|
||||
InitTitle(juliaLayer)
|
||||
--loadShaderVertex
|
||||
local shader = cc.GLProgram:create("Shaders/example_Julia.vsh", "Shaders/example_Julia.fsh")
|
||||
|
||||
shader:bindAttribLocation("aVertex", 0)
|
||||
shader:link()
|
||||
shader:updateUniforms()
|
||||
|
||||
local program = shader:getProgram()
|
||||
local fileUtiles = cc.FileUtils:getInstance()
|
||||
local vertSource = vertDefaultSource
|
||||
local fragSource = fileUtiles:getStringFromFile("Shaders/example_Julia.fsh")
|
||||
local glProgam = cc.GLProgram:createWithByteArrays(vertSource, fragSource)
|
||||
local glprogramstate = cc.GLProgramState:getOrCreateWithGLProgram(glProgam)
|
||||
local resolution = cc.p(256, 256)
|
||||
|
||||
local glNode = gl.glNodeCreate()
|
||||
glNode:setContentSize(cc.size(256,256))
|
||||
glNode:setContentSize(cc.size(256, 256))
|
||||
glNode:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
uniformCenter = gl.getUniformLocation(program,"center")
|
||||
uniformResolution = gl.getUniformLocation( program, "resolution")
|
||||
glNode:setGLProgram(shader)
|
||||
|
||||
local function initBuffer()
|
||||
squareVertexPositionBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
local vertices = { 256,256,0,256,256,0,0,0}
|
||||
gl.bufferData(gl.ARRAY_BUFFER,8,vertices,gl.STATIC_DRAW)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, 0)
|
||||
end
|
||||
glNode:setGLProgramState(glprogramstate)
|
||||
glNode:getGLProgramState():setUniformVec2("resolution", resolution)
|
||||
|
||||
local function updateJulia(fTime)
|
||||
time = time + fTime
|
||||
end
|
||||
|
||||
local function juliaDraw(transform, transformUpdated)
|
||||
if nil ~= shader then
|
||||
shader:use()
|
||||
shader:setUniformsForBuiltins(transform)
|
||||
--Uniforms
|
||||
shader:setUniformLocationF32( uniformCenter, size.width/2, size.height/2)
|
||||
shader:setUniformLocationF32( uniformResolution, 256, 256)
|
||||
local w = 256
|
||||
local h = 256
|
||||
|
||||
gl.glEnableVertexAttribs(0x1)
|
||||
local vertices ={ 0,0, w,0, w,h, 0,0, 0,h, w,h }
|
||||
local glProgramState = glNode:getGLProgramState()
|
||||
glProgramState:setVertexAttribPointer("a_position", 2, gl.FLOAT, false, 0, vertices, #vertices)
|
||||
glProgramState:apply(transform)
|
||||
gl.drawArrays(gl.TRIANGLES, 0, 6)
|
||||
end
|
||||
|
||||
--Draw fullscreen Square
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0)
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP,0,4)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,0)
|
||||
end
|
||||
end
|
||||
initBuffer()
|
||||
juliaLayer:scheduleUpdateWithPriorityLua(updateJulia,0)
|
||||
glNode:registerScriptDrawHandler(juliaDraw)
|
||||
time = 0
|
||||
|
@ -606,6 +504,7 @@ local function OpenGLTestMainLayer()
|
|||
glNode:setAnchorPoint(cc.p(0.5,0.5))
|
||||
local shaderCache = cc.ShaderCache:getInstance()
|
||||
local shader = shaderCache:getProgram("ShaderPositionTexture")
|
||||
|
||||
local function initGL()
|
||||
texture.texture_id = gl.createTexture()
|
||||
gl.bindTexture(gl.TEXTURE_2D,texture.texture_id )
|
||||
|
|
|
@ -1264,16 +1264,33 @@ local function TextureMemoryAlloc()
|
|||
cc.Director:getInstance():getTextureCache():removeUnusedTextures()
|
||||
|
||||
local file = ""
|
||||
|
||||
local targetPlatform = cc.Application:getInstance():getTargetPlatform()
|
||||
|
||||
if cc.PLATFORM_OS_ANDROID == targetPlatform then
|
||||
if tag == 0 then
|
||||
file = "Images/test_1021x1024.png"
|
||||
file = "Images/background.png"
|
||||
elseif tag == 1 then
|
||||
file = "Images/test_1021x1024_rgba8888.pvr"
|
||||
file = "Images/fire_rgba8888.pvr"
|
||||
elseif tag == 2 then
|
||||
file = "Images/test_1021x1024_rgb888.pvr"
|
||||
file = "Images/grossini_prv_rgba8888.pvr"
|
||||
elseif tag == 3 then
|
||||
file = "Images/test_1021x1024_rgba4444.pvr"
|
||||
file = "Images/grossini_prv_rgba4444.pvr"
|
||||
elseif tag == 4 then
|
||||
file = "Images/test_1021x1024_a8.pvr"
|
||||
file = "Images/test_image_a8.pvr"
|
||||
end
|
||||
else
|
||||
if tag == 0 then
|
||||
file = "Images/background.png"
|
||||
elseif tag == 1 then
|
||||
file = "Images/test_image_rgba4444.pvr.gz"
|
||||
elseif tag == 2 then
|
||||
file = "Images/test_image_rgba4444.pvr.gz"
|
||||
elseif tag == 3 then
|
||||
file = "Images/test_image_rgba4444.pvr.gz"
|
||||
elseif tag == 4 then
|
||||
file = "Images/test_image_rgba4444.pvr.gz"
|
||||
end
|
||||
end
|
||||
|
||||
m_pBackground = cc.Sprite:create(file)
|
||||
|
|
|
@ -30,7 +30,7 @@ end
|
|||
|
||||
local searchPaths = fileUtils:getSearchPaths()
|
||||
table.insert(searchPaths, 1, resPrefix)
|
||||
table.insert(searchPaths, 1, "cocosbuilderRes")
|
||||
table.insert(searchPaths, 1, resPrefix .. "cocosbuilderRes")
|
||||
|
||||
if screenSize.height > 320 then
|
||||
table.insert(searchPaths, 1, resPrefix .. "hd")
|
||||
|
@ -65,4 +65,8 @@ fileUtils:setSearchPaths(searchPaths)
|
|||
|
||||
local scene = cc.Scene:create()
|
||||
scene:addChild(CreateTestMenu())
|
||||
cc.Director:getInstance():runWithScene(scene)
|
||||
if cc.Director:getInstance():getRunningScene() then
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
else
|
||||
cc.Director:getInstance():runWithScene(scene)
|
||||
end
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit edd24a1dcc0d8344038e4d46367c603b2a846ab5
|
||||
Subproject commit 29cfa00a4b85f934eefe0b2fae460bd9a55ee345
|
|
@ -190,16 +190,13 @@ def main():
|
|||
data = re.sub('<uses-feature android:glEsVersion="0x00020000" />', '<uses-feature android:glEsVersion="0x00020000" /> <uses-permission android:name="android.permission.INTERNET"/>', data)
|
||||
codecs.open(modify_file, 'wb', encoding='UTF-8').write(data)
|
||||
print "Start build android..."
|
||||
ret = os.system("python build/android-build.py -n -j10 all")
|
||||
ret = os.system("python build/android-build.py -p 10 all")
|
||||
# create and save apk
|
||||
if(ret == 0):
|
||||
sample_dir = 'tests/cpp-empty-test/proj.android/'
|
||||
os.system('android update project -p cocos/platform/android/java/ -t android-13')
|
||||
os.system('android update project -p ' + sample_dir + ' -t android-13')
|
||||
os.system('ant debug -f ' + sample_dir + 'build.xml')
|
||||
local_apk = sample_dir + 'bin/CppEmptyTest-debug.apk'
|
||||
remote_apk = 'apks/cpp_empty_test/cpp_empty_test_' + str(pr_num) + '.apk'
|
||||
os.system('tools/jenkins-scripts/upload_apk.sh ' + local_apk + ' ' + remote_apk)
|
||||
sample_dir = 'tests/cpp-tests/proj.android/'
|
||||
local_apk = sample_dir + 'bin/CppTests-debug.apk'
|
||||
backup_apk = os.environ['BACKUP_PATH'] + 'CppTests_' + str(pr_num) + '.apk'
|
||||
os.system('cp ' + local_apk + ' ' + backup_apk)
|
||||
elif(node_name == 'win32_win7'):
|
||||
ret = subprocess.call('"%VS110COMNTOOLS%..\IDE\devenv.com" "build\cocos2d-win32.vc2012.sln" /Build "Debug|Win32"', shell=True)
|
||||
elif(node_name == 'ios_mac'):
|
||||
|
|
|
@ -101,7 +101,7 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS
|
|||
Scheduler::[pause resume unschedule schedule update isTargetPaused isScheduled performFunctionInCocosThread],
|
||||
TextureCache::[addPVRTCImage addImageAsync],
|
||||
Timer::[getSelector createWithScriptHandler],
|
||||
*::[^visit$ copyWith.* onEnter.* onExit.* ^description$ getObjectType (g|s)etDelegate onTouch.* onAcc.* onKey.* onRegisterTouchListener],
|
||||
*::[copyWith.* onEnter.* onExit.* ^description$ getObjectType (g|s)etDelegate onTouch.* onAcc.* onKey.* onRegisterTouchListener],
|
||||
FileUtils::[getFileData getDataFromFile getFullPathCache],
|
||||
Application::[^application.* ^run$],
|
||||
Camera::[getEyeXYZ getCenterXYZ getUpXYZ],
|
||||
|
|
Loading…
Reference in New Issue