mirror of https://github.com/axmolengine/axmol.git
Merge pull request #7309 from mannewalis/v3
changes needed for swift bindings to work
This commit is contained in:
commit
5ff83d1a2b
|
@ -1305,6 +1305,9 @@ Mat4 Node::transform(const Mat4& parentTransform)
|
|||
|
||||
void Node::onEnter()
|
||||
{
|
||||
if (_onEnterCallback)
|
||||
_onEnterCallback();
|
||||
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
if (_scriptType == kScriptTypeJavascript)
|
||||
{
|
||||
|
@ -1332,6 +1335,9 @@ void Node::onEnter()
|
|||
|
||||
void Node::onEnterTransitionDidFinish()
|
||||
{
|
||||
if (_onEnterTransitionDidFinishCallback)
|
||||
_onEnterTransitionDidFinishCallback();
|
||||
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
if (_scriptType == kScriptTypeJavascript)
|
||||
{
|
||||
|
@ -1354,6 +1360,9 @@ void Node::onEnterTransitionDidFinish()
|
|||
|
||||
void Node::onExitTransitionDidStart()
|
||||
{
|
||||
if (_onExitTransitionDidStartCallback)
|
||||
_onExitTransitionDidStartCallback();
|
||||
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
if (_scriptType == kScriptTypeJavascript)
|
||||
{
|
||||
|
@ -1375,6 +1384,9 @@ void Node::onExitTransitionDidStart()
|
|||
|
||||
void Node::onExit()
|
||||
{
|
||||
if (_onExitCallback)
|
||||
_onExitCallback();
|
||||
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
if (_scriptType == kScriptTypeJavascript)
|
||||
{
|
||||
|
|
|
@ -1466,7 +1466,16 @@ public:
|
|||
|
||||
virtual void setOpacityModifyRGB(bool value) {CC_UNUSED_PARAM(value);}
|
||||
virtual bool isOpacityModifyRGB() const { return false; };
|
||||
|
||||
|
||||
void setOnEnterCallback(const std::function<void()>& callback) { _onEnterCallback = callback; }
|
||||
const std::function<void()>& getOnEnterCallback() const { return _onEnterCallback; }
|
||||
void setOnExitCallback(const std::function<void()>& callback) { _onExitCallback = callback; }
|
||||
const std::function<void()>& getOnExitCallback() const { return _onExitCallback; }
|
||||
void setonEnterTransitionDidFinishCallback(const std::function<void()>& callback) { _onEnterTransitionDidFinishCallback = callback; }
|
||||
const std::function<void()>& getonEnterTransitionDidFinishCallback() const { return _onEnterTransitionDidFinishCallback; }
|
||||
void setonExitTransitionDidStartCallback(const std::function<void()>& callback) { _onExitTransitionDidStartCallback = callback; }
|
||||
const std::function<void()>& getonExitTransitionDidStartCallback() const { return _onExitTransitionDidStartCallback; }
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
// Nodes should be created using create();
|
||||
Node();
|
||||
|
@ -1605,6 +1614,11 @@ protected:
|
|||
|
||||
static int s_globalOrderOfArrival;
|
||||
|
||||
std::function<void()> _onEnterCallback;
|
||||
std::function<void()> _onExitCallback;
|
||||
std::function<void()> _onEnterTransitionDidFinishCallback;
|
||||
std::function<void()> _onExitTransitionDidStartCallback;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Node);
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ typedef SSIZE_T ssize_t;
|
|||
#include <mutex>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "base/CCRef.h"
|
||||
#include "base/ccMacros.h"
|
||||
#include "base/CCPlatformMacros.h"
|
||||
|
||||
|
@ -73,6 +74,7 @@ void CC_DLL log(const char * format, ...) CC_FORMAT_PRINTF(1, 2);
|
|||
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
|
||||
class CC_DLL Console
|
||||
: public Ref
|
||||
{
|
||||
public:
|
||||
struct Command {
|
||||
|
|
|
@ -46,6 +46,7 @@ Ref::Ref()
|
|||
static unsigned int uObjectCount = 0;
|
||||
_luaID = 0;
|
||||
_ID = ++uObjectCount;
|
||||
_scriptObject = nullptr;
|
||||
#endif
|
||||
|
||||
#if CC_USE_MEM_LEAK_DETECTION
|
||||
|
|
|
@ -142,6 +142,8 @@ public:
|
|||
unsigned int _ID;
|
||||
/// Lua reference id
|
||||
int _luaID;
|
||||
/// scriptObject, support for swift
|
||||
void* _scriptObject;
|
||||
#endif
|
||||
|
||||
// Memory leak diagnostic data (only included when CC_USE_MEM_LEAK_DETECTION is defined and its value isn't zero)
|
||||
|
|
|
@ -33,6 +33,7 @@ THE SOFTWARE.
|
|||
#include "math/CCGeometry.h"
|
||||
#include "math/CCMath.h"
|
||||
#include "CCGL.h"
|
||||
#include "CCRef.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -484,6 +485,7 @@ public:
|
|||
@brief The device accelerometer reports values for each axis in units of g-force
|
||||
*/
|
||||
class Acceleration
|
||||
: public Ref
|
||||
{
|
||||
public:
|
||||
double x;
|
||||
|
|
Loading…
Reference in New Issue