mirror of
https://github.com/jamessanford/kegs.git
synced 2025-02-21 08:29:02 +00:00
Add high level description of how JNI is used
This commit is contained in:
parent
91f006be3a
commit
5e55cec6d4
24
README.md
24
README.md
@ -9,7 +9,6 @@ The touch screen acts as a big trackpad for the mouse. To click and drag,
|
||||
for example to pull down GS/OS menus, you need to Long Press first.
|
||||
|
||||
What's not ready yet:
|
||||
- No audio.
|
||||
- No joystick.
|
||||
- Screen scaling to fit your device.
|
||||
- Native UI configuration options.
|
||||
@ -23,3 +22,26 @@ To build from source:
|
||||
(cd jni && ndk-build)
|
||||
ant debug install
|
||||
</pre>
|
||||
|
||||
|
||||
Changes made to KEGS:
|
||||
- Various ifdefs for __ANDROID__ in the kegs 'core'
|
||||
- Addition of android_driver.c and android_sound_driver.c
|
||||
|
||||
Application structure:
|
||||
- The UI is coordinated via KegsMain
|
||||
- There is a KegsView$KegsThread class that gets its own thread. This thread ends up calling mainLoop() in jni/android_driver.c and running KEGS in that thread.
|
||||
- The native thread gets two things from Java:
|
||||
-- a Bitmap
|
||||
-- a ConcurrentLinkedQueue
|
||||
|
||||
All UI events are sent to the native thread by pushing events into the ConcurrentLinkedQueue (KegsEvent, MouseKegsEvent, KeyKegsEvent).
|
||||
|
||||
The native thread pulls events off the queue, writes updates into the bitmap object, then calls the Java "updateScreen" in the KegsView$KegsThread object.
|
||||
|
||||
The native thread also calls support functions in Java, such as checkForPause(), which deadlocks the thread while it should be paused.
|
||||
|
||||
Android NDK samples were used as a base for this:
|
||||
- bitmap-plasma
|
||||
- JetBoy
|
||||
- native-audio
|
||||
|
Loading…
x
Reference in New Issue
Block a user