2016년 1월 1일 금요일

Cocos2d-x CC_CALLBACK_0, Callback functions


Cocos2d-x has callback functions like

CC_CALLBACK_0
CC_CALLBACK_1
CC_CALLBACK_2
CC_CALLBACK_3

these functions are defined functions.

// new callbacks based on C++11 #define CC_CALLBACK_0(__selector__,__target__, ...) std::bind(&__selector__,__target__, ##__VA_ARGS__)
#define CC_CALLBACK_1(__selector__,__target__, ...) std::bind(&__selector__,__target__, std::placeholders::_1, ##__VA_ARGS__)
#define CC_CALLBACK_2(__selector__,__target__, ...) std::bind(&__selector__,__target__, std::placeholders::_1, std::placeholders::_2, ##__VA_ARGS__)
#define CC_CALLBACK_3(__selector__,__target__, ...) std::bind(&__selector__,__target__, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, ##__VA_ARGS__)

CC_CALLBACK_(N) function N means, the number of callback function pass parameters.

CC_CALLBACK_0 function: pass no parameter.
CC_CALLBACK_1 function: pass one parameter.
CC_CALLBACK_2 function: pass two parameter.

example code)
https://gist.github.com/pineoc/ca43124d321acb21486d

CC_CALLBACK_3 function: pass three parameter.
example code)
http://www.cocos2d-x.org/wiki/Game_Controller


댓글 없음:

댓글 쓰기

JIRA Plugin - ScriptRunner 소개 #2

관련 글 소개 #1:  https://pineoc.blogspot.com/2019/03/scriptrunner-1.html ScriptRunner 소개 #2 지난 글에서는 Behaviours를 보았고 다음 내용인 콘솔, 리스너 등을 ...