일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
- Join
- halliday
- mysql
- 강좌
- android studio
- application.mk
- Post
- mathemetica
- PORTG
- array
- Call
- Get
- is_array
- Avr
- 점점변하는값
- C++
- cocos2d-x
- 0x
- selectc
- 월별 카운트
- 현재언어
- unalias
- 하이퍼 터미널
- 단축키
- solution
- Java
- SQL
- 파일존재
- function
- php
- Today
- Total
목록cocos2d-x (8)
코딩도사의 코드정리
java 에서 C 함수 호출하는건 더 간단하다. java 소스 class MyClass{ ... public static native void putInfo(int param1, String param2); // 구현부는 없음 ... } .c 소스 extern"C"{ void Java_com_hapill_lib_MyClass_putInfo(JNIEnv *env, jobject thiz, int param1, jstring param2) { jboolean isCopy = JNI_FALSE; const char* revStr = env->GetStringUTFChars(param2, &isCopy); env->ReleaseStringUTFChars(param2, revStr); } 만약 native 함수의..
cocos2d-x 에서 java 함수를 부르는 완전한 방법 #if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID #include "platform/android/jni/JniHelper.h" #include "jni.h" #endif JniHelper.h 를 include 한다. 상대경로는 버전마다 다를 수 있으므로 주의. 만약 패키지 이름이 com.hapill.lib.JavaHelper 이고, 그 안의 static function 이 이름이 void javaPrint() 라면 JniMethodInfo t; if (JniHelper::getStaticMethodInfo(t, "com/hapill/lib/JavaHelper", "javaPrint", "()V")) { t.env..
- (void)applicationWillEnterForeground:(UIApplication *)application { [[UIApplication sharedApplication] setIdleTimerDisabled:Yes]; } public Cocos2dxGLSurfaceView onCreateView() { ... ... glSurfaceView.setKeepScreenOn(true); return glSurfaceView; }
#include class KSTimer : public CCNode { protected: std::function f; float m_s; float m_timer; public: virtual ~KSTimer(){} void after() { unscheduleUpdate(); removeFromParent(); f(); } static KSTimer* create(float s, std::function __f) { KSTimer* kt = new KSTimer; kt->init(s, __f); kt->autorelease(); return kt; } bool init(float s, std::function __f) { f = __f; m_s = s; m_timer = 0; scheduleUpd..
template class FromToWithDuration2 { private: T originFrom; T from; T to; float duration; T dx; // bool positive; float flowTime; bool nextTurnIsFinish; public: FromToWithDuration2(){} FromToWithDuration2(T _from, T _to, float _duration) : originFrom(_from), nextTurnIsFinish(false) { nextTurnIsFinish = false; flowTime = 0.f; from = _from; to = _to; duration = _duration; dx = (to - from) / durati..
string getLocalCode() { string tempCode; #if CC_TARGET_PLATFORM == CC_PLATFORM_IOS NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSArray *languages = [defaults objectForKey:@"AppleLanguages"]; NSString *currentLanguage = [languages objectAtIndex:0]; // get the current language code.(such as English is "en", Chinese is "zh" and so on) NSDictionary* temp = [NSLocale componentsF..
bool isExistFile(const std::string& fileName) { return CCFileUtils::sharedFileUtils()->isFileExist(CCFileUtils::sharedFileUtils()->fullPathForFilename(fileName.c_str())); }
void setOpacity(CCObject* object, GLubyte opaque) { CCArray* childs = NULL; CCObject* child = NULL; CCNode* nodeObject = (CCNode*)object; if (nodeObject) { childs = nodeObject->getChildren(); } if (childs) { CCARRAY_FOREACH(childs, child){ CCRGBAProtocol *pRGBAProtocol = dynamic_cast(child); if (pRGBAProtocol) { pRGBAProtocol->setOpacity(opaque); // pRGBAProtocol->setColor(ccc3(opaque, opaque, o..