tests: fix tests for nitcatalog
[nit.git] / lib / android / native_app_glue.nit
index 2202827..2a8f895 100644 (file)
@@ -37,7 +37,7 @@
 #   main activity of the running application. Use it to get anything related
 #   to the `Context` and as anchor to execute Java UI code.
 module native_app_glue is
-       ldflags "-landroid"
+       ldflags("-landroid", "-lnative_app_glue")
        android_activity "android.app.NativeActivity"
 end
 
@@ -56,7 +56,8 @@ in "C body" `{
        // We relay the call to the Nit application.
        void android_main(struct android_app* app) {
                native_app_glue_data = app;
-               app_dummy();
+
+               int main(int argc, char ** argv);
                main(0, NULL);
        }
 
@@ -260,10 +261,10 @@ extern class NdkNativeActivity `{ ANativeActivity * `}
        fun java_native_activity: NativeActivity `{ return self->clazz; `}
 
        # Path to this application's internal data directory.
-       fun internal_data_path: NativeString `{ return (char*)self->internalDataPath; `}
+       fun internal_data_path: CString `{ return (char*)self->internalDataPath; `}
 
        # Path to this application's external (removable/mountable) data directory.
-       fun external_data_path: NativeString `{ return (char*)self->externalDataPath; `}
+       fun external_data_path: CString `{ return (char*)self->externalDataPath; `}
 
        # The platform's SDK version code.
        fun sdk_version: Int `{ return self->sdkVersion; `}
@@ -285,7 +286,7 @@ extern class NdkNativeActivity `{ ANativeActivity * `}
        # api?
        #
        # TODO activate in a future module at API 11
-       #fun obb_path: NativeString `{ return (char*)self->obbPath; `}
+       #fun obb_path: CString `{ return (char*)self->obbPath; `}
 end
 
 # This is the interface for the standard glue code of a threaded
@@ -368,4 +369,13 @@ end
 
 # Android NDK's structure to control the native window for drawing
 extern class ANativeWindow `{ ANativeWindow* `}
+       # Change the format and size of the window buffers
+       #
+       # All arguments can be set to 0 to use the default devices values.
+       # `width` and `height` must both be set to 0 or have significant values.
+       #
+       # `format` is a value specified by EGL.
+       fun set_buffers_geometry(width, height, format: Int): Bool `{
+               return ANativeWindow_setBuffersGeometry(self, (int32_t)width, (int32_t)height, (int32_t)format);
+       `}
 end