I make applications using an engine that generates Xcode or Android Projects and I primarily use Xcode for my projects. However I am looking to use Android Studio for the first time.
In the generated Android Studio project I have a PTServicesBridge
Class where I add my own code for additional features outside the engine. (In this instance I need to adjust a score variable up but 1).
PTServicesBridge Class:
public class PTServicesBridge
public static PTServicesBridge instance() {
if (sInstance == null)
sInstance = new PTServicesBridge();
return sInstance;
}
public static void initBridge(Cocos2dxActivity activity, String appId){
//some initialisations
}
//...
public static void adjustScoreUp(){
//I need to call a function from here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
}
The project includes a main.cpp
file that includes the method I need to call.
Main.cpp
#include "screens/PTPScoreController.h"
using namespace cocos2d;
extern "C"
{
jint JNI_OnLoad(JavaVM *vm, void *reserved){
JniHelper::setJavaVM(vm);
return JNI_VERSION_1_4;
}
//...
void adjustScoreUpNow{
PTPScoreController::scores().points.addCurrent(1); //This method <<<<<<<<<<
}
How can I call the adjustScoreUpNow
from the PTServicesBridge
Class?
Edit: I was told by the engines support to do it this way. I was hoping there was an easy solution to calling the .cpp method from the Java class.