I’ve added an extern to the LaunchAndroid.cpp code that compiles into the UE4 native library.
extern "C"
{
bool isPressed(int playerNum, int keyCode)
{
//omitted for example sake
return false;
}
}
And then I’ve added C++ code to the Flappy Chicken project that I want to have call the extern in the UE4 native library.
// Fill out your copyright notice in the Description page of Project Settings.
#include "TappyChicken.h"
#include "OuyaSDK.h"
#if PLATFORM_ANDROID
extern "C" bool isPressed(int playerNum, int keyCode);
#endif
AOuyaSDK::AOuyaSDK(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
}
bool AOuyaSDK::OuyaGetButton(int32 playerNum, int32 button)
{
#if PLATFORM_ANDROID
return isPressed(playerNum, button);
#else
return false;
#endif
}
I’m wondering what the best way is to write ‘Android’ platform code from your Actor C++ code.
Is the PLATFORM_ANDROID check going to compile in the code I’ve added when I publish to the Android platform?
Or is there an alternative way to communicate with native methods from Actor code?