Example #1
0
void textbox_set_opacity(int id, float value) {
	native_shim* shim = get_native_shim();
	JNIEnv *env = shim->env;

	jmethodID method = env->GetMethodID(shim->type, "setTextBoxOpacity", "(IF)V");
	env->CallVoidMethod(shim->instance, method, id, value);
}
Example #2
0
void textbox_set_width(int id, int w) {
	native_shim* shim = get_native_shim();
	JNIEnv *env = shim->env;

	jmethodID method = env->GetMethodID(shim->type, "setTextBoxWidth", "(II)V");
	env->CallVoidMethod(shim->instance, method, id, w);
}
Example #3
0
float textbox_get_opacity(int id) {
	native_shim* shim = get_native_shim();
	JNIEnv *env = shim->env;

	jmethodID method = env->GetMethodID(shim->type, "getTextBoxOpacity", "(I)F");
	return env->CallFloatMethod(shim->instance, method, id);
}
Example #4
0
void textbox_hide(int id) {
	native_shim* shim = get_native_shim();
	JNIEnv *env = shim->env;

	jmethodID method = env->GetMethodID(shim->type, "hideTextBox", "(I)V");
	env->CallVoidMethod(shim->instance, method, id);
}
Example #5
0
bool textbox_get_visible(int id) {
	native_shim* shim = get_native_shim();
	JNIEnv *env = shim->env;

	jmethodID method = env->GetMethodID(shim->type, "getTextBoxVisible", "(I)Z");
	return env->CallBooleanMethod(shim->instance, method, id) == JNI_TRUE;
}
Example #6
0
void textbox_set_height(int id, int h) {
	native_shim* shim = get_native_shim();
	JNIEnv *env = shim->env;

	jmethodID method = env->GetMethodID(shim->type, "setTextBoxHeight", "(II)V");
	env->CallVoidMethod(shim->instance, method, id, h);
}
Example #7
0
void textbox_set_position(int id, int x, int y, int w, int h) {
	native_shim* shim = get_native_shim();
	JNIEnv *env = shim->env;

	jmethodID method = env->GetMethodID(shim->type, "setTextBoxPosition", "(IIIII)V");
	env->CallVoidMethod(shim->instance, method, id, x, y, w, h);
}
Example #8
0
void textbox_set_dimensions(int id, int w, int h) {
	native_shim* shim = get_native_shim();
	JNIEnv *env = shim->env;

	jmethodID method = env->GetMethodID(shim->type, "setTextBoxDimensions", "(III)V");
	env->CallVoidMethod(shim->instance, method, id, w, h);
}
Example #9
0
int textbox_get_type(int id) {
	native_shim* shim = get_native_shim();
	JNIEnv *env = shim->env;

	jmethodID method = env->GetMethodID(shim->type, "getTextBoxType", "(I)I");
	return env->CallIntMethod(shim->instance, method, id);
}
Example #10
0
void textbox_set_visible(int id, bool visible) {
	native_shim* shim = get_native_shim();
	JNIEnv *env = shim->env;

	jmethodID method = env->GetMethodID(shim->type, "setTextBoxVisible", "(IZ)V");
	env->CallVoidMethod(shim->instance, method, id, visible);
}
void sound_manager_halt() {
	native_shim *shim = get_native_shim();
	JNIEnv *env = shim->env;
	jobject manager = shim->instance;
	jclass type = shim->type;
	jmethodID method = env->GetMethodID(type, "haltSounds", "()V");
	env->CallVoidMethod(manager, method);
}
Example #12
0
const char* device_info() {
    native_shim *shim = get_native_shim();
    jmethodID method = shim->env->GetMethodID(shim->type, "getDeviceInfo", "()Ljava/lang/String;");
    jstring result = (jstring) shim->env->CallObjectMethod(shim->instance, method);
    const char* str = NULL;
    GET_STR(shim->env, result, str);
    shim->env->DeleteLocalRef(result);
    return str;
}
Example #13
0
void textbox_set_value(int id, const char* str) {
	native_shim* shim = get_native_shim();
	JNIEnv *env = shim->env;

	jmethodID method = env->GetMethodID(shim->type, "setTextBoxValue", "(ILjava/lang/String;)V");
	jstring value = env->NewStringUTF(str);
	env->CallVoidMethod(shim->instance, method, id, value);
	env->DeleteLocalRef(value);
}
Example #14
0
void sound_manager_seek_to(const char *url, float position) {
	native_shim *shim = get_native_shim();
	JNIEnv *env = shim->env;
	jobject manager = shim->instance;
	jclass type = shim->type;
	jmethodID method = env->GetMethodID(type, "seekTo", "(Ljava/lang/String;F)V");
	jstring s = env->NewStringUTF(url);
	env->CallVoidMethod(manager, method, s, position);
	env->DeleteLocalRef(s);
}
Example #15
0
void sound_manager_play_background_music(const char *url, float volume, bool loop) {
	native_shim *shim = get_native_shim();
	JNIEnv *env = shim->env;
	jobject manager = shim->instance;
	jclass type = shim->type;
	jmethodID method = env->GetMethodID(type, "playBackgroundMusic", "(Ljava/lang/String;FZ)V");
	jstring s = env->NewStringUTF(url);
	env->CallVoidMethod(manager, method, s, volume, loop);
	env->DeleteLocalRef(s);
}
Example #16
0
static inline void do_call(const char *url, const char *method_name) {
	native_shim *shim = get_native_shim();
	JNIEnv *env = shim->env;
	jobject manager = shim->instance;
	jclass type = shim->type;
	jmethodID method = env->GetMethodID(type, method_name, "(Ljava/lang/String;)V");
	jstring s = env->NewStringUTF(url);
	env->CallVoidMethod(manager, method, s);
	env->DeleteLocalRef(s);
}
Example #17
0
const char* device_global_id() {
    native_shim *shim = get_native_shim();
    JNIEnv *env = shim->env;
    jmethodID method = env->GetMethodID(shim->type, "getDeviceID", "()Ljava/lang/String;");
    jstring result = (jstring) env->CallObjectMethod(shim->instance, method);
    const char* str = NULL;
    GET_STR(env, result, str);
    env->DeleteLocalRef(result);
    return str;
}
Example #18
0
int textbox_create_init(int x, int y, int w, int h, const char* data) {
	native_shim* shim = get_native_shim();
	JNIEnv *env = shim->env;

	jmethodID method = env->GetMethodID(shim->type, "createTextBox", "(IIIILjava/lang/String;)I");
	jstring str = env->NewStringUTF(data);
	int id = env->CallIntMethod(shim->instance, method, x, y, w, h, str);
	env->DeleteLocalRef(str);
	return id;
}
Example #19
0
const char* textbox_get_value(int id) {
	native_shim* shim = get_native_shim();
	JNIEnv *env = shim->env;

	jmethodID method = env->GetMethodID(shim->type, "getTextBoxValue", "(I)Ljava/lang/String;");
	jstring value = (jstring) env->CallObjectMethod(shim->instance, method, id);
	const char* str = NULL;
	GET_STR(env, value, str);
	env->DeleteLocalRef(value);
	return str;
}
int text_manager_measure_text(const char *font_name, int size, const char *text) {
	native_shim *shim = get_native_shim();
	JNIEnv *env = shim->env;
	jstring jfont = env->NewStringUTF(font_name);
	jint jsize = (jint) size;
	jstring jtext = env->NewStringUTF(text);

	const char *signature = "(Ljava/lang/String;ILjava/lang/String;)I";
	jmethodID id = env->GetMethodID(shim->type, "measureText", signature);
	jint width = env->CallIntMethod(shim->instance, id, jfont, jsize, jtext);
	env->DeleteLocalRef(jfont);
	env->DeleteLocalRef(jtext);

	return (int) width;
}
char *plugins_send_event(const char *pluginClass, const char *pluginClassMethod, const char *data) {

	native_shim* shim = get_native_shim();
	jmethodID method = shim->env->GetMethodID(shim->type, "pluginsCall", "(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;");
	jstring str = shim->env->NewStringUTF(data);
	jstring className = shim->env->NewStringUTF(pluginClass);
	jstring methodName = shim->env->NewStringUTF(pluginClassMethod);

	jobjectArray params = NULL;
	params = (jobjectArray) shim->env->NewObjectArray(1, shim->env->FindClass("java/lang/Object"), NULL);
	shim->env->SetObjectArrayElement(params, 0, str);

	jstring jdata = (jstring) shim->env->CallObjectMethod(shim->instance, method, className, methodName, params);
    char *ret_data = NULL;
	GET_STR(shim->env, jdata, ret_data);
	shim->env->DeleteLocalRef(jdata);
	shim->env->DeleteLocalRef(str);
	shim->env->DeleteLocalRef(className);
	shim->env->DeleteLocalRef(methodName);
	shim->env->DeleteLocalRef(params);
    return ret_data;
}
Example #22
0
CEXPORT int device_total_memory() {
    native_shim *shim = get_native_shim();
    jmethodID method = shim->env->GetMethodID(shim->type, "getTotalMemory", "()I");
    jint result = shim->env->CallIntMethod(shim->instance, method);
    return result;
}
Example #23
0
CEXPORT bool device_is_simulator() {
    native_shim *shim = get_native_shim();
    jmethodID method = shim->env->GetMethodID(shim->type, "isSimulator", "()Z");
    jboolean result = shim->env->CallBooleanMethod(shim->instance, method);
    return result;
}
Example #24
0
int textbox_create_new() {
	native_shim* shim = get_native_shim();
	JNIEnv *env = shim->env;
	jmethodID method = env->GetMethodID(shim->type, "createTextBox", "()I");
	return env->CallIntMethod(shim->instance, method);
}