Starts preparing the example for using the new jnigraphics version of the LCL

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2169 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2011-11-27 20:33:24 +00:00
parent 45a7900c4e
commit 706b8f1058
3 changed files with 65 additions and 3 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pascal.opengltest"
package="com.pascal.lcl"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.VIBRATE" />
@ -9,7 +9,7 @@
<application android:label="@string/app_name"
android:icon="@drawable/icon"
android:debuggable="True">
<activity android:name="android.app.NativeActivity"
<activity android:name="LCLActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name"
android:launchMode="singleTop">

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="OpenGLNDKTest" default="help">
<project name="LCLExample" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into

View File

@ -0,0 +1,62 @@
package com.pascal.jnitest;
import android.app.*;
import android.content.*;
import android.os.*;
import android.widget.*;
import android.util.*;
import android.graphics.*;
import android.view.*;
public class LCLActivity extends Activity
{
// Our drawing surface
private class LCLSurface extends SurfaceView
{
public LCLSurface(Context context)
{
super(context);
}
@Override protected void onDraw(Canvas canvas)
{
Bitmap lclbitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
LCLDrawToBitmap(getWidth(), getHeight(), lclbitmap);
canvas.drawBitmap(lclbitmap, 0, 0, null);
}
}
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// TextView tv = new TextView(this);
// tv.setText( Integer.toString(intFromJNI()) );
// setContentView(tv);
LCLSurface lclsurface = new LCLSurface(this);
setContentView(lclsurface);
}
// JNI table of functions
public native String stringFromJNI();
public native int intFromJNI();
public native int LCLDrawToBitmap(int width, int height, Bitmap bitmap);
public long nativeCodeLoaded=0;
static
{
try
{
Log.i("JNI", "Trying to load libnativetest.so");
System.loadLibrary("nativetest");
}
catch(UnsatisfiedLinkError ule)
{
Log.e("JNI", "WARNING: Could not load libnativetest.so");
ule.printStackTrace();
}
}
}