移除android的加载流程
This commit is contained in:
parent
eb5c0886bd
commit
ab934e73ca
@ -89,16 +89,16 @@ std::shared_ptr<Scheduler> Application::_scheduler = nullptr;
|
|||||||
Application::Application(const std::string& name, int width, int height)
|
Application::Application(const std::string& name, int width, int height)
|
||||||
{
|
{
|
||||||
Application::_instance = this;
|
Application::_instance = this;
|
||||||
Configuration::getInstance();
|
// Configuration::getInstance();
|
||||||
|
|
||||||
_scheduler = std::make_shared<Scheduler>();
|
_scheduler = std::make_shared<Scheduler>();
|
||||||
|
|
||||||
PFNGLGENVERTEXARRAYSOESPROC glGenVertexArraysOESEXT = (PFNGLGENVERTEXARRAYSOESPROC)eglGetProcAddress("glGenVertexArraysOES");
|
// PFNGLGENVERTEXARRAYSOESPROC glGenVertexArraysOESEXT = (PFNGLGENVERTEXARRAYSOESPROC)eglGetProcAddress("glGenVertexArraysOES");
|
||||||
PFNGLBINDVERTEXARRAYOESPROC glBindVertexArrayOESEXT = (PFNGLBINDVERTEXARRAYOESPROC)eglGetProcAddress("glBindVertexArrayOES");
|
// PFNGLBINDVERTEXARRAYOESPROC glBindVertexArrayOESEXT = (PFNGLBINDVERTEXARRAYOESPROC)eglGetProcAddress("glBindVertexArrayOES");
|
||||||
PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArraysOESEXT = (PFNGLDELETEVERTEXARRAYSOESPROC)eglGetProcAddress("glDeleteVertexArraysOES");
|
// PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArraysOESEXT = (PFNGLDELETEVERTEXARRAYSOESPROC)eglGetProcAddress("glDeleteVertexArraysOES");
|
||||||
|
|
||||||
_renderTexture = new RenderTexture(width, height);
|
// _renderTexture = new RenderTexture(width, height);
|
||||||
updateViewSize(width, height);
|
// updateViewSize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application()
|
Application::~Application()
|
||||||
|
@ -37,7 +37,6 @@ import android.content.pm.PackageManager;
|
|||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.content.res.AssetFileDescriptor;
|
import android.content.res.AssetFileDescriptor;
|
||||||
import android.content.res.AssetManager;
|
import android.content.res.AssetManager;
|
||||||
import android.media.AudioManager;
|
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@ -54,11 +53,9 @@ import android.view.Surface;
|
|||||||
import android.view.WindowInsets;
|
import android.view.WindowInsets;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
|
||||||
import com.android.vending.expansion.zipfile.APKExpansionSupport;
|
|
||||||
import com.android.vending.expansion.zipfile.ZipResourceFile;
|
import com.android.vending.expansion.zipfile.ZipResourceFile;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
@ -175,35 +172,35 @@ public class Cocos2dxHelper {
|
|||||||
if (!sInited) {
|
if (!sInited) {
|
||||||
|
|
||||||
PackageManager pm = activity.getPackageManager();
|
PackageManager pm = activity.getPackageManager();
|
||||||
boolean isSupportLowLatency = pm.hasSystemFeature(PackageManager.FEATURE_AUDIO_LOW_LATENCY);
|
// boolean isSupportLowLatency = pm.hasSystemFeature(PackageManager.FEATURE_AUDIO_LOW_LATENCY);
|
||||||
|
|
||||||
Log.d(TAG, "isSupportLowLatency:" + isSupportLowLatency);
|
// Log.d(TAG, "isSupportLowLatency:" + isSupportLowLatency);
|
||||||
|
|
||||||
int sampleRate = 44100;
|
// int sampleRate = 44100;
|
||||||
int bufferSizeInFrames = 192;
|
// int bufferSizeInFrames = 192;
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= 17) {
|
// if (Build.VERSION.SDK_INT >= 17) {
|
||||||
AudioManager am = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
|
// AudioManager am = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
|
||||||
// use reflection to remove dependence of API 17 when compiling
|
// // use reflection to remove dependence of API 17 when compiling
|
||||||
|
//
|
||||||
|
// // AudioManager.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE);
|
||||||
|
// final Class audioManagerClass = AudioManager.class;
|
||||||
|
// Object[] parameters = new Object[]{Cocos2dxReflectionHelper.<String>getConstantValue(audioManagerClass, "PROPERTY_OUTPUT_SAMPLE_RATE")};
|
||||||
|
// final String strSampleRate = Cocos2dxReflectionHelper.<String>invokeInstanceMethod(am, "getProperty", new Class[]{String.class}, parameters);
|
||||||
|
//
|
||||||
|
// // AudioManager.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER);
|
||||||
|
// parameters = new Object[]{Cocos2dxReflectionHelper.<String>getConstantValue(audioManagerClass, "PROPERTY_OUTPUT_FRAMES_PER_BUFFER")};
|
||||||
|
// final String strBufferSizeInFrames = Cocos2dxReflectionHelper.<String>invokeInstanceMethod(am, "getProperty", new Class[]{String.class}, parameters);
|
||||||
|
//
|
||||||
|
// sampleRate = Integer.parseInt(strSampleRate);
|
||||||
|
// bufferSizeInFrames = Integer.parseInt(strBufferSizeInFrames);
|
||||||
|
//
|
||||||
|
// Log.d(TAG, "sampleRate: " + sampleRate + ", framesPerBuffer: " + bufferSizeInFrames);
|
||||||
|
// } else {
|
||||||
|
// Log.d(TAG, "android version is lower than 17");
|
||||||
|
// }
|
||||||
|
|
||||||
// AudioManager.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE);
|
// nativeSetAudioDeviceInfo(isSupportLowLatency, sampleRate, bufferSizeInFrames);
|
||||||
final Class audioManagerClass = AudioManager.class;
|
|
||||||
Object[] parameters = new Object[]{Cocos2dxReflectionHelper.<String>getConstantValue(audioManagerClass, "PROPERTY_OUTPUT_SAMPLE_RATE")};
|
|
||||||
final String strSampleRate = Cocos2dxReflectionHelper.<String>invokeInstanceMethod(am, "getProperty", new Class[]{String.class}, parameters);
|
|
||||||
|
|
||||||
// AudioManager.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER);
|
|
||||||
parameters = new Object[]{Cocos2dxReflectionHelper.<String>getConstantValue(audioManagerClass, "PROPERTY_OUTPUT_FRAMES_PER_BUFFER")};
|
|
||||||
final String strBufferSizeInFrames = Cocos2dxReflectionHelper.<String>invokeInstanceMethod(am, "getProperty", new Class[]{String.class}, parameters);
|
|
||||||
|
|
||||||
sampleRate = Integer.parseInt(strSampleRate);
|
|
||||||
bufferSizeInFrames = Integer.parseInt(strBufferSizeInFrames);
|
|
||||||
|
|
||||||
Log.d(TAG, "sampleRate: " + sampleRate + ", framesPerBuffer: " + bufferSizeInFrames);
|
|
||||||
} else {
|
|
||||||
Log.d(TAG, "android version is lower than 17");
|
|
||||||
}
|
|
||||||
|
|
||||||
nativeSetAudioDeviceInfo(isSupportLowLatency, sampleRate, bufferSizeInFrames);
|
|
||||||
|
|
||||||
final ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
final ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
||||||
|
|
||||||
@ -212,10 +209,10 @@ public class Cocos2dxHelper {
|
|||||||
|
|
||||||
Cocos2dxHelper.nativeSetApkPath(Cocos2dxHelper.getAssetsPath());
|
Cocos2dxHelper.nativeSetApkPath(Cocos2dxHelper.getAssetsPath());
|
||||||
|
|
||||||
Cocos2dxHelper.sCocos2dxAccelerometer = new Cocos2dxAccelerometer(activity);
|
// Cocos2dxHelper.sCocos2dxAccelerometer = new Cocos2dxAccelerometer(activity);
|
||||||
Cocos2dxHelper.sAssetManager = activity.getAssets();
|
Cocos2dxHelper.sAssetManager = activity.getAssets();
|
||||||
Cocos2dxHelper.nativeSetContext((Context)activity, Cocos2dxHelper.sAssetManager);
|
Cocos2dxHelper.nativeSetContext((Context)activity, Cocos2dxHelper.sAssetManager);
|
||||||
Cocos2dxHelper.sVibrateService = (Vibrator)activity.getSystemService(Context.VIBRATOR_SERVICE);
|
// Cocos2dxHelper.sVibrateService = (Vibrator)activity.getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
|
|
||||||
sInited = true;
|
sInited = true;
|
||||||
|
|
||||||
@ -338,31 +335,31 @@ public class Cocos2dxHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void vibrate(float duration) {
|
public static void vibrate(float duration) {
|
||||||
try {
|
// try {
|
||||||
if (sVibrateService != null && sVibrateService.hasVibrator()) {
|
// if (sVibrateService != null && sVibrateService.hasVibrator()) {
|
||||||
if (android.os.Build.VERSION.SDK_INT >= 26) {
|
// if (android.os.Build.VERSION.SDK_INT >= 26) {
|
||||||
Class<?> vibrationEffectClass = Class.forName("android.os.VibrationEffect");
|
// Class<?> vibrationEffectClass = Class.forName("android.os.VibrationEffect");
|
||||||
if(vibrationEffectClass != null) {
|
// if(vibrationEffectClass != null) {
|
||||||
final int DEFAULT_AMPLITUDE = Cocos2dxReflectionHelper.<Integer>getConstantValue(vibrationEffectClass,
|
// final int DEFAULT_AMPLITUDE = Cocos2dxReflectionHelper.<Integer>getConstantValue(vibrationEffectClass,
|
||||||
"DEFAULT_AMPLITUDE");
|
// "DEFAULT_AMPLITUDE");
|
||||||
//VibrationEffect.createOneShot(long milliseconds, int amplitude)
|
// //VibrationEffect.createOneShot(long milliseconds, int amplitude)
|
||||||
final Method method = vibrationEffectClass.getMethod("createOneShot",
|
// final Method method = vibrationEffectClass.getMethod("createOneShot",
|
||||||
new Class[]{Long.TYPE, Integer.TYPE});
|
// new Class[]{Long.TYPE, Integer.TYPE});
|
||||||
Class<?> type = method.getReturnType();
|
// Class<?> type = method.getReturnType();
|
||||||
|
//
|
||||||
Object effect = method.invoke(vibrationEffectClass,
|
// Object effect = method.invoke(vibrationEffectClass,
|
||||||
new Object[]{(long) (duration * 1000), DEFAULT_AMPLITUDE});
|
// new Object[]{(long) (duration * 1000), DEFAULT_AMPLITUDE});
|
||||||
//sVibrateService.vibrate(VibrationEffect effect);
|
// //sVibrateService.vibrate(VibrationEffect effect);
|
||||||
Cocos2dxReflectionHelper.invokeInstanceMethod(sVibrateService,"vibrate",
|
// Cocos2dxReflectionHelper.invokeInstanceMethod(sVibrateService,"vibrate",
|
||||||
new Class[]{type}, new Object[]{(effect)});
|
// new Class[]{type}, new Object[]{(effect)});
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
sVibrateService.vibrate((long) (duration * 1000));
|
// sVibrateService.vibrate((long) (duration * 1000));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getVersion() {
|
public static String getVersion() {
|
||||||
|
@ -45,6 +45,11 @@
|
|||||||
#endif
|
#endif
|
||||||
#define JNI_RENDER(FUNC) JNI_METHOD1(ORG_RENDER_CLASS_NAME,FUNC)
|
#define JNI_RENDER(FUNC) JNI_METHOD1(ORG_RENDER_CLASS_NAME,FUNC)
|
||||||
|
|
||||||
|
#ifndef ORG_JS_HELPER_CLASS_NAME
|
||||||
|
#define ORG_JS_HELPER_CLASS_NAME org_cocos2dx_lib_CocosJSHelper
|
||||||
|
#endif
|
||||||
|
#define JNI_JS_HELPER(FUNC) JNI_METHOD1(ORG_JS_HELPER_CLASS_NAME,FUNC)
|
||||||
|
|
||||||
|
|
||||||
#ifndef ORG_ACTIVITY_CLASS_NAME
|
#ifndef ORG_ACTIVITY_CLASS_NAME
|
||||||
#define ORG_ACTIVITY_CLASS_NAME org_cocos2dx_lib_Cocos2dxActivity
|
#define ORG_ACTIVITY_CLASS_NAME org_cocos2dx_lib_Cocos2dxActivity
|
||||||
@ -159,7 +164,7 @@ extern "C"
|
|||||||
* Cocos2dxActivity native functions implementation.
|
* Cocos2dxActivity native functions implementation.
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
|
|
||||||
JNIEXPORT jintArray JNICALL JNI_ACTIVITY(getGLContextAttrs)(JNIEnv* env, jobject thiz)
|
JNIEXPORT jintArray JNICALL JNI_ACTIVITY(getGLContextAttrs)(JNIEnv* env, jclass thiz)
|
||||||
{
|
{
|
||||||
//REFINE
|
//REFINE
|
||||||
int tmp[7] = {8, 8, 8,
|
int tmp[7] = {8, 8, 8,
|
||||||
@ -174,7 +179,7 @@ extern "C"
|
|||||||
* Cocos2dxRenderer native functions implementation.
|
* Cocos2dxRenderer native functions implementation.
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
|
|
||||||
JNIEXPORT void JNICALL JNI_RENDER(nativeInit)(JNIEnv* env, jobject thiz, jint w, jint h, jstring jDefaultResourcePath)
|
JNIEXPORT void JNICALL JNI_RENDER(nativeInit)(JNIEnv* env, jclass thiz, jint w, jint h, jstring jDefaultResourcePath)
|
||||||
{
|
{
|
||||||
g_width = w;
|
g_width = w;
|
||||||
g_height = h;
|
g_height = h;
|
||||||
@ -298,12 +303,12 @@ extern "C"
|
|||||||
g_app->onResume();
|
g_app->onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL JNI_RENDER(nativeInsertText)(JNIEnv* env, jobject thiz, jstring text)
|
JNIEXPORT void JNICALL JNI_RENDER(nativeInsertText)(JNIEnv* env, jclass thiz, jstring text)
|
||||||
{
|
{
|
||||||
//REFINE
|
//REFINE
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL JNI_RENDER(nativeDeleteBackward)(JNIEnv* env, jobject thiz)
|
JNIEXPORT void JNICALL JNI_RENDER(nativeDeleteBackward)(JNIEnv* env, jclass thiz)
|
||||||
{
|
{
|
||||||
//REFINE
|
//REFINE
|
||||||
}
|
}
|
||||||
@ -313,7 +318,7 @@ extern "C"
|
|||||||
//REFINE
|
//REFINE
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL JNI_RENDER(nativeOnSurfaceChanged)(JNIEnv* env, jobject thiz, jint w, jint h)
|
JNIEXPORT void JNICALL JNI_RENDER(nativeOnSurfaceChanged)(JNIEnv* env, jclass thiz, jint w, jint h)
|
||||||
{
|
{
|
||||||
//REFINE
|
//REFINE
|
||||||
}
|
}
|
||||||
@ -322,7 +327,7 @@ extern "C"
|
|||||||
* Cocos2dxAccelerometer native functions implementation.
|
* Cocos2dxAccelerometer native functions implementation.
|
||||||
***********************************************************/
|
***********************************************************/
|
||||||
|
|
||||||
JNIEXPORT void JNICALL JNI_ACCELEROMETER(onSensorChanged)(JNIEnv* env, jobject thiz, jfloat x, jfloat y, jfloat z, jlong timeStamp)
|
JNIEXPORT void JNICALL JNI_ACCELEROMETER(onSensorChanged)(JNIEnv* env, jclass thiz, jfloat x, jfloat y, jfloat z, jlong timeStamp)
|
||||||
{
|
{
|
||||||
//REFINE
|
//REFINE
|
||||||
}
|
}
|
||||||
@ -379,7 +384,7 @@ extern "C"
|
|||||||
cocos2d::EventDispatcher::dispatchTouchEvent(touchEvent);
|
cocos2d::EventDispatcher::dispatchTouchEvent(touchEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL JNI_RENDER(nativeTouchesBegin)(JNIEnv * env, jobject thiz, jint id, jfloat x, jfloat y)
|
JNIEXPORT void JNICALL JNI_RENDER(nativeTouchesBegin)(JNIEnv * env, jclass thiz, jint id, jfloat x, jfloat y)
|
||||||
{
|
{
|
||||||
if (g_isGameFinished) {
|
if (g_isGameFinished) {
|
||||||
return;
|
return;
|
||||||
@ -387,7 +392,7 @@ extern "C"
|
|||||||
dispatchTouchEventWithOnePoint(env, cocos2d::TouchEvent::Type::BEGAN, id, x, y);
|
dispatchTouchEventWithOnePoint(env, cocos2d::TouchEvent::Type::BEGAN, id, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL JNI_RENDER(nativeTouchesEnd)(JNIEnv * env, jobject thiz, jint id, jfloat x, jfloat y)
|
JNIEXPORT void JNICALL JNI_RENDER(nativeTouchesEnd)(JNIEnv * env, jclass thiz, jint id, jfloat x, jfloat y)
|
||||||
{
|
{
|
||||||
if (g_isGameFinished) {
|
if (g_isGameFinished) {
|
||||||
return;
|
return;
|
||||||
@ -395,7 +400,7 @@ extern "C"
|
|||||||
dispatchTouchEventWithOnePoint(env, cocos2d::TouchEvent::Type::ENDED, id, x, y);
|
dispatchTouchEventWithOnePoint(env, cocos2d::TouchEvent::Type::ENDED, id, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL JNI_RENDER(nativeTouchesMove)(JNIEnv * env, jobject thiz, jintArray ids, jfloatArray xs, jfloatArray ys)
|
JNIEXPORT void JNICALL JNI_RENDER(nativeTouchesMove)(JNIEnv * env, jclass thiz, jintArray ids, jfloatArray xs, jfloatArray ys)
|
||||||
{
|
{
|
||||||
if (g_isGameFinished) {
|
if (g_isGameFinished) {
|
||||||
return;
|
return;
|
||||||
@ -403,7 +408,7 @@ extern "C"
|
|||||||
dispatchTouchEventWithPoints(env, cocos2d::TouchEvent::Type::MOVED, ids, xs, ys);
|
dispatchTouchEventWithPoints(env, cocos2d::TouchEvent::Type::MOVED, ids, xs, ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL JNI_RENDER(nativeTouchesCancel)(JNIEnv * env, jobject thiz, jintArray ids, jfloatArray xs, jfloatArray ys)
|
JNIEXPORT void JNICALL JNI_RENDER(nativeTouchesCancel)(JNIEnv * env, jclass thiz, jintArray ids, jfloatArray xs, jfloatArray ys)
|
||||||
{
|
{
|
||||||
if (g_isGameFinished) {
|
if (g_isGameFinished) {
|
||||||
return;
|
return;
|
||||||
@ -411,7 +416,7 @@ extern "C"
|
|||||||
dispatchTouchEventWithPoints(env, cocos2d::TouchEvent::Type::CANCELLED, ids, xs, ys);
|
dispatchTouchEventWithPoints(env, cocos2d::TouchEvent::Type::CANCELLED, ids, xs, ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL JNI_RENDER(nativeKeyEvent)(JNIEnv * env, jobject thiz, jint keyCode, jboolean isPressed)
|
JNIEXPORT jboolean JNICALL JNI_RENDER(nativeKeyEvent)(JNIEnv * env, jclass thiz, jint keyCode, jboolean isPressed)
|
||||||
{
|
{
|
||||||
if (g_isGameFinished) {
|
if (g_isGameFinished) {
|
||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
@ -460,26 +465,26 @@ extern "C"
|
|||||||
* Cocos2dxHelper native functions implementation.
|
* Cocos2dxHelper native functions implementation.
|
||||||
***********************************************************/
|
***********************************************************/
|
||||||
|
|
||||||
JNIEXPORT void JNICALL JNI_HELPER(nativeSetApkPath)(JNIEnv* env, jobject thiz, jstring apkPath)
|
JNIEXPORT void JNICALL JNI_HELPER(nativeSetApkPath)(JNIEnv* env, jclass thiz, jstring apkPath)
|
||||||
{
|
{
|
||||||
LOGD("nativeSetApkPath: %s", apkPath);
|
LOGD("nativeSetApkPath: %s", apkPath);
|
||||||
g_apkPath = JniHelper::jstring2string(apkPath);
|
g_apkPath = JniHelper::jstring2string(apkPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL JNI_HELPER(nativeSetContext)(JNIEnv* env, jobject thiz, jobject context, jobject assetManager)
|
JNIEXPORT void JNICALL JNI_HELPER(nativeSetContext)(JNIEnv* env, jclass thiz, jobject context, jobject assetManager)
|
||||||
{
|
{
|
||||||
JniHelper::setClassLoaderFrom(context);
|
JniHelper::setClassLoaderFrom(context);
|
||||||
FileUtilsAndroid::setassetmanager(AAssetManager_fromJava(env, assetManager));
|
FileUtilsAndroid::setassetmanager(AAssetManager_fromJava(env, assetManager));
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL JNI_HELPER(nativeSetAudioDeviceInfo)(JNIEnv* env, jobject thiz, jboolean isSupportLowLatency, jint deviceSampleRate, jint deviceAudioBufferSizeInFrames)
|
JNIEXPORT void JNICALL JNI_HELPER(nativeSetAudioDeviceInfo)(JNIEnv* env, jclass thiz, jboolean isSupportLowLatency, jint deviceSampleRate, jint deviceAudioBufferSizeInFrames)
|
||||||
{
|
{
|
||||||
g_deviceSampleRate = deviceSampleRate;
|
g_deviceSampleRate = deviceSampleRate;
|
||||||
g_deviceAudioBufferSizeInFrames = deviceAudioBufferSizeInFrames;
|
g_deviceAudioBufferSizeInFrames = deviceAudioBufferSizeInFrames;
|
||||||
LOGD("nativeSetAudioDeviceInfo: sampleRate: %d, bufferSizeInFrames: %d", g_deviceSampleRate, g_deviceAudioBufferSizeInFrames);
|
LOGD("nativeSetAudioDeviceInfo: sampleRate: %d, bufferSizeInFrames: %d", g_deviceSampleRate, g_deviceAudioBufferSizeInFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL JNI_HELPER(nativeSetEditTextDialogResult)(JNIEnv* env, jobject obj, jbyteArray text)
|
JNIEXPORT void JNICALL JNI_HELPER(nativeSetEditTextDialogResult)(JNIEnv* env, jclass obj, jbyteArray text)
|
||||||
{
|
{
|
||||||
jsize size = env->GetArrayLength(text);
|
jsize size = env->GetArrayLength(text);
|
||||||
|
|
||||||
@ -509,12 +514,15 @@ extern "C"
|
|||||||
* Cocos2dxAudioFocusManager native functions implementation.
|
* Cocos2dxAudioFocusManager native functions implementation.
|
||||||
***********************************************************/
|
***********************************************************/
|
||||||
|
|
||||||
JNIEXPORT void JNICALL JNI_AUDIO(nativeOnAudioFocusChange)(JNIEnv* env, jobject thiz, jint focusChange)
|
JNIEXPORT void JNICALL JNI_AUDIO(nativeOnAudioFocusChange)(JNIEnv* env, jclass thiz, jint focusChange)
|
||||||
{
|
{
|
||||||
// cocos_audioengine_focus_change(focusChange);
|
// cocos_audioengine_focus_change(focusChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_CocosJSHelper_nativeJSInit(JNIEnv *env, jclass clazz, jstring resource_path) {
|
/***********************************************************
|
||||||
|
* CocosJSHelper native functions implementation.
|
||||||
|
***********************************************************/
|
||||||
|
JNIEXPORT void JNICALL JNI_JS_HELPER(nativeJSInit)(JNIEnv *env, jclass clazz, jstring resource_path) {
|
||||||
g_app = cocos_android_app_init(env, 1, 1);
|
g_app = cocos_android_app_init(env, 1, 1);
|
||||||
se::ScriptEngine* se = se::ScriptEngine::getInstance();
|
se::ScriptEngine* se = se::ScriptEngine::getInstance();
|
||||||
// se->addRegisterCallback(setCanvasCallback);
|
// se->addRegisterCallback(setCanvasCallback);
|
||||||
|
@ -101,14 +101,6 @@ static cocos2d::network::Downloader *localDownloader()
|
|||||||
return g_localDownloader.get();
|
return g_localDownloader.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void localDownloaderCreateTask(const std::string &url, std::function<void(const std::string&, unsigned char*, int, const std::string&)> callback)
|
|
||||||
{
|
|
||||||
std::stringstream ss;
|
|
||||||
ss << "jsb_loadimage_" << (g_localDownloaderTaskId++);
|
|
||||||
std::string key = ss.str();
|
|
||||||
auto task = localDownloader()->createDownloadDataTask(url, key);
|
|
||||||
g_localDownloaderHandlers.emplace(std::make_pair(task->identifier, callback));
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char* BYTE_CODE_FILE_EXT = ".jsc";
|
static const char* BYTE_CODE_FILE_EXT = ".jsc";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user