mirror of https://github.com/axmolengine/axmol.git
commit
7723fabb78
|
@ -445,7 +445,6 @@ void LayerColor::updateColor()
|
||||||
_vertexData[i].colors.b = _displayedColor.b / 255.0f;
|
_vertexData[i].colors.b = _displayedColor.b / 255.0f;
|
||||||
_vertexData[i].colors.a = _displayedOpacity / 255.0f;
|
_vertexData[i].colors.a = _displayedOpacity / 255.0f;
|
||||||
}
|
}
|
||||||
updateVertexBuffer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerColor::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
void LayerColor::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||||
|
|
|
@ -1738,22 +1738,22 @@ public:
|
||||||
* Set the callback of event EnterTransitionDidFinish.
|
* Set the callback of event EnterTransitionDidFinish.
|
||||||
* @param callback A std::function<void()> callback.
|
* @param callback A std::function<void()> callback.
|
||||||
*/
|
*/
|
||||||
void setonEnterTransitionDidFinishCallback(const std::function<void()>& callback) { _onEnterTransitionDidFinishCallback = callback; }
|
void setOnEnterTransitionDidFinishCallback(const std::function<void()>& callback) { _onEnterTransitionDidFinishCallback = callback; }
|
||||||
/**
|
/**
|
||||||
* Get the callback of event EnterTransitionDidFinish.
|
* Get the callback of event EnterTransitionDidFinish.
|
||||||
* @return std::function<void()>
|
* @return std::function<void()>
|
||||||
*/
|
*/
|
||||||
const std::function<void()>& getonEnterTransitionDidFinishCallback() const { return _onEnterTransitionDidFinishCallback; }
|
const std::function<void()>& getOnEnterTransitionDidFinishCallback() const { return _onEnterTransitionDidFinishCallback; }
|
||||||
/**
|
/**
|
||||||
* Set the callback of event ExitTransitionDidStart.
|
* Set the callback of event ExitTransitionDidStart.
|
||||||
* @param callback A std::function<void()> callback.
|
* @param callback A std::function<void()> callback.
|
||||||
*/
|
*/
|
||||||
void setonExitTransitionDidStartCallback(const std::function<void()>& callback) { _onExitTransitionDidStartCallback = callback; }
|
void setOnExitTransitionDidStartCallback(const std::function<void()>& callback) { _onExitTransitionDidStartCallback = callback; }
|
||||||
/**
|
/**
|
||||||
* Get the callback of event ExitTransitionDidStart.
|
* Get the callback of event ExitTransitionDidStart.
|
||||||
* @return std::function<void()>
|
* @return std::function<void()>
|
||||||
*/
|
*/
|
||||||
const std::function<void()>& getonExitTransitionDidStartCallback() const { return _onExitTransitionDidStartCallback; }
|
const std::function<void()>& getOnExitTransitionDidStartCallback() const { return _onExitTransitionDidStartCallback; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get & set camera mask, the node is visible by the camera whose camera flag & node's camera mask is true
|
* get & set camera mask, the node is visible by the camera whose camera flag & node's camera mask is true
|
||||||
|
|
|
@ -65,8 +65,7 @@ AudioEngine::AudioEngineThreadPool* AudioEngine::s_threadPool = nullptr;
|
||||||
bool AudioEngine::_isEnabled = true;
|
bool AudioEngine::_isEnabled = true;
|
||||||
|
|
||||||
AudioEngine::AudioInfo::AudioInfo()
|
AudioEngine::AudioInfo::AudioInfo()
|
||||||
: filePath(nullptr)
|
: profileHelper(nullptr)
|
||||||
, profileHelper(nullptr)
|
|
||||||
, volume(1.0f)
|
, volume(1.0f)
|
||||||
, loop(false)
|
, loop(false)
|
||||||
, duration(TIME_UNKNOWN)
|
, duration(TIME_UNKNOWN)
|
||||||
|
@ -241,7 +240,7 @@ int AudioEngine::play2d(const std::string& filePath, bool loop, float volume, co
|
||||||
auto& audioRef = _audioIDInfoMap[ret];
|
auto& audioRef = _audioIDInfoMap[ret];
|
||||||
audioRef.volume = volume;
|
audioRef.volume = volume;
|
||||||
audioRef.loop = loop;
|
audioRef.loop = loop;
|
||||||
audioRef.filePath = &it->first;
|
audioRef.filePath = it->first;
|
||||||
|
|
||||||
if (profileHelper) {
|
if (profileHelper) {
|
||||||
profileHelper->lastPlayTime = utils::gettime();
|
profileHelper->lastPlayTime = utils::gettime();
|
||||||
|
@ -342,7 +341,7 @@ void AudioEngine::remove(int audioID)
|
||||||
if (it->second.profileHelper) {
|
if (it->second.profileHelper) {
|
||||||
it->second.profileHelper->audioIDs.remove(audioID);
|
it->second.profileHelper->audioIDs.remove(audioID);
|
||||||
}
|
}
|
||||||
_audioPathIDMap[*it->second.filePath].remove(audioID);
|
_audioPathIDMap[it->second.filePath].remove(audioID);
|
||||||
_audioIDInfoMap.erase(it);
|
_audioIDInfoMap.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -672,7 +672,7 @@ void AudioEngineImpl::update(float dt)
|
||||||
std::string filePath;
|
std::string filePath;
|
||||||
if (player->_finishCallbak) {
|
if (player->_finishCallbak) {
|
||||||
auto& audioInfo = AudioEngine::_audioIDInfoMap[audioID];
|
auto& audioInfo = AudioEngine::_audioIDInfoMap[audioID];
|
||||||
filePath = *audioInfo.filePath;
|
filePath = audioInfo.filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioEngine::remove(audioID);
|
AudioEngine::remove(audioID);
|
||||||
|
|
|
@ -326,7 +326,7 @@ protected:
|
||||||
|
|
||||||
struct AudioInfo
|
struct AudioInfo
|
||||||
{
|
{
|
||||||
const std::string* filePath;
|
std::string filePath;
|
||||||
ProfileHelper* profileHelper;
|
ProfileHelper* profileHelper;
|
||||||
|
|
||||||
float volume;
|
float volume;
|
||||||
|
|
|
@ -476,7 +476,7 @@ void AudioEngineImpl::update(float dt)
|
||||||
std::string filePath;
|
std::string filePath;
|
||||||
if (player->_finishCallbak) {
|
if (player->_finishCallbak) {
|
||||||
auto& audioInfo = AudioEngine::_audioIDInfoMap[audioID];
|
auto& audioInfo = AudioEngine::_audioIDInfoMap[audioID];
|
||||||
filePath = *audioInfo.filePath;
|
filePath = audioInfo.filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioEngine::remove(audioID);
|
AudioEngine::remove(audioID);
|
||||||
|
|
|
@ -4625,6 +4625,53 @@ int lua_cocos2dx_Node_setPhysicsBody(lua_State* tolua_S)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
int lua_cocos2dx_Node_getOnExitTransitionDidStartCallback(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_getOnExitTransitionDidStartCallback'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 0)
|
||||||
|
{
|
||||||
|
if(!ok)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Node_getOnExitTransitionDidStartCallback'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
const std::function<void ()>& ret = cobj->getOnExitTransitionDidStartCallback();
|
||||||
|
#pragma warning NO CONVERSION FROM NATIVE FOR std::function;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:getOnExitTransitionDidStartCallback",argc, 0);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_getOnExitTransitionDidStartCallback'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
int lua_cocos2dx_Node_getDescription(lua_State* tolua_S)
|
int lua_cocos2dx_Node_getDescription(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
@ -5514,60 +5561,6 @@ int lua_cocos2dx_Node_setRotationSkewX(lua_State* tolua_S)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int lua_cocos2dx_Node_setonEnterTransitionDidFinishCallback(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_setonEnterTransitionDidFinishCallback'", nullptr);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
argc = lua_gettop(tolua_S)-1;
|
|
||||||
if (argc == 1)
|
|
||||||
{
|
|
||||||
std::function<void ()> arg0;
|
|
||||||
|
|
||||||
do {
|
|
||||||
// Lambda binding for lua is not supported.
|
|
||||||
assert(false);
|
|
||||||
} while(0)
|
|
||||||
;
|
|
||||||
if(!ok)
|
|
||||||
{
|
|
||||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Node_setonEnterTransitionDidFinishCallback'", nullptr);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
cobj->setonEnterTransitionDidFinishCallback(arg0);
|
|
||||||
lua_settop(tolua_S, 1);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:setonEnterTransitionDidFinishCallback",argc, 1);
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
#if COCOS2D_DEBUG >= 1
|
|
||||||
tolua_lerror:
|
|
||||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_setonEnterTransitionDidFinishCallback'.",&tolua_err);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int lua_cocos2dx_Node_removeAllComponents(lua_State* tolua_S)
|
int lua_cocos2dx_Node_removeAllComponents(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
@ -6385,60 +6378,6 @@ int lua_cocos2dx_Node_setNormalizedPosition(lua_State* tolua_S)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int lua_cocos2dx_Node_setonExitTransitionDidStartCallback(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_setonExitTransitionDidStartCallback'", nullptr);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
argc = lua_gettop(tolua_S)-1;
|
|
||||||
if (argc == 1)
|
|
||||||
{
|
|
||||||
std::function<void ()> arg0;
|
|
||||||
|
|
||||||
do {
|
|
||||||
// Lambda binding for lua is not supported.
|
|
||||||
assert(false);
|
|
||||||
} while(0)
|
|
||||||
;
|
|
||||||
if(!ok)
|
|
||||||
{
|
|
||||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Node_setonExitTransitionDidStartCallback'", nullptr);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
cobj->setonExitTransitionDidStartCallback(arg0);
|
|
||||||
lua_settop(tolua_S, 1);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:setonExitTransitionDidStartCallback",argc, 1);
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
#if COCOS2D_DEBUG >= 1
|
|
||||||
tolua_lerror:
|
|
||||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_setonExitTransitionDidStartCallback'.",&tolua_err);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int lua_cocos2dx_Node_convertTouchToNodeSpace(lua_State* tolua_S)
|
int lua_cocos2dx_Node_convertTouchToNodeSpace(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
@ -6540,6 +6479,60 @@ int lua_cocos2dx_Node_removeAllChildrenWithCleanup(lua_State* tolua_S)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
int lua_cocos2dx_Node_setOnEnterTransitionDidFinishCallback(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_setOnEnterTransitionDidFinishCallback'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 1)
|
||||||
|
{
|
||||||
|
std::function<void ()> arg0;
|
||||||
|
|
||||||
|
do {
|
||||||
|
// Lambda binding for lua is not supported.
|
||||||
|
assert(false);
|
||||||
|
} while(0)
|
||||||
|
;
|
||||||
|
if(!ok)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Node_setOnEnterTransitionDidFinishCallback'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
cobj->setOnEnterTransitionDidFinishCallback(arg0);
|
||||||
|
lua_settop(tolua_S, 1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:setOnEnterTransitionDidFinishCallback",argc, 1);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_setOnEnterTransitionDidFinishCallback'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
int lua_cocos2dx_Node_setProgramState(lua_State* tolua_S)
|
int lua_cocos2dx_Node_setProgramState(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
@ -8379,6 +8372,53 @@ int lua_cocos2dx_Node_getSkewY(lua_State* tolua_S)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
int lua_cocos2dx_Node_getOnEnterTransitionDidFinishCallback(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_getOnEnterTransitionDidFinishCallback'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 0)
|
||||||
|
{
|
||||||
|
if(!ok)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Node_getOnEnterTransitionDidFinishCallback'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
const std::function<void ()>& ret = cobj->getOnEnterTransitionDidFinishCallback();
|
||||||
|
#pragma warning NO CONVERSION FROM NATIVE FOR std::function;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:getOnEnterTransitionDidFinishCallback",argc, 0);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_getOnEnterTransitionDidFinishCallback'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
int lua_cocos2dx_Node_getDisplayedColor(lua_State* tolua_S)
|
int lua_cocos2dx_Node_getDisplayedColor(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
@ -10931,6 +10971,60 @@ int lua_cocos2dx_Node_getNormalizedPosition(lua_State* tolua_S)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
int lua_cocos2dx_Node_setOnExitTransitionDidStartCallback(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_setOnExitTransitionDidStartCallback'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 1)
|
||||||
|
{
|
||||||
|
std::function<void ()> arg0;
|
||||||
|
|
||||||
|
do {
|
||||||
|
// Lambda binding for lua is not supported.
|
||||||
|
assert(false);
|
||||||
|
} while(0)
|
||||||
|
;
|
||||||
|
if(!ok)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Node_setOnExitTransitionDidStartCallback'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
cobj->setOnExitTransitionDidStartCallback(arg0);
|
||||||
|
lua_settop(tolua_S, 1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:setOnExitTransitionDidStartCallback",argc, 1);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_setOnExitTransitionDidStartCallback'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
int lua_cocos2dx_Node_getRotationSkewX(lua_State* tolua_S)
|
int lua_cocos2dx_Node_getRotationSkewX(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
@ -11340,6 +11434,7 @@ int lua_register_cocos2dx_Node(lua_State* tolua_S)
|
||||||
tolua_function(tolua_S,"addChild",lua_cocos2dx_Node_addChild);
|
tolua_function(tolua_S,"addChild",lua_cocos2dx_Node_addChild);
|
||||||
tolua_function(tolua_S,"removeComponent",lua_cocos2dx_Node_removeComponent);
|
tolua_function(tolua_S,"removeComponent",lua_cocos2dx_Node_removeComponent);
|
||||||
tolua_function(tolua_S,"setPhysicsBody",lua_cocos2dx_Node_setPhysicsBody);
|
tolua_function(tolua_S,"setPhysicsBody",lua_cocos2dx_Node_setPhysicsBody);
|
||||||
|
tolua_function(tolua_S,"getOnExitTransitionDidStartCallback",lua_cocos2dx_Node_getOnExitTransitionDidStartCallback);
|
||||||
tolua_function(tolua_S,"getDescription",lua_cocos2dx_Node_getDescription);
|
tolua_function(tolua_S,"getDescription",lua_cocos2dx_Node_getDescription);
|
||||||
tolua_function(tolua_S,"setRotationSkewY",lua_cocos2dx_Node_setRotationSkewY);
|
tolua_function(tolua_S,"setRotationSkewY",lua_cocos2dx_Node_setRotationSkewY);
|
||||||
tolua_function(tolua_S,"setOpacityModifyRGB",lua_cocos2dx_Node_setOpacityModifyRGB);
|
tolua_function(tolua_S,"setOpacityModifyRGB",lua_cocos2dx_Node_setOpacityModifyRGB);
|
||||||
|
@ -11358,7 +11453,6 @@ int lua_register_cocos2dx_Node(lua_State* tolua_S)
|
||||||
tolua_function(tolua_S,"setScaleY",lua_cocos2dx_Node_setScaleY);
|
tolua_function(tolua_S,"setScaleY",lua_cocos2dx_Node_setScaleY);
|
||||||
tolua_function(tolua_S,"setScaleX",lua_cocos2dx_Node_setScaleX);
|
tolua_function(tolua_S,"setScaleX",lua_cocos2dx_Node_setScaleX);
|
||||||
tolua_function(tolua_S,"setRotationSkewX",lua_cocos2dx_Node_setRotationSkewX);
|
tolua_function(tolua_S,"setRotationSkewX",lua_cocos2dx_Node_setRotationSkewX);
|
||||||
tolua_function(tolua_S,"setonEnterTransitionDidFinishCallback",lua_cocos2dx_Node_setonEnterTransitionDidFinishCallback);
|
|
||||||
tolua_function(tolua_S,"removeAllComponents",lua_cocos2dx_Node_removeAllComponents);
|
tolua_function(tolua_S,"removeAllComponents",lua_cocos2dx_Node_removeAllComponents);
|
||||||
tolua_function(tolua_S,"_setLocalZOrder",lua_cocos2dx_Node__setLocalZOrder);
|
tolua_function(tolua_S,"_setLocalZOrder",lua_cocos2dx_Node__setLocalZOrder);
|
||||||
tolua_function(tolua_S,"setCameraMask",lua_cocos2dx_Node_setCameraMask);
|
tolua_function(tolua_S,"setCameraMask",lua_cocos2dx_Node_setCameraMask);
|
||||||
|
@ -11375,9 +11469,9 @@ int lua_register_cocos2dx_Node(lua_State* tolua_S)
|
||||||
tolua_function(tolua_S,"setOnEnterCallback",lua_cocos2dx_Node_setOnEnterCallback);
|
tolua_function(tolua_S,"setOnEnterCallback",lua_cocos2dx_Node_setOnEnterCallback);
|
||||||
tolua_function(tolua_S,"stopActionsByFlags",lua_cocos2dx_Node_stopActionsByFlags);
|
tolua_function(tolua_S,"stopActionsByFlags",lua_cocos2dx_Node_stopActionsByFlags);
|
||||||
tolua_function(tolua_S,"setNormalizedPosition",lua_cocos2dx_Node_setNormalizedPosition);
|
tolua_function(tolua_S,"setNormalizedPosition",lua_cocos2dx_Node_setNormalizedPosition);
|
||||||
tolua_function(tolua_S,"setonExitTransitionDidStartCallback",lua_cocos2dx_Node_setonExitTransitionDidStartCallback);
|
|
||||||
tolua_function(tolua_S,"convertTouchToNodeSpace",lua_cocos2dx_Node_convertTouchToNodeSpace);
|
tolua_function(tolua_S,"convertTouchToNodeSpace",lua_cocos2dx_Node_convertTouchToNodeSpace);
|
||||||
tolua_function(tolua_S,"removeAllChildren",lua_cocos2dx_Node_removeAllChildrenWithCleanup);
|
tolua_function(tolua_S,"removeAllChildren",lua_cocos2dx_Node_removeAllChildrenWithCleanup);
|
||||||
|
tolua_function(tolua_S,"setOnEnterTransitionDidFinishCallback",lua_cocos2dx_Node_setOnEnterTransitionDidFinishCallback);
|
||||||
tolua_function(tolua_S,"setProgramState",lua_cocos2dx_Node_setProgramState);
|
tolua_function(tolua_S,"setProgramState",lua_cocos2dx_Node_setProgramState);
|
||||||
tolua_function(tolua_S,"getNodeToParentAffineTransform",lua_cocos2dx_Node_getNodeToParentAffineTransform);
|
tolua_function(tolua_S,"getNodeToParentAffineTransform",lua_cocos2dx_Node_getNodeToParentAffineTransform);
|
||||||
tolua_function(tolua_S,"isCascadeOpacityEnabled",lua_cocos2dx_Node_isCascadeOpacityEnabled);
|
tolua_function(tolua_S,"isCascadeOpacityEnabled",lua_cocos2dx_Node_isCascadeOpacityEnabled);
|
||||||
|
@ -11415,6 +11509,7 @@ int lua_register_cocos2dx_Node(lua_State* tolua_S)
|
||||||
tolua_function(tolua_S,"stopAllActions",lua_cocos2dx_Node_stopAllActions);
|
tolua_function(tolua_S,"stopAllActions",lua_cocos2dx_Node_stopAllActions);
|
||||||
tolua_function(tolua_S,"getSkewX",lua_cocos2dx_Node_getSkewX);
|
tolua_function(tolua_S,"getSkewX",lua_cocos2dx_Node_getSkewX);
|
||||||
tolua_function(tolua_S,"getSkewY",lua_cocos2dx_Node_getSkewY);
|
tolua_function(tolua_S,"getSkewY",lua_cocos2dx_Node_getSkewY);
|
||||||
|
tolua_function(tolua_S,"getOnEnterTransitionDidFinishCallback",lua_cocos2dx_Node_getOnEnterTransitionDidFinishCallback);
|
||||||
tolua_function(tolua_S,"getDisplayedColor",lua_cocos2dx_Node_getDisplayedColor);
|
tolua_function(tolua_S,"getDisplayedColor",lua_cocos2dx_Node_getDisplayedColor);
|
||||||
tolua_function(tolua_S,"getActionByTag",lua_cocos2dx_Node_getActionByTag);
|
tolua_function(tolua_S,"getActionByTag",lua_cocos2dx_Node_getActionByTag);
|
||||||
tolua_function(tolua_S,"setName",lua_cocos2dx_Node_setName);
|
tolua_function(tolua_S,"setName",lua_cocos2dx_Node_setName);
|
||||||
|
@ -11467,6 +11562,7 @@ int lua_register_cocos2dx_Node(lua_State* tolua_S)
|
||||||
tolua_function(tolua_S,"getOpacity",lua_cocos2dx_Node_getOpacity);
|
tolua_function(tolua_S,"getOpacity",lua_cocos2dx_Node_getOpacity);
|
||||||
tolua_function(tolua_S,"updateOrderOfArrival",lua_cocos2dx_Node_updateOrderOfArrival);
|
tolua_function(tolua_S,"updateOrderOfArrival",lua_cocos2dx_Node_updateOrderOfArrival);
|
||||||
tolua_function(tolua_S,"getNormalizedPosition",lua_cocos2dx_Node_getNormalizedPosition);
|
tolua_function(tolua_S,"getNormalizedPosition",lua_cocos2dx_Node_getNormalizedPosition);
|
||||||
|
tolua_function(tolua_S,"setOnExitTransitionDidStartCallback",lua_cocos2dx_Node_setOnExitTransitionDidStartCallback);
|
||||||
tolua_function(tolua_S,"getRotationSkewX",lua_cocos2dx_Node_getRotationSkewX);
|
tolua_function(tolua_S,"getRotationSkewX",lua_cocos2dx_Node_getRotationSkewX);
|
||||||
tolua_function(tolua_S,"getRotationSkewY",lua_cocos2dx_Node_getRotationSkewY);
|
tolua_function(tolua_S,"getRotationSkewY",lua_cocos2dx_Node_getRotationSkewY);
|
||||||
tolua_function(tolua_S,"setTag",lua_cocos2dx_Node_setTag);
|
tolua_function(tolua_S,"setTag",lua_cocos2dx_Node_setTag);
|
||||||
|
|
|
@ -2330,6 +2330,8 @@ int register_all_cocos2dx(lua_State* tolua_S);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -196,10 +196,10 @@ void EditBoxImplMac::setNativeVisible(bool visible)
|
||||||
void EditBoxImplMac::updateNativeFrame(const cocos2d::Rect &rect)
|
void EditBoxImplMac::updateNativeFrame(const cocos2d::Rect &rect)
|
||||||
{
|
{
|
||||||
GLView* eglView = Director::getInstance()->getOpenGLView();
|
GLView* eglView = Director::getInstance()->getOpenGLView();
|
||||||
auto viewPortRect = eglView->getViewPortRect();
|
auto frameSize = eglView->getFrameSize();
|
||||||
// Coordinate System on OSX has its origin at the lower left corner.
|
// Coordinate System on OSX has its origin at the lower left corner.
|
||||||
// https://developer.apple.com/library/ios/documentation/General/Conceptual/Devpedia-CocoaApp/CoordinateSystem.html
|
// https://developer.apple.com/library/ios/documentation/General/Conceptual/Devpedia-CocoaApp/CoordinateSystem.html
|
||||||
auto screenPosY = viewPortRect.size.height - rect.origin.y - rect.size.height;
|
auto screenPosY = frameSize.height - rect.origin.y - rect.size.height;
|
||||||
[_sysEdit updateFrame:CGRectMake(rect.origin.x,
|
[_sysEdit updateFrame:CGRectMake(rect.origin.x,
|
||||||
screenPosY,
|
screenPosY,
|
||||||
rect.size.width, rect.size.height)];
|
rect.size.width, rect.size.height)];
|
||||||
|
|
|
@ -141,16 +141,22 @@ int createWebViewJNI() {
|
||||||
std::string getUrlStringByFileName(const std::string &fileName) {
|
std::string getUrlStringByFileName(const std::string &fileName) {
|
||||||
// LOGD("error: %s,%d",__func__,__LINE__);
|
// LOGD("error: %s,%d",__func__,__LINE__);
|
||||||
const std::string basePath("file:///android_asset/");
|
const std::string basePath("file:///android_asset/");
|
||||||
std::string fullPath = cocos2d::FileUtils::getInstance()->fullPathForFilename(fileName);
|
|
||||||
const std::string assetsPath("assets/");
|
const std::string assetsPath("assets/");
|
||||||
|
std::string fullPath = cocos2d::FileUtils::getInstance()->fullPathForFilename(fileName);
|
||||||
std::string urlString;
|
std::string urlString;
|
||||||
if (fullPath.find(assetsPath) != std::string::npos) {
|
if (fullPath.empty()) {
|
||||||
urlString = fullPath.replace(fullPath.find_first_of(assetsPath), assetsPath.length(), basePath);
|
return urlString;
|
||||||
} else {
|
|
||||||
urlString = fullPath;
|
|
||||||
}
|
}
|
||||||
|
else if (fullPath[0] == '/') {
|
||||||
|
urlString.append("file://").append(fullPath);
|
||||||
|
}
|
||||||
|
else if (fullPath.find(assetsPath) == 0) {
|
||||||
|
urlString = fullPath.replace(fullPath.find_first_of(assetsPath), assetsPath.length(), assetsPath);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
urlString.append(basePath).append(fullPath);
|
||||||
|
}
|
||||||
|
|
||||||
return urlString;
|
return urlString;
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -183,11 +183,11 @@ function TerrainWalkThru:init()
|
||||||
|
|
||||||
local collisionPoint = cc.vec3(-999,-999,-999)
|
local collisionPoint = cc.vec3(-999,-999,-999)
|
||||||
local ray = cc.Ray:new(nearP, dir)
|
local ray = cc.Ray:new(nearP, dir)
|
||||||
local isInTerrain = true;
|
local isInTerrain = true
|
||||||
isInTerrain, collisionPoint = self._terrain:getIntersectionPoint(ray, collisionPoint)
|
isInTerrain, collisionPoint = self._terrain:getIntersectionPoint(ray, collisionPoint)
|
||||||
|
|
||||||
if( not isInTerrain) then
|
if( not isInTerrain) then
|
||||||
self._player:idle()
|
self._player._playerState = PLAER_STATE.IDLE
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -220,34 +220,16 @@ function TerrainWalkThru:init()
|
||||||
local dir = cc.vec3sub(farP, nearP)
|
local dir = cc.vec3sub(farP, nearP)
|
||||||
dir = cc.vec3normalize(dir)
|
dir = cc.vec3normalize(dir)
|
||||||
|
|
||||||
local rayStep = cc.vec3mul(dir, 15)
|
local collisionPoint = cc.vec3(-999,-999,-999)
|
||||||
local rayPos = nearP
|
local ray = cc.Ray:new(nearP, dir)
|
||||||
local rayStartPosition = nearP
|
local isInTerrain = true
|
||||||
local lastRayPosition = rayPos
|
isInTerrain, collisionPoint = self._terrain:getIntersectionPoint(ray, collisionPoint)
|
||||||
rayPos = cc.vec3add(rayPos, rayStep)
|
|
||||||
-- Linear search - Loop until find a point inside and outside the terrain Vector3
|
|
||||||
local height = self._terrain:getHeight(rayPos.x, rayPos.z)
|
|
||||||
|
|
||||||
while rayPos.y > height do
|
if( not isInTerrain) then
|
||||||
lastRayPosition = rayPos
|
self._player._playerState = PLAER_STATE.IDLE
|
||||||
rayPos = cc.vec3add(rayPos, rayStep)
|
return
|
||||||
height = self._terrain:getHeight(rayPos.x,rayPos.z)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local startPosition = lastRayPosition
|
|
||||||
local endPosition = rayPos
|
|
||||||
|
|
||||||
for i = 1, 32 do
|
|
||||||
-- Binary search pass
|
|
||||||
local middlePoint = cc.vec3mul(cc.vec3add(startPosition, endPosition), 0.5)
|
|
||||||
if (middlePoint.y < height) then
|
|
||||||
endPosition = middlePoint
|
|
||||||
else
|
|
||||||
startPosition = middlePoint
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local collisionPoint = cc.vec3mul(cc.vec3add(startPosition, endPosition), 0.5)
|
|
||||||
local playerPos = self._player:getPosition3D()
|
local playerPos = self._player:getPosition3D()
|
||||||
dir = cc.vec3sub(collisionPoint, playerPos)
|
dir = cc.vec3sub(collisionPoint, playerPos)
|
||||||
dir.y = 0
|
dir.y = 0
|
||||||
|
|
Loading…
Reference in New Issue