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()
|
void Node::onEnter()
|
||||||
{
|
{
|
||||||
|
if (_onEnterCallback)
|
||||||
|
_onEnterCallback();
|
||||||
|
|
||||||
#if CC_ENABLE_SCRIPT_BINDING
|
#if CC_ENABLE_SCRIPT_BINDING
|
||||||
if (_scriptType == kScriptTypeJavascript)
|
if (_scriptType == kScriptTypeJavascript)
|
||||||
{
|
{
|
||||||
|
@ -1332,6 +1335,9 @@ void Node::onEnter()
|
||||||
|
|
||||||
void Node::onEnterTransitionDidFinish()
|
void Node::onEnterTransitionDidFinish()
|
||||||
{
|
{
|
||||||
|
if (_onEnterTransitionDidFinishCallback)
|
||||||
|
_onEnterTransitionDidFinishCallback();
|
||||||
|
|
||||||
#if CC_ENABLE_SCRIPT_BINDING
|
#if CC_ENABLE_SCRIPT_BINDING
|
||||||
if (_scriptType == kScriptTypeJavascript)
|
if (_scriptType == kScriptTypeJavascript)
|
||||||
{
|
{
|
||||||
|
@ -1354,6 +1360,9 @@ void Node::onEnterTransitionDidFinish()
|
||||||
|
|
||||||
void Node::onExitTransitionDidStart()
|
void Node::onExitTransitionDidStart()
|
||||||
{
|
{
|
||||||
|
if (_onExitTransitionDidStartCallback)
|
||||||
|
_onExitTransitionDidStartCallback();
|
||||||
|
|
||||||
#if CC_ENABLE_SCRIPT_BINDING
|
#if CC_ENABLE_SCRIPT_BINDING
|
||||||
if (_scriptType == kScriptTypeJavascript)
|
if (_scriptType == kScriptTypeJavascript)
|
||||||
{
|
{
|
||||||
|
@ -1375,6 +1384,9 @@ void Node::onExitTransitionDidStart()
|
||||||
|
|
||||||
void Node::onExit()
|
void Node::onExit()
|
||||||
{
|
{
|
||||||
|
if (_onExitCallback)
|
||||||
|
_onExitCallback();
|
||||||
|
|
||||||
#if CC_ENABLE_SCRIPT_BINDING
|
#if CC_ENABLE_SCRIPT_BINDING
|
||||||
if (_scriptType == kScriptTypeJavascript)
|
if (_scriptType == kScriptTypeJavascript)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1467,6 +1467,15 @@ public:
|
||||||
virtual void setOpacityModifyRGB(bool value) {CC_UNUSED_PARAM(value);}
|
virtual void setOpacityModifyRGB(bool value) {CC_UNUSED_PARAM(value);}
|
||||||
virtual bool isOpacityModifyRGB() const { return false; };
|
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:
|
CC_CONSTRUCTOR_ACCESS:
|
||||||
// Nodes should be created using create();
|
// Nodes should be created using create();
|
||||||
Node();
|
Node();
|
||||||
|
@ -1605,6 +1614,11 @@ protected:
|
||||||
|
|
||||||
static int s_globalOrderOfArrival;
|
static int s_globalOrderOfArrival;
|
||||||
|
|
||||||
|
std::function<void()> _onEnterCallback;
|
||||||
|
std::function<void()> _onExitCallback;
|
||||||
|
std::function<void()> _onEnterTransitionDidFinishCallback;
|
||||||
|
std::function<void()> _onExitTransitionDidStartCallback;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Node);
|
CC_DISALLOW_COPY_AND_ASSIGN(Node);
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ typedef SSIZE_T ssize_t;
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#include "base/CCRef.h"
|
||||||
#include "base/ccMacros.h"
|
#include "base/ccMacros.h"
|
||||||
#include "base/CCPlatformMacros.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)
|
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
|
||||||
class CC_DLL Console
|
class CC_DLL Console
|
||||||
|
: public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct Command {
|
struct Command {
|
||||||
|
|
|
@ -46,6 +46,7 @@ Ref::Ref()
|
||||||
static unsigned int uObjectCount = 0;
|
static unsigned int uObjectCount = 0;
|
||||||
_luaID = 0;
|
_luaID = 0;
|
||||||
_ID = ++uObjectCount;
|
_ID = ++uObjectCount;
|
||||||
|
_scriptObject = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CC_USE_MEM_LEAK_DETECTION
|
#if CC_USE_MEM_LEAK_DETECTION
|
||||||
|
|
|
@ -142,6 +142,8 @@ public:
|
||||||
unsigned int _ID;
|
unsigned int _ID;
|
||||||
/// Lua reference id
|
/// Lua reference id
|
||||||
int _luaID;
|
int _luaID;
|
||||||
|
/// scriptObject, support for swift
|
||||||
|
void* _scriptObject;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Memory leak diagnostic data (only included when CC_USE_MEM_LEAK_DETECTION is defined and its value isn't zero)
|
// 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/CCGeometry.h"
|
||||||
#include "math/CCMath.h"
|
#include "math/CCMath.h"
|
||||||
#include "CCGL.h"
|
#include "CCGL.h"
|
||||||
|
#include "CCRef.h"
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
@ -484,6 +485,7 @@ public:
|
||||||
@brief The device accelerometer reports values for each axis in units of g-force
|
@brief The device accelerometer reports values for each axis in units of g-force
|
||||||
*/
|
*/
|
||||||
class Acceleration
|
class Acceleration
|
||||||
|
: public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
double x;
|
double x;
|
||||||
|
|
Loading…
Reference in New Issue