仓库中添加内置的demo

This commit is contained in:
gongxh
2025-07-28 14:26:19 +08:00
parent 43446f031d
commit 65be0498cc
414 changed files with 14456 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
//
// JniTools.cpp
// kungpowGame
//
// Created by GongXH on 2021/3/26.
//
#include "JniTools.h"
#include "../SDKHelper.h"
#include <jni.h>
#include <android/log.h>
#include <java/jni/JniHelper.h>
#include "application/ApplicationManager.h"
using namespace cc;
#define KUNPO_HELPER "com/kunpo/KunpoHelper"
std::string JniTools::getVersionCode() {
return JniHelper::callStaticStringMethod(KUNPO_HELPER,"getVersionCode");
}
int JniTools::getBuildCode() {
return JniHelper::callStaticIntMethod(KUNPO_HELPER,"getBuildCode");
}
#pragma -mark java回调c++
#if (CC_PLATFORM == CC_PLATFORM_ANDROID)
extern "C"
{
JNIEXPORT void Java_com_kunpo_KunpoHelper_CallJS(JNIEnv* env, jclass thiz, jstring jsjson)
{
std::string json = JniHelper::jstring2string(jsjson);
CC_CURRENT_ENGINE()->getScheduler()->performFunctionInCocosThread([=]() {
KunpoSDK::SDKHelper::getInstance()->callJS(json.c_str());
});
}
}
#endif

View File

@@ -0,0 +1,18 @@
//
// JniTools.hpp
// ZumaGame
//
// Created by GongXH on 2021/3/26.
//
#ifndef JniTools_hpp
#define JniTools_hpp
#include "cocos.h"
class JniTools
{
public:
//调用Java的方法
static std::string getVersionCode();
static int getBuildCode();
};
#endif /* JniTools_hpp */