project_files/Android-build/SDL-android-project/jni/src/hedgewars_main.c
author dag10 <gottlieb.drew@gmail.com>
Wed, 16 Jan 2013 18:34:43 -0500
changeset 8393 85bd6c7b2641
parent 5934 9f05a0f43003
child 8465 9114b50fed82
permissions -rw-r--r--
Can now change theme for static and mission maps. Fixed mission map descriptions that had commas which broke them. Now, you must escape commas in map descriptions. Made bgwidget repaint on animation tick to avoid buffer-not-clearing issue with widgets that change overtop the background leaving a ghost image of the widget's previous state. Generated map is now the default map in the mapconfig widget.


#include "android/log.h"
#include "SDL.h"
#include "dlfcn.h"
#include "GLES/gl.h"

#define TAG "HWEngine Loader"

typedef  (*HWEngine_Game)(char**);

main(int argc, char *argv[]){
	void *handle;
	char *error;
	HWEngine_Game Game;
	

        __android_log_print(ANDROID_LOG_INFO, TAG, "HWEngine being loaded");
	handle = dlopen("libhwengine.so", RTLD_NOW|RTLD_GLOBAL);
	if(!handle){
		__android_log_print(ANDROID_LOG_INFO, TAG, dlerror());
		__android_log_print(ANDROID_LOG_INFO, TAG, "error dlopen");
		exit(EXIT_FAILURE);
	}
	dlerror();

        __android_log_print(ANDROID_LOG_INFO, TAG, "HWEngine successfully loaded..");


	Game = (HWEngine_Game) dlsym(handle,"Game");
	if((error = dlerror()) != NULL){
		__android_log_print(ANDROID_LOG_INFO, TAG, error);
		__android_log_print(ANDROID_LOG_INFO, TAG, "error dlsym");
		exit(EXIT_FAILURE);
	}
	__android_log_print(ANDROID_LOG_INFO, TAG, "dlsym succeeded");
	Game(argv);
	__android_log_print(ANDROID_LOG_INFO, TAG, "Game() ended");

	dlclose(handle);
}