{
"Name" : "Android",
"Options" : {
- "Optimization" : "Speed",
+ "Debug" : true,
+ "Optimization" : "None",
"PreprocessorDefinitions" : [
- "ECERE_NOFONTCONFIG"
+ "ECERE_NOFONTCONFIG",
+ "_DEBUG"
],
"IncludeDirs" : [
"../deps/jpeg-6b",
}
}
]
+ },
+ {
+ "FileName" : "C:/Windows/Fonts/arial.ttf",
+ "Options" : {
+ "ExcludeFromBuild" : true
+ },
+ "Configurations" : [
+ {
+ "Name" : "Android",
+ "Options" : {
+ "ExcludeFromBuild" : false
+ }
+ }
+ ]
+ },
+ {
+ "FileName" : "C:/Windows/Fonts/arialbd.ttf",
+ "Options" : {
+ "ExcludeFromBuild" : true
+ },
+ "Configurations" : [
+ {
+ "Name" : "Android",
+ "Options" : {
+ "ExcludeFromBuild" : false
+ }
+ }
+ ]
}
],
"Description" : "The allmighty Ecere Runtime library.",
XUnlockDisplay(xGlobalDisplay);
#endif
+#if !defined(__ANDROID__)
+ // Because destruction of app won't be from main thread
lockMutex.Release();
+#endif
if(interfaceDriver)
{
}
}
Terminate();
+
+#if defined(__ANDROID__)
+ // Because destruction of GuiApp won't be from main thread
+ lockMutex.Release();
+#endif
}
void Wait(void)
if(AInputQueue_preDispatchEvent(inputQueue, event))
return;
handled = onInputEvent(event);
- AInputQueue_finishEvent(inputQueue, event, handled);
+ //AInputQueue_finishEvent(inputQueue, event, handled);
}
else
LOGE("Failure reading next input event: %s\n", strerror(errno));
void free_saved_state()
{
mutex.Wait();
- free(savedState);
+ if(savedState)
+ free(savedState);
+ savedState = 0;
savedStateSize = 0;
mutex.Release();
}
void setSavedState(void * state, uint size)
{
- free(savedState);
+ if(savedState)
+ free(savedState);
+ savedState = null;
if(state)
{
savedState = malloc(size);
bool eventAvailable = false;
if(androidActivity.ident >= 0)
{
+ AndroidPollSource source = androidActivity.source;
//PrintLn("androidActivity.ident >= 0");
// Process this event.
- if(androidActivity.source)
- androidActivity.source.process(androidActivity.source.userData);
+ androidActivity.ident = 0;
+ androidActivity.source = null;
+ if(source)
+ source.process(source.userData);
// If a sensor has data, process it now.
/*
eventAvailable = true;
}
}
- androidActivity.ident = 0;
+
if(androidActivity.animating)
guiApp.desktop.Update(null);
int x = (int)AMotionEvent_getX(event, 0);
int y = (int)AMotionEvent_getY(event, 0);
+ AInputQueue_finishEvent(inputQueue, event, 1);
switch(action)
{
case AMOTION_EVENT_ACTION_DOWN:
uint flags = AKeyEvent_getFlags(event);
uint keyCode = AKeyEvent_getKeyCode(event);
uint meta = AKeyEvent_getMetaState(event);
+
+ AInputQueue_finishEvent(inputQueue, event, 1);
}
+ else
+ AInputQueue_finishEvent(inputQueue, event, 0);
return 0;
}
guiApp.interfaceDriver = class(AndroidInterface);
while(!gotInit)
{
- guiApp.Wait();
- guiApp.ProcessInput(true);
+ // Can't call the GuiApplication here, because GuiApplication::Initialize() has not been called yet
+ guiApp.interfaceDriver.Wait();
+ guiApp.interfaceDriver.ProcessInput(true);
}
// Invoke __ecereDll_Load() in lib[our package name].so
ANativeActivity_finish(activity);
while(!destroyRequested)
{
- guiApp.Wait();
- guiApp.ProcessInput(true);
+ guiApp.interfaceDriver.Wait();
+ guiApp.interfaceDriver.ProcessInput(true);
}
}
}
+#if defined(__ANDROID__)
+#include <android/log.h>
+
+#define printf(...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, "ecere-app", __VA_ARGS__))
+#endif
+
namespace sys;
#define _GNU_SOURCE
EnterCriticalSection(&mutex);
#endif
#else
+#ifdef _DEBUG
+ {
+ int e;
+ e = pthread_mutex_lock(&mutex);
+ if(e)
+ PrintLn("pthread_mutex_lock returned ", e);
+ }
+#else
pthread_mutex_lock(&mutex);
#endif
+#endif
#ifdef _DEBUG
owningThread = GetCurrentThreadID();
if(this == globalSystem.fileMonitorMutex)
printf("[%d] Releasing Mutex %x\n", GetCurrentThreadID(), this);
*/
+#ifdef _DEBUG
+ if(lockCount && owningThread != GetCurrentThreadID())
+ PrintLn("WARNING: Not in owning thread!!");
+#endif
if(!--lockCount)
#ifdef _DEBUG
LeaveCriticalSection(&mutex);
#endif
#else
+#ifdef _DEBUG
+ {
+ int e;
+ e = pthread_mutex_unlock(&mutex);
+ if(e)
+ PrintLn("pthread_mutex_unlock returned ", e);
+ }
+#else
pthread_mutex_unlock(&mutex);
#endif
+#endif
+#ifdef _DEBUG
+ if(lockCount < 0)
+ PrintLn("WARNING: lockCount < 0");
+#endif
}
}
};
"z"
],
"LibraryDirs" : [
- "../../deps/zlib/obj/release.$(PLATFORM)"
+ "../../../deps/zlib/obj/release.$(PLATFORM)"
]
}
}
}
};
-class Player
+public class Player
{
ServerConnection connection;
int id;
}
//////////////////////////////////////////
-remote class ServerConnection
+public remote class ServerConnection
{
public:
// Remote Functions
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- BEGIN_INCLUDE(manifest) -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.ecere.Blokus"
+ android:versionCode="1"
+ android:versionName="1.0">
+
+ <!-- This is the platform API where NativeActivity was introduced. -->
+ <uses-sdk android:minSdkVersion="9" />
+ <uses-permission android:name="android.permission.INTERNET" />
+
+ <!-- This .apk has no Java code itself, so set hasCode to false. -->
+ <application android:label="@string/app_name" android:hasCode="false" android:icon="@drawable/icon">
+
+ <!-- Our activity is the built-in NativeActivity framework class. This will take care of integrating with our NDK code. -->
+ <activity android:name="android.app.NativeActivity"
+ android:label="@string/app_name"
+ android:configChanges="orientation|keyboardHidden">
+ <!-- Tell NativeActivity the name of our .so -->
+ <meta-data android:name="android.app.lib_name"
+ android:value="ecere" />
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
+<!-- END_INCLUDE(manifest) -->
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">Ecere Blokus</string>
+</resources>
"Console" : true,
"FastMath" : false
}
+ },
+ {
+ "Name" : "Android",
+ "Options" : {
+ "Optimization" : "Speed",
+ "TargetType" : "SharedLibrary",
+ "PostbuildCommands" : [
+ "$(call mkdirq,$(OBJ)apk/lib/x86)",
+ "$(call mkdirq,$(OBJ)apk/lib/armeabi)",
+ "$(call cpq,/sdk/ecere/obj/android.linux.$(COMPILER)/libecere.so,$(OBJ)apk/lib/x86)",
+ "$(call cpq,$(TARGET),$(OBJ)apk/lib/x86)",
+ "aapt package -v -f -m -M android/AndroidManifest.xml -F $(OBJ)$(MODULE)-unsigned.apk -I C:/android-sdk/platforms/android-16/android.jar -S android/res $(OBJ)apk",
+ "jarsigner -storepass mypassword -sigalg MD5withRSA -digestalg SHA1 $(OBJ)$(MODULE)-unsigned.apk mykey -signedjar $(OBJ)$(MODULE).apk",
+ "adb uninstall com.ecere.Blokus",
+ "adb install $(OBJ)$(MODULE).apk",
+ "adb shell am start -a android.intent.action.MAIN -n com.ecere.Blokus/android.app.NativeActivity"
+ ]
+ }
}
],
"Files" : [
+ {
+ "Folder" : "android",
+ "Files" : [
+ {
+ "Folder" : "res",
+ "Files" : [
+ {
+ "Folder" : "values",
+ "Files" : [
+ "strings.xml"
+ ]
+ },
+ {
+ "Folder" : "drawable",
+ "Files" : [
+ {
+ "FileName" : "icon.png",
+ "Options" : {
+ "ExcludeFromBuild" : true
+ }
+ }
+ ]
+ },
+ {
+ "Folder" : "drawable-xhdpi",
+ "Files" : [
+ "icon.png"
+ ]
+ }
+ ]
+ },
+ "AndroidManifest.xml"
+ ]
+ },
"blokus.ec",
"BlokusServer.ec",
"../../net/eirc/console.ec"