/*
 * JniUtil.h
 *
 *  Created on: 2016-10-19
 *      Author: Administrator
 */

#include "platform/CCApplication.h"
#include "AppDelegate.h"
#include "cocos2d.h"
#include "platform/android/jni/JniHelper.h"
#include <jni.h>
#include <android/log.h>

#ifndef JNIUTIL_H_
#define JNIUTIL_H_

namespace cocos2d {

class JniUtil {
public:
//	static void callJava(const char *methodName,const char *paramCode);
};

extern "C"
{
	void Java_com_duoku_cocosx_demo_JNIHelper_callback(JNIEnv *env , jobject obj , jstring eventType , jint code)
	{
		auto dispatcher = Director::getInstance()->getEventDispatcher();
		std::string eventTypeInCPP = JniHelper::jstring2string(eventType);
		EventCustom event(eventTypeInCPP);
//		event.setUserData(code);
		dispatcher->dispatchEvent(&event);
	}
}

} /* namespace cocos2d */
#endif /* JNIUTIL_H_ */

