From 0f6e2ca3688ea3e7ee46462e64aea73369e62328 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Mon, 8 Jan 2024 17:41:03 +0900 Subject: [PATCH] Add new callback binder forFrameUpdateInterface with return value Change-Id: I0788438ff7d5bc22416cef0df5ec2e686c0cfaaa Signed-off-by: Eunki, Hong --- dali-csharp-binder/common/dali-wrap.cpp | 31 +++++++++++++++++++++++++++---- dali-csharp-binder/common/dali-wrap.h | 3 +++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/dali-csharp-binder/common/dali-wrap.cpp b/dali-csharp-binder/common/dali-wrap.cpp index 2cdb932..5dfb663 100644 --- a/dali-csharp-binder/common/dali-wrap.cpp +++ b/dali-csharp-binder/common/dali-wrap.cpp @@ -1976,7 +1976,8 @@ void SwigDirector_CustomAlgorithmInterface::swig_init_callbacks() { } SwigDirector_FrameCallbackInterface::SwigDirector_FrameCallbackInterface() : Dali::FrameCallbackInterface(), Swig::Director() { - swig_callbackOnUpdate = 0; + swig_callbackOnUpdate = nullptr; + swig_callbackOnUpdateWithReturn = nullptr; } SwigDirector_FrameCallbackInterface::~SwigDirector_FrameCallbackInterface() { @@ -1985,24 +1986,39 @@ SwigDirector_FrameCallbackInterface::~SwigDirector_FrameCallbackInterface() { void SwigDirector_FrameCallbackInterface::swig_connect_director(SWIG_Callback0_t callbackUpdate) { swig_callbackOnUpdate = callbackUpdate; + swig_callbackOnUpdateWithReturn = nullptr; } +void SwigDirector_FrameCallbackInterface::swig_connect_director_with_return(SWIG_Callback1_t callbackUpdate) { + swig_callbackOnUpdateWithReturn = callbackUpdate; + swig_callbackOnUpdate = nullptr; +} bool SwigDirector_FrameCallbackInterface::Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) { void * jcurrent ; + bool jresult = false; - if (!swig_callbackOnUpdate) { + if (!swig_callbackOnUpdate && !swig_callbackOnUpdateWithReturn) { throw Swig::DirectorPureVirtualException("Dali::FrameCallbackInterface::Update"); } else { Dali::UpdateProxy* proxy = &updateProxy; jcurrent = (void *)proxy; - swig_callbackOnUpdate(jcurrent, elapsedSeconds); + + if(swig_callbackOnUpdateWithReturn) + { + jresult = swig_callbackOnUpdateWithReturn(jcurrent, elapsedSeconds); + } + else + { + swig_callbackOnUpdate(jcurrent, elapsedSeconds); + } + if (!jcurrent) { DALI_LOG_ERROR("[ERROR][%s line:%d] Unexpected null return for type Dali::UpdateProxy! ", __FILE__, __LINE__); return false; } } - return false; + return jresult; } @@ -25001,6 +25017,13 @@ SWIGEXPORT void SWIGSTDCALL CSharp_Dali_FrameCallbackInterface_director_connect( } } +SWIGEXPORT void SWIGSTDCALL CSharp_Dali_FrameCallbackInterface_director_connect_with_return(void *objarg, SwigDirector_FrameCallbackInterface::SWIG_Callback1_t callback1) { + Dali::FrameCallbackInterface *obj = (Dali::FrameCallbackInterface *)objarg; + SwigDirector_FrameCallbackInterface *director = dynamic_cast(obj); + if (director) { + director->swig_connect_director_with_return(callback1); + } +} SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_new_FrameCallbackInterface() { void * jresult ; diff --git a/dali-csharp-binder/common/dali-wrap.h b/dali-csharp-binder/common/dali-wrap.h index 8b40df0..fb4765f 100755 --- a/dali-csharp-binder/common/dali-wrap.h +++ b/dali-csharp-binder/common/dali-wrap.h @@ -264,9 +264,12 @@ public: typedef void (SWIGSTDCALL* SWIG_Callback0_t)( void* updateProxy, float elapsedSeconds ); void swig_connect_director( SWIG_Callback0_t callbackUpdate ); + typedef bool (SWIGSTDCALL* SWIG_Callback1_t)( void* updateProxy, float elapsedSeconds ); + void swig_connect_director_with_return( SWIG_Callback1_t callbackUpdate ); private: SWIG_Callback0_t swig_callbackOnUpdate; + SWIG_Callback1_t swig_callbackOnUpdateWithReturn; }; #endif -- 2.7.4