You've already forked lazarus-ccr
Adds the initial commit of the NDK files. The files are from Jeppe Johansen and Benjamin Rosseaux
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1437 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
798
bindings/android-ndk/android_native_app_glue.pas
Normal file
798
bindings/android-ndk/android_native_app_glue.pas
Normal file
@ -0,0 +1,798 @@
|
||||
(*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*)
|
||||
|
||||
unit android_native_app_glue;
|
||||
|
||||
interface
|
||||
|
||||
uses ctypes,baseunix,unixtype,
|
||||
configuration,looper,log,input,rect,native_window,native_activity;
|
||||
|
||||
(**
|
||||
* The native activity interface provided by <android/native_activity.h>
|
||||
* is based on a set of application-provided callbacks that will be called
|
||||
* by the Activity's main thread when certain events occur.
|
||||
*
|
||||
* This means that each one of this callbacks _should_ _not_ block, or they
|
||||
* risk having the system force-close the application. This programming
|
||||
* model is direct, lightweight, but constraining.
|
||||
*
|
||||
* The 'threaded_native_app' static library is used to provide a different
|
||||
* execution model where the application can implement its own main event
|
||||
* loop in a different thread instead. Here's how it works:
|
||||
*
|
||||
* 1/ The application must provide a function named "android_main()" that
|
||||
* will be called when the activity is created, in a new thread that is
|
||||
* distinct from the activity's main thread.
|
||||
*
|
||||
* 2/ android_main() receives a pointer to a valid "android_app" structure
|
||||
* that contains references to other important objects, e.g. the
|
||||
* ANativeActivity obejct instance the application is running in.
|
||||
*
|
||||
* 3/ the "android_app" object holds an ALooper instance that already
|
||||
* listens to two important things:
|
||||
*
|
||||
* - activity lifecycle events (e.g. "pause", "resume"). See APP_CMD_XXX
|
||||
* declarations below.
|
||||
*
|
||||
* - input events coming from the AInputQueue attached to the activity.
|
||||
*
|
||||
* Each of these correspond to an ALooper identifier returned by
|
||||
* ALooper_pollOnce with values of LOOPER_ID_MAIN and LOOPER_ID_INPUT,
|
||||
* respectively.
|
||||
*
|
||||
* Your application can use the same ALooper to listen to additional
|
||||
* file-descriptors. They can either be callback based, or with return
|
||||
* identifiers starting with LOOPER_ID_USER.
|
||||
*
|
||||
* 4/ Whenever you receive a LOOPER_ID_MAIN or LOOPER_ID_INPUT event,
|
||||
* the returned data will point to an android_poll_source structure. You
|
||||
* can call the process() function on it, and fill in android_app->onAppCmd
|
||||
* and android_app->onInputEvent to be called for your own processing
|
||||
* of the event.
|
||||
*
|
||||
* Alternatively, you can call the low-level functions to read and process
|
||||
* the data directly... look at the process_cmd() and process_input()
|
||||
* implementations in the glue to see how to do this.
|
||||
*
|
||||
* See the sample named "native-activity" that comes with the NDK with a
|
||||
* full usage example. Also look at the JavaDoc of NativeActivity.
|
||||
*)
|
||||
|
||||
(**
|
||||
* Data associated with an ALooper fd that will be returned as the "outData"
|
||||
* when that source has data ready.
|
||||
*)
|
||||
|
||||
type
|
||||
Pandroid_poll_source = ^android_poll_source;
|
||||
Pandroid_app = ^Tandroid_app;
|
||||
android_poll_source = packed record
|
||||
// The identifier of this source. May be LOOPER_ID_MAIN or
|
||||
// LOOPER_ID_INPUT.
|
||||
id : cint32;
|
||||
// The android_app this ident is associated with.
|
||||
app : Pandroid_app;
|
||||
// Function to call to perform the standard processing of data from
|
||||
// this source.
|
||||
process : procedure(app: Pandroid_app; source: Pandroid_poll_source); cdecl;
|
||||
end;
|
||||
|
||||
(**
|
||||
* This is the interface for the standard glue code of a threaded
|
||||
* application. In this model, the application's code is running
|
||||
* in its own thread separate from the main thread of the process.
|
||||
* It is not required that this thread be associated with the Java
|
||||
* VM, although it will need to be in order to make JNI calls any
|
||||
* Java objects.
|
||||
*)
|
||||
Tandroid_app = packed record
|
||||
// The application can place a pointer to its own state object
|
||||
// here if it likes.
|
||||
userData : Pointer;
|
||||
// Fill this in with the function to process main app commands (APP_CMD_*)
|
||||
onAppCmd : procedure(app: Pandroid_app; cmd: cint32); cdecl;
|
||||
// Fill this in with the function to process input events. At this point
|
||||
// the event has already been pre-dispatched, and it will be finished upon
|
||||
// return. Return if you have handled the event, 0 for any default
|
||||
// dispatching.
|
||||
onInputEvent : function(app: Pandroid_app; event: PAInputEvent): cint32; cdecl;
|
||||
// The ANativeActivity object instance that this app is running in.
|
||||
activity : PANativeActivity;
|
||||
// The current configuration the app is running in.
|
||||
config : PAConfiguration;
|
||||
// This is the last instance's saved state, as provided at creation time.
|
||||
// It is NULL if there was no state. You can use this as you need; the
|
||||
// memory will remain around until you call android_app_exec_cmd() for
|
||||
// APP_CMD_RESUME, at which point it will be freed and savedState set to NULL.
|
||||
// These variables should only be changed when processing a APP_CMD_SAVE_STATE,
|
||||
// at which point they will be initialized to NULL and you can malloc your
|
||||
// state and place the information here. In that case the memory will be
|
||||
// freed for you later.
|
||||
savedState : Pointer;
|
||||
savedStateSize : csize_t;
|
||||
// The ALooper associated with the app's thread.
|
||||
looper : PALooper;
|
||||
// When non-NULL, this is the input queue from which the app will
|
||||
// receive user input events.
|
||||
inputQueue : PAInputQueue;
|
||||
// When non-NULL, this is the window surface that the app can draw in.
|
||||
window : PANativeWindow;
|
||||
// Current content rectangle of the window; this is the area where the
|
||||
// window's content should be placed to be seen by the user.
|
||||
contentRect : ARect;
|
||||
// Current state of the app's activity. May be either APP_CMD_START,
|
||||
// APP_CMD_RESUME, APP_CMD_PAUSE, or APP_CMD_STOP; see below.
|
||||
activityState : cint;
|
||||
// This is non-zero when the application's NativeActivity is being
|
||||
// destroyed and waiting for the app thread to complete.
|
||||
destroyRequested : cint;
|
||||
// -------------------------------------------------
|
||||
// Below are "private" implementation of the glue code.
|
||||
mutex : pthread_mutex_t;
|
||||
cond : pthread_cond_t;
|
||||
msgread : cint;
|
||||
msgwrite : cint;
|
||||
thread : pthread_t;
|
||||
cmdPollSource : android_poll_source;
|
||||
inputPollSource : android_poll_source;
|
||||
running : cint;
|
||||
stateSaved : cint;
|
||||
destroyed : cint;
|
||||
redrawNeeded : cint;
|
||||
pendingInputQueue : PAInputQueue;
|
||||
pendingWindow : PANativeWindow;
|
||||
pendingContentRect : ARect;
|
||||
end;
|
||||
|
||||
const
|
||||
(**
|
||||
* Looper data ID of commands coming from the app's main thread, which
|
||||
* is returned as an identifier from ALooper_pollOnce(). The data for this
|
||||
* identifier is a pointer to an android_poll_source structure.
|
||||
* These can be retrieved and processed with android_app_read_cmd()
|
||||
* and android_app_exec_cmd().
|
||||
*)
|
||||
LOOPER_ID_MAIN = 1;
|
||||
(**
|
||||
* Looper data ID of events coming from the AInputQueue of the
|
||||
* application's window, which is returned as an identifier from
|
||||
* ALooper_pollOnce(). The data for this identifier is a pointer to an
|
||||
* android_poll_source structure. These can be read via the inputQueue
|
||||
* object of android_app.
|
||||
*)
|
||||
LOOPER_ID_INPUT = 2;
|
||||
(**
|
||||
* Start of user-defined ALooper identifiers.
|
||||
*)
|
||||
LOOPER_ID_USER = 3;
|
||||
|
||||
const
|
||||
(**
|
||||
* Command from main thread: the AInputQueue has changed. Upon processing
|
||||
* this command, android_app->inputQueue will be updated to the new queue
|
||||
* (or NULL).
|
||||
*)
|
||||
APP_CMD_INPUT_CHANGED = 0;
|
||||
(**
|
||||
* Command from main thread: a new ANativeWindow is ready for use. Upon
|
||||
* receiving this command, android_app->window will contain the new window
|
||||
* surface.
|
||||
*)
|
||||
APP_CMD_INIT_WINDOW = 1;
|
||||
(**
|
||||
* Command from main thread: the existing ANativeWindow needs to be
|
||||
* terminated. Upon receiving this command, android_app->window still
|
||||
* contains the existing window; after calling android_app_exec_cmd
|
||||
* it will be set to NULL.
|
||||
*)
|
||||
APP_CMD_TERM_WINDOW = 2;
|
||||
(**
|
||||
* Command from main thread: the current ANativeWindow has been resized.
|
||||
* Please redraw with its new size.
|
||||
*)
|
||||
APP_CMD_WINDOW_RESIZED = 3;
|
||||
(**
|
||||
* Command from main thread: the system needs that the current ANativeWindow
|
||||
* be redrawn. You should redraw the window before handing this to
|
||||
* android_app_exec_cmd() in order to avoid transient drawing glitches.
|
||||
*)
|
||||
APP_CMD_WINDOW_REDRAW_NEEDED = 4;
|
||||
(**
|
||||
* Command from main thread: the content area of the window has changed,
|
||||
* such as from the soft input window being shown or hidden. You can
|
||||
* find the new content rect in android_app::contentRect.
|
||||
*)
|
||||
APP_CMD_CONTENT_RECT_CHANGED = 5;
|
||||
(**
|
||||
* Command from main thread: the app's activity window has gained
|
||||
* input focus.
|
||||
*)
|
||||
APP_CMD_GAINED_FOCUS = 6;
|
||||
(**
|
||||
* Command from main thread: the app's activity window has lost
|
||||
* input focus.
|
||||
*)
|
||||
APP_CMD_LOST_FOCUS = 7;
|
||||
(**
|
||||
* Command from main thread: the current device configuration has changed.
|
||||
*)
|
||||
APP_CMD_CONFIG_CHANGED = 8;
|
||||
(**
|
||||
* Command from main thread: the system is running low on memory.
|
||||
* Try to reduce your memory use.
|
||||
*)
|
||||
APP_CMD_LOW_MEMORY = 9;
|
||||
(**
|
||||
* Command from main thread: the app's activity has been started.
|
||||
*)
|
||||
APP_CMD_START = 10;
|
||||
(**
|
||||
* Command from main thread: the app's activity has been resumed.
|
||||
*)
|
||||
APP_CMD_RESUME = 11;
|
||||
(**
|
||||
* Command from main thread: the app should generate a new saved state
|
||||
* for itself, to restore from later if needed. If you have saved state,
|
||||
* allocate it with malloc and place it in android_app.savedState with
|
||||
* the size in android_app.savedStateSize. The will be freed for you
|
||||
* later.
|
||||
*)
|
||||
APP_CMD_SAVE_STATE = 12;
|
||||
(**
|
||||
* Command from main thread: the app's activity has been paused.
|
||||
*)
|
||||
APP_CMD_PAUSE = 13;
|
||||
(**
|
||||
* Command from main thread: the app's activity has been stopped.
|
||||
*)
|
||||
APP_CMD_STOP = 14;
|
||||
(**
|
||||
* Command from main thread: the app's activity is being destroyed,
|
||||
* and waiting for the app thread to clean up and exit before proceeding.
|
||||
*)
|
||||
APP_CMD_DESTROY = 15;
|
||||
|
||||
(**
|
||||
* Call when ALooper_pollAll() returns LOOPER_ID_MAIN, reading the next
|
||||
* app command message.
|
||||
*)
|
||||
|
||||
function android_app_read_cmd(android_app: Pandroid_app): cint8; cdecl;
|
||||
|
||||
(**
|
||||
* Call with the command returned by android_app_read_cmd() to do the
|
||||
* initial pre-processing of the given command. You can perform your own
|
||||
* actions for the command after calling this function.
|
||||
*)
|
||||
|
||||
procedure android_app_pre_exec_cmd(android_app: Pandroid_app; cmd: cint8); cdecl;
|
||||
|
||||
(**
|
||||
* Call with the command returned by android_app_read_cmd() to do the
|
||||
* final post-processing of the given command. You must have done your own
|
||||
* actions for the command before calling this function.
|
||||
*)
|
||||
|
||||
procedure android_app_post_exec_cmd(android_app: Pandroid_app; cmd: cint8); cdecl;
|
||||
|
||||
(**
|
||||
* Dummy function you can call to ensure glue code isn't stripped.
|
||||
*)
|
||||
|
||||
procedure app_dummy;
|
||||
|
||||
(**
|
||||
* This is the function that application code must implement, representing
|
||||
* the main entry to the app.
|
||||
*)
|
||||
procedure android_main(app: Pandroid_app); cdecl; external;
|
||||
procedure ANativeActivity_onCreate(activity: PANativeActivity; savedState: Pointer; savedStateSize: csize_t); cdecl;
|
||||
|
||||
implementation
|
||||
|
||||
uses cmem;
|
||||
|
||||
function strerror(i: longint): pchar; cdecl;
|
||||
begin
|
||||
result := 'Undefined!';
|
||||
end;
|
||||
|
||||
type
|
||||
ppthread_t = ^pthread_t;
|
||||
ppthread_attr_t = ^pthread_attr_t;
|
||||
ppthread_mutex_t = ^pthread_mutex_t;
|
||||
ppthread_cond_t = ^pthread_cond_t;
|
||||
ppthread_mutexattr_t = ^pthread_mutexattr_t;
|
||||
ppthread_condattr_t = ^pthread_condattr_t;
|
||||
|
||||
__start_routine_t = pointer;
|
||||
|
||||
const
|
||||
PTHREAD_CREATE_DETACHED = 1;
|
||||
|
||||
function pthread_create(__thread:ppthread_t; __attr:ppthread_attr_t;__start_routine: __start_routine_t;__arg:pointer):longint;cdecl;external 'libc.so';
|
||||
function pthread_attr_init(__attr:ppthread_attr_t):longint;cdecl;external 'libc.so';
|
||||
function pthread_attr_setdetachstate(__attr:ppthread_attr_t; __detachstate:longint):longint;cdecl;external 'libc.so';
|
||||
function pthread_mutex_init(__mutex:ppthread_mutex_t; __mutex_attr:ppthread_mutexattr_t):longint;cdecl;external 'libc.so';
|
||||
function pthread_mutex_destroy(__mutex:ppthread_mutex_t):longint;cdecl;external 'libc.so';
|
||||
function pthread_mutex_lock(__mutex: ppthread_mutex_t):longint;cdecl;external 'libc.so';
|
||||
function pthread_mutex_unlock(__mutex: ppthread_mutex_t):longint;cdecl;external 'libc.so';
|
||||
function pthread_cond_init(__cond:ppthread_cond_t; __cond_attr:ppthread_condattr_t):longint;cdecl;external 'libc.so';
|
||||
function pthread_cond_destroy(__cond:ppthread_cond_t):longint;cdecl;external 'libc.so';
|
||||
function pthread_cond_signal(__cond:ppthread_cond_t):longint;cdecl;external 'libc.so';
|
||||
function pthread_cond_broadcast(__cond:ppthread_cond_t):longint;cdecl;external 'libc.so';
|
||||
function pthread_cond_wait(__cond:ppthread_cond_t; __mutex:ppthread_mutex_t):longint;cdecl;external 'libc.so';
|
||||
|
||||
|
||||
procedure free_saved_state(android_app: Pandroid_app);
|
||||
begin
|
||||
pthread_mutex_lock(@android_app^.mutex);
|
||||
if android_app^.savedState <> Nil then
|
||||
begin
|
||||
free(android_app^.savedState);
|
||||
android_app^.savedState := nil;
|
||||
android_app^.savedStateSize := 0;
|
||||
end;
|
||||
pthread_mutex_unlock(@android_app^.mutex);
|
||||
end;
|
||||
|
||||
function android_app_read_cmd(android_app: Pandroid_app): cint8; cdecl;
|
||||
var cmd: cint8;
|
||||
begin
|
||||
result := -1;
|
||||
if fpread(android_app^.msgread, @cmd, sizeof(cmd)) = sizeof(cmd) then
|
||||
begin
|
||||
case cmd of
|
||||
APP_CMD_SAVE_STATE:
|
||||
free_saved_state(android_app);
|
||||
end;
|
||||
result := cmd;
|
||||
end
|
||||
else
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','No data on command pipe!');
|
||||
end;
|
||||
|
||||
procedure print_cur_config(android_app: Pandroid_app);
|
||||
var lang, country: array[0..1] of char;
|
||||
begin
|
||||
AConfiguration_getLanguage(android_app^.config, @lang[0]);
|
||||
AConfiguration_getCountry(android_app^.config, @country[0]);
|
||||
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','Config: mcc:=%d mnc:=%d lang:=%c%c cnt:=%c%c orien:=%d touch:=%d dens:=%d '+
|
||||
'keys:=%d nav:=%d keysHid:=%d navHid:=%d sdk:=%d size:=%d long:=%d '+
|
||||
'modetype:=%d modenight:=%d',
|
||||
AConfiguration_getMcc(android_app^.config),
|
||||
AConfiguration_getMnc(android_app^.config),
|
||||
lang[0], lang[1], country[0], country[1],
|
||||
AConfiguration_getOrientation(android_app^.config),
|
||||
AConfiguration_getTouchscreen(android_app^.config),
|
||||
AConfiguration_getDensity(android_app^.config),
|
||||
AConfiguration_getKeyboard(android_app^.config),
|
||||
AConfiguration_getNavigation(android_app^.config),
|
||||
AConfiguration_getKeysHidden(android_app^.config),
|
||||
AConfiguration_getNavHidden(android_app^.config),
|
||||
AConfiguration_getSdkVersion(android_app^.config),
|
||||
AConfiguration_getScreenSize(android_app^.config),
|
||||
AConfiguration_getScreenLong(android_app^.config),
|
||||
AConfiguration_getUiModeType(android_app^.config),
|
||||
AConfiguration_getUiModeNight(android_app^.config));
|
||||
end;
|
||||
|
||||
procedure android_app_pre_exec_cmd(android_app: Pandroid_app; cmd: cint8); cdecl;
|
||||
begin
|
||||
case cmd of
|
||||
APP_CMD_INPUT_CHANGED:
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','APP_CMD_INPUT_CHANGED');
|
||||
pthread_mutex_lock(@android_app^.mutex);
|
||||
if android_app^.inputQueue <> nil then
|
||||
AInputQueue_detachLooper(android_app^.inputQueue);
|
||||
android_app^.inputQueue := android_app^.pendingInputQueue;
|
||||
if android_app^.inputQueue <> nil then
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','Attaching input queue to looper');
|
||||
AInputQueue_attachLooper(android_app^.inputQueue,
|
||||
android_app^.looper, LOOPER_ID_INPUT, nil,
|
||||
@android_app^.inputPollSource);
|
||||
end;
|
||||
pthread_cond_broadcast(@android_app^.cond);
|
||||
pthread_mutex_unlock(@android_app^.mutex);
|
||||
end;
|
||||
|
||||
APP_CMD_INIT_WINDOW:
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','APP_CMD_INIT_WINDOW');
|
||||
pthread_mutex_lock(@android_app^.mutex);
|
||||
android_app^.window := android_app^.pendingWindow;
|
||||
pthread_cond_broadcast(@android_app^.cond);
|
||||
pthread_mutex_unlock(@android_app^.mutex);
|
||||
end;
|
||||
|
||||
APP_CMD_TERM_WINDOW:
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','APP_CMD_TERM_WINDOW');
|
||||
pthread_mutex_lock(@android_app^.mutex);
|
||||
android_app^.window := nil;
|
||||
pthread_cond_broadcast(@android_app^.cond);
|
||||
pthread_mutex_unlock(@android_app^.mutex);
|
||||
end;
|
||||
|
||||
APP_CMD_RESUME,
|
||||
APP_CMD_START,
|
||||
APP_CMD_PAUSE,
|
||||
APP_CMD_STOP:
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','activityState:=%d', cmd);
|
||||
pthread_mutex_lock(@android_app^.mutex);
|
||||
android_app^.activityState := cmd;
|
||||
pthread_cond_broadcast(@android_app^.cond);
|
||||
pthread_mutex_unlock(@android_app^.mutex);
|
||||
end;
|
||||
|
||||
APP_CMD_CONFIG_CHANGED:
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','APP_CMD_CONFIG_CHANGED');
|
||||
AConfiguration_fromAssetManager(android_app^.config,
|
||||
android_app^.activity^.assetManager);
|
||||
print_cur_config(android_app);
|
||||
end;
|
||||
|
||||
APP_CMD_DESTROY:
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','APP_CMD_DESTROY');
|
||||
android_app^.destroyRequested := 1;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure android_app_post_exec_cmd(android_app: Pandroid_app; cmd: cint8); cdecl;
|
||||
begin
|
||||
case cmd of
|
||||
APP_CMD_TERM_WINDOW:
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','APP_CMD_TERM_WINDOW');
|
||||
pthread_mutex_lock(@android_app^.mutex);
|
||||
android_app^.window := nil;
|
||||
pthread_cond_broadcast(@android_app^.cond);
|
||||
pthread_mutex_unlock(@android_app^.mutex);
|
||||
end;
|
||||
|
||||
APP_CMD_SAVE_STATE:
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','APP_CMD_SAVE_STATE');
|
||||
pthread_mutex_lock(@android_app^.mutex);
|
||||
android_app^.stateSaved := 1;
|
||||
pthread_cond_broadcast(@android_app^.cond);
|
||||
pthread_mutex_unlock(@android_app^.mutex);
|
||||
end;
|
||||
|
||||
APP_CMD_RESUME:
|
||||
free_saved_state(android_app);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure app_dummy;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure android_app_destroy(android_app: Pandroid_app);
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','android_app_destroy!');
|
||||
free_saved_state(android_app);
|
||||
pthread_mutex_lock(@android_app^.mutex);
|
||||
if (android_app^.inputQueue <> nil) then
|
||||
AInputQueue_detachLooper(android_app^.inputQueue);
|
||||
AConfiguration_delete(android_app^.config);
|
||||
android_app^.destroyed := 1;
|
||||
pthread_cond_broadcast(@android_app^.cond);
|
||||
pthread_mutex_unlock(@android_app^.mutex);
|
||||
// Can't touch android_app object after this.
|
||||
end;
|
||||
|
||||
procedure process_input(app: Pandroid_app; source: Pandroid_poll_source); cdecl;
|
||||
var event: PAInputEvent;
|
||||
handled: cint32;
|
||||
begin
|
||||
event := nil;
|
||||
if (AInputQueue_getEvent(app^.inputQueue, @event) >= 0) then
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','New input event: type:=%d',AInputEvent_getType(event));
|
||||
if AInputQueue_preDispatchEvent(app^.inputQueue, event) <> 0 then exit;
|
||||
handled := 0;
|
||||
if (app^.onInputEvent <> nil) then handled := app^.onInputEvent(app, event);
|
||||
AInputQueue_finishEvent(app^.inputQueue, event, handled);
|
||||
end
|
||||
else
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','Failure reading next input event: %s', strerror(errno));
|
||||
end;
|
||||
|
||||
procedure process_cmd(app: Pandroid_app; source: Pandroid_poll_source); cdecl;
|
||||
var cmd: cint8;
|
||||
begin
|
||||
cmd := android_app_read_cmd(app);
|
||||
android_app_pre_exec_cmd(app, cmd);
|
||||
if (app^.onAppCmd <> nil) then app^.onAppCmd(app, cmd);
|
||||
android_app_post_exec_cmd(app, cmd);
|
||||
end;
|
||||
|
||||
function android_app_entry(param: pointer): Pointer; cdecl;
|
||||
var android_app: Pandroid_app;
|
||||
looper: PALooper;
|
||||
begin
|
||||
android_app := Pandroid_app(param);
|
||||
|
||||
android_app^.config := AConfiguration_new();
|
||||
AConfiguration_fromAssetManager(android_app^.config, android_app^.activity^.assetManager);
|
||||
|
||||
print_cur_config(android_app);
|
||||
|
||||
android_app^.cmdPollSource.id := LOOPER_ID_MAIN;
|
||||
android_app^.cmdPollSource.app := android_app;
|
||||
android_app^.cmdPollSource.process := @process_cmd;
|
||||
android_app^.inputPollSource.id := LOOPER_ID_INPUT;
|
||||
android_app^.inputPollSource.app := android_app;
|
||||
android_app^.inputPollSource.process := @process_input;
|
||||
|
||||
looper := ALooper_prepare(ALOOPER_PREPARE_ALLOW_NON_CALLBACKS);
|
||||
ALooper_addFd(looper, android_app^.msgread, LOOPER_ID_MAIN, ALOOPER_EVENT_INPUT, nil,
|
||||
@android_app^.cmdPollSource);
|
||||
android_app^.looper := looper;
|
||||
|
||||
pthread_mutex_lock(@android_app^.mutex);
|
||||
android_app^.running := 1;
|
||||
pthread_cond_broadcast(@android_app^.cond);
|
||||
pthread_mutex_unlock(@android_app^.mutex);
|
||||
|
||||
android_main(android_app);
|
||||
|
||||
android_app_destroy(android_app);
|
||||
result := nil;
|
||||
end;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Native activity interaction (called from main thread)
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
function android_app_create(activity: PANativeActivity; savedState: Pointer; savedStateSize: csize_t): Pandroid_app;
|
||||
var android_app: Pandroid_app;
|
||||
msgpipe: array[0..1] of cint;
|
||||
attr: pthread_attr_t;
|
||||
begin
|
||||
android_app := Pandroid_app(malloc(sizeof(Tandroid_app)));
|
||||
fillchar(android_app^, sizeof(tandroid_app), 0);
|
||||
android_app^.activity := activity;
|
||||
|
||||
pthread_mutex_init(@android_app^.mutex, nil);
|
||||
pthread_cond_init(@android_app^.cond, nil);
|
||||
|
||||
if (savedState <> nil) then
|
||||
begin
|
||||
android_app^.savedState := malloc(savedStateSize);
|
||||
android_app^.savedStateSize := savedStateSize;
|
||||
move(pbyte(savedState)^, pbyte(android_app^.savedState)^, savedStateSize);
|
||||
end;
|
||||
|
||||
if FpPipe(msgpipe) <> 0 then
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','could not create pipe: %s', strerror(errno));
|
||||
|
||||
android_app^.msgread := msgpipe[0];
|
||||
android_app^.msgwrite := msgpipe[1];
|
||||
|
||||
pthread_attr_init(@attr);
|
||||
pthread_attr_setdetachstate(@attr, PTHREAD_CREATE_DETACHED);
|
||||
pthread_create(@android_app^.thread, @attr, @android_app_entry, android_app);
|
||||
|
||||
// Wait for thread to start.
|
||||
pthread_mutex_lock(@android_app^.mutex);
|
||||
while android_app^.running = 0 do
|
||||
pthread_cond_wait(@android_app^.cond, @android_app^.mutex);
|
||||
|
||||
pthread_mutex_unlock(@android_app^.mutex);
|
||||
|
||||
result := android_app;
|
||||
end;
|
||||
|
||||
procedure android_app_write_cmd(android_app: Pandroid_app; cmd: cint8);
|
||||
begin
|
||||
if fpwrite(android_app^.msgwrite, cmd, sizeof(cmd)) <> sizeof(cmd) then
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','Failure writing android_app cmd: %s', strerror(errno));
|
||||
end;
|
||||
|
||||
procedure android_app_set_input(android_app: Pandroid_app; inputQueue: PAInputQueue);
|
||||
begin
|
||||
pthread_mutex_lock(@android_app^.mutex);
|
||||
android_app^.pendingInputQueue := inputQueue;
|
||||
android_app_write_cmd(android_app, APP_CMD_INPUT_CHANGED);
|
||||
while (android_app^.inputQueue <> android_app^.pendingInputQueue) do
|
||||
pthread_cond_wait(@android_app^.cond, @android_app^.mutex);
|
||||
pthread_mutex_unlock(@android_app^.mutex);
|
||||
end;
|
||||
|
||||
procedure android_app_set_window(android_app: Pandroid_app; window: PANativeWindow);
|
||||
begin
|
||||
pthread_mutex_lock(@android_app^.mutex);
|
||||
if (android_app^.pendingWindow <> nil) then
|
||||
android_app_write_cmd(android_app, APP_CMD_TERM_WINDOW);
|
||||
|
||||
android_app^.pendingWindow := window;
|
||||
if (window <> nil) then
|
||||
android_app_write_cmd(android_app, APP_CMD_INIT_WINDOW);
|
||||
|
||||
while (android_app^.window <> android_app^.pendingWindow) do
|
||||
pthread_cond_wait(@android_app^.cond, @android_app^.mutex);
|
||||
|
||||
pthread_mutex_unlock(@android_app^.mutex);
|
||||
end;
|
||||
|
||||
procedure android_app_set_activity_state(android_app: Pandroid_app; cmd: cint8);
|
||||
begin
|
||||
logw(' Setting activity state!');
|
||||
pthread_mutex_lock(@android_app^.mutex);
|
||||
android_app_write_cmd(android_app, cmd);
|
||||
while (android_app^.activityState <> cmd) do
|
||||
pthread_cond_wait(@android_app^.cond, @android_app^.mutex);
|
||||
|
||||
pthread_mutex_unlock(@android_app^.mutex);
|
||||
end;
|
||||
|
||||
procedure android_app_free(android_app: Pandroid_app);
|
||||
begin
|
||||
pthread_mutex_lock(@android_app^.mutex);
|
||||
android_app_write_cmd(android_app, APP_CMD_DESTROY);
|
||||
while android_app^.destroyed = 0 do
|
||||
pthread_cond_wait(@android_app^.cond, @android_app^.mutex);
|
||||
|
||||
pthread_mutex_unlock(@android_app^.mutex);
|
||||
|
||||
fpclose(android_app^.msgread);
|
||||
fpclose(android_app^.msgwrite);
|
||||
pthread_cond_destroy(@android_app^.cond);
|
||||
pthread_mutex_destroy(@android_app^.mutex);
|
||||
free(android_app);
|
||||
end;
|
||||
|
||||
procedure onDestroy(activity: PANativeActivity); cdecl;
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','Destroy: %p', activity);
|
||||
android_app_free(Pandroid_app(activity^.instance));
|
||||
end;
|
||||
|
||||
procedure onStart(activity: PANativeActivity); cdecl;
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','Start: %p', activity);
|
||||
android_app_set_activity_state(Pandroid_app(activity^.instance), APP_CMD_START);
|
||||
end;
|
||||
|
||||
procedure onResume(activity: PANativeActivity); cdecl;
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','Resume: %p', activity);
|
||||
android_app_set_activity_state(Pandroid_app(activity^.instance), APP_CMD_RESUME);
|
||||
end;
|
||||
|
||||
function onSaveInstanceState(activity: PANativeActivity; outLen: pcsize_t): Pointer; cdecl;
|
||||
var android_app: Pandroid_app;
|
||||
savedState: pointer;
|
||||
begin
|
||||
android_app := activity^.instance;
|
||||
savedState := nil;
|
||||
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','SaveInstanceState: %p', activity);
|
||||
pthread_mutex_lock(@android_app^.mutex);
|
||||
android_app^.stateSaved := 0;
|
||||
android_app_write_cmd(android_app, APP_CMD_SAVE_STATE);
|
||||
while android_app^.stateSaved = 0 do
|
||||
pthread_cond_wait(@android_app^.cond, @android_app^.mutex);
|
||||
|
||||
if android_app^.savedState <> nil then
|
||||
begin
|
||||
savedState := android_app^.savedState;
|
||||
outLen^ := android_app^.savedStateSize;
|
||||
android_app^.savedState := nil;
|
||||
android_app^.savedStateSize := 0;
|
||||
end;
|
||||
|
||||
pthread_mutex_unlock(@android_app^.mutex);
|
||||
|
||||
result := savedState;
|
||||
end;
|
||||
|
||||
procedure onPause(activity: PANativeActivity); cdecl;
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','Pause: %p', activity);
|
||||
android_app_set_activity_state(Pandroid_app(activity^.instance), APP_CMD_PAUSE);
|
||||
end;
|
||||
|
||||
procedure onStop(activity: PANativeActivity); cdecl;
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','Stop: %p', activity);
|
||||
android_app_set_activity_state(Pandroid_app(activity^.instance), APP_CMD_STOP);
|
||||
end;
|
||||
|
||||
procedure onConfigurationChanged(activity: PANativeActivity); cdecl;
|
||||
var android_app: Pandroid_app;
|
||||
begin
|
||||
android_app := activity^.instance;
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','ConfigurationChanged: %p', activity);
|
||||
android_app_write_cmd(android_app, APP_CMD_CONFIG_CHANGED);
|
||||
end;
|
||||
|
||||
procedure onLowMemory(activity: PANativeActivity); cdecl;
|
||||
var android_app: Pandroid_app;
|
||||
begin
|
||||
android_app := activity^.instance;
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','LowMemory: %p', activity);
|
||||
android_app_write_cmd(android_app, APP_CMD_LOW_MEMORY);
|
||||
end;
|
||||
|
||||
procedure onWindowFocusChanged(activity: PANativeActivity; focused: cint); cdecl;
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','WindowFocusChanged: %p -- %d', activity, focused);
|
||||
|
||||
if focused <> 0 then
|
||||
android_app_write_cmd(activity^.instance, APP_CMD_GAINED_FOCUS)
|
||||
else
|
||||
android_app_write_cmd(activity^.instance, APP_CMD_LOST_FOCUS);
|
||||
end;
|
||||
|
||||
procedure onNativeWindowCreated(activity: PANativeActivity; window: PANativeWindow); cdecl;
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','NativeWindowCreated: %p -- %p', activity, window);
|
||||
android_app_set_window(activity^.instance, window);
|
||||
end;
|
||||
|
||||
procedure onNativeWindowDestroyed(activity: PANativeActivity; window: PANativeWindow); cdecl;
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','NativeWindowDestroyed: %p -- %p', activity, window);
|
||||
android_app_set_window(activity^.instance, nil);
|
||||
end;
|
||||
|
||||
procedure onInputQueueCreated(activity: PANativeActivity; queue: PAInputQueue); cdecl;
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','InputQueueCreated: %p -- %p', activity, queue);
|
||||
android_app_set_input(activity^.instance, queue);
|
||||
end;
|
||||
|
||||
procedure onInputQueueDestroyed(activity: PANativeActivity; queue: PAInputQueue); cdecl;
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','InputQueueDestroyed: %p -- %p', activity, queue);
|
||||
android_app_set_input(activity^.instance, nil);
|
||||
end;
|
||||
|
||||
procedure ANativeActivity_onCreate(activity: PANativeActivity; savedState: Pointer; savedStateSize: csize_t); cdecl;
|
||||
begin
|
||||
LOGI(ANDROID_LOG_FATAL,'Crap','Creating: %p', activity);
|
||||
activity^.callbacks^.onDestroy := @onDestroy;
|
||||
activity^.callbacks^.onStart := @onStart;
|
||||
activity^.callbacks^.onResume := @onResume;
|
||||
activity^.callbacks^.onSaveInstanceState := @onSaveInstanceState;
|
||||
activity^.callbacks^.onPause := @onPause;
|
||||
activity^.callbacks^.onStop := @onStop;
|
||||
activity^.callbacks^.onConfigurationChanged := @onConfigurationChanged;
|
||||
activity^.callbacks^.onLowMemory := @onLowMemory;
|
||||
activity^.callbacks^.onWindowFocusChanged := @onWindowFocusChanged;
|
||||
activity^.callbacks^.onNativeWindowCreated := @onNativeWindowCreated;
|
||||
activity^.callbacks^.onNativeWindowDestroyed := @onNativeWindowDestroyed;
|
||||
activity^.callbacks^.onInputQueueCreated := @onInputQueueCreated;
|
||||
activity^.callbacks^.onInputQueueDestroyed := @onInputQueueDestroyed;
|
||||
|
||||
activity^.instance := android_app_create(activity, savedState, savedStateSize);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
133
bindings/android-ndk/asset_manager.pas
Normal file
133
bindings/android-ndk/asset_manager.pas
Normal file
@ -0,0 +1,133 @@
|
||||
{*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*}
|
||||
unit asset_manager;
|
||||
|
||||
interface
|
||||
|
||||
uses ctypes;
|
||||
|
||||
type
|
||||
PAAssetManager = ^AAssetManager;
|
||||
AAssetManager = record end;
|
||||
|
||||
AAssetDir = record end;
|
||||
|
||||
AAsset = record end;
|
||||
|
||||
PAAssetDir = ^AAssetDir;
|
||||
PAAsset = ^AAsset;
|
||||
Poff_t = ^coff_t;
|
||||
|
||||
(* Available modes for opening assets *)
|
||||
const
|
||||
AASSET_MODE_UNKNOWN = 0;
|
||||
AASSET_MODE_RANDOM = 1;
|
||||
AASSET_MODE_STREAMING = 2;
|
||||
AASSET_MODE_BUFFER = 3;
|
||||
|
||||
|
||||
(**
|
||||
* Open the named directory within the asset hierarchy. The directory can then
|
||||
* be inspected with the AAssetDir functions. To open the top-level directory,
|
||||
* pass in "" as the dirName.
|
||||
*
|
||||
* The object returned here should be freed by calling AAssetDir_close().
|
||||
*)
|
||||
function AAssetManager_openDir(mgr: PAAssetManager; dirName: Pchar): PAAssetDir; cdecl; external;
|
||||
|
||||
(**
|
||||
* Open an asset.
|
||||
*
|
||||
* The object returned here should be freed by calling AAsset_close().
|
||||
*)
|
||||
function AAssetManager_open(mgr: PAAssetManager; filename: Pchar; mode: cint): PAAsset; cdecl; external;
|
||||
|
||||
(**
|
||||
* Iterate over the files in an asset directory. A NULL string is returned
|
||||
* when all the file names have been returned.
|
||||
*
|
||||
* The returned file name is suitable for passing to AAssetManager_open().
|
||||
*
|
||||
* The string returned here is owned by the AssetDir implementation and is not
|
||||
* guaranteed to remain valid if any other calls are made on this AAssetDir
|
||||
* instance.
|
||||
*)
|
||||
function AAssetDir_getNextFileName(assetDir: PAAssetDir): Pchar; cdecl; external;
|
||||
|
||||
(**
|
||||
* Reset the iteration state of AAssetDir_getNextFileName() to the beginning.
|
||||
*)
|
||||
procedure AAssetDir_rewind(assetDir: PAAssetDir); cdecl; external;
|
||||
|
||||
(**
|
||||
* Close an opened AAssetDir, freeing any related resources.
|
||||
*)
|
||||
procedure AAssetDir_close(assetDir: PAAssetDir); cdecl; external;
|
||||
|
||||
(**
|
||||
* Attempt to read 'count' bytes of data from the current offset.
|
||||
*
|
||||
* Returns the number of bytes read, zero on EOF, or < 0 on error.
|
||||
*)
|
||||
function AAsset_read(asset: PAAsset; buf: Pointer; count: csize_t): cint; cdecl; external;
|
||||
|
||||
(**
|
||||
* Seek to the specified offset within the asset data. 'whence' uses the
|
||||
* same constants as lseek()/fseek().
|
||||
*
|
||||
* Returns the new position on success, or (off_t) -1 on error.
|
||||
*)
|
||||
function AAsset_seek(asset: PAAsset; offset: coff_t; whence: cint): coff_t; cdecl; external;
|
||||
|
||||
(**
|
||||
* Close the asset, freeing all associated resources.
|
||||
*)
|
||||
procedure AAsset_close(asset: PAAsset); cdecl; external;
|
||||
|
||||
(**
|
||||
* Get a pointer to a buffer holding the entire contents of the assset.
|
||||
*
|
||||
* Returns NULL on failure.
|
||||
*)
|
||||
function AAsset_getBuffer(asset: PAAsset): Pointer; cdecl; external;
|
||||
|
||||
(**
|
||||
* Report the total size of the asset data.
|
||||
*)
|
||||
function AAsset_getLength(asset: PAAsset): coff_t; cdecl; external;
|
||||
|
||||
(**
|
||||
* Report the total amount of asset data that can be read from the current position.
|
||||
*)
|
||||
function AAsset_getRemainingLength(asset: PAAsset): coff_t; cdecl; external;
|
||||
|
||||
(**
|
||||
* Open a new file descriptor that can be used to read the asset data.
|
||||
*
|
||||
* Returns < 0 if direct fd access is not possible (for example, if the asset is
|
||||
* compressed).
|
||||
*)
|
||||
function AAsset_openFileDescriptor(asset: PAAsset; outStart, outLength: Poff_t): cint; cdecl; external;
|
||||
|
||||
(**
|
||||
* Returns whether this asset's internal buffer is allocated in ordinary RAM (i.e. not
|
||||
* mmapped).
|
||||
*)
|
||||
function AAsset_isAllocated(asset: PAAsset): cint; cdecl; external;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
306
bindings/android-ndk/configuration.pas
Normal file
306
bindings/android-ndk/configuration.pas
Normal file
@ -0,0 +1,306 @@
|
||||
(*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*)
|
||||
|
||||
unit configuration;
|
||||
|
||||
interface
|
||||
|
||||
uses ctypes, asset_manager;
|
||||
|
||||
const
|
||||
LibName = 'libandroid.so';
|
||||
|
||||
type
|
||||
PAConfiguration = ^AConfiguration;
|
||||
AConfiguration = record end;
|
||||
|
||||
const
|
||||
ACONFIGURATION_ORIENTATION_ANY = $0000;
|
||||
ACONFIGURATION_ORIENTATION_PORT = $0001;
|
||||
ACONFIGURATION_ORIENTATION_LAND = $0002;
|
||||
ACONFIGURATION_ORIENTATION_SQUARE = $0003;
|
||||
ACONFIGURATION_TOUCHSCREEN_ANY = $0000;
|
||||
ACONFIGURATION_TOUCHSCREEN_NOTOUCH = $0001;
|
||||
ACONFIGURATION_TOUCHSCREEN_STYLUS = $0002;
|
||||
ACONFIGURATION_TOUCHSCREEN_FINGER = $0003;
|
||||
ACONFIGURATION_DENSITY_DEFAULT = 0;
|
||||
ACONFIGURATION_DENSITY_LOW = 120;
|
||||
ACONFIGURATION_DENSITY_MEDIUM = 160;
|
||||
ACONFIGURATION_DENSITY_HIGH = 240;
|
||||
ACONFIGURATION_DENSITY_NONE = $ffff;
|
||||
ACONFIGURATION_KEYBOARD_ANY = $0000;
|
||||
ACONFIGURATION_KEYBOARD_NOKEYS = $0001;
|
||||
ACONFIGURATION_KEYBOARD_QWERTY = $0002;
|
||||
ACONFIGURATION_KEYBOARD_12KEY = $0003;
|
||||
ACONFIGURATION_NAVIGATION_ANY = $0000;
|
||||
ACONFIGURATION_NAVIGATION_NONAV = $0001;
|
||||
ACONFIGURATION_NAVIGATION_DPAD = $0002;
|
||||
ACONFIGURATION_NAVIGATION_TRACKBALL = $0003;
|
||||
ACONFIGURATION_NAVIGATION_WHEEL = $0004;
|
||||
ACONFIGURATION_KEYSHIDDEN_ANY = $0000;
|
||||
ACONFIGURATION_KEYSHIDDEN_NO = $0001;
|
||||
ACONFIGURATION_KEYSHIDDEN_YES = $0002;
|
||||
ACONFIGURATION_KEYSHIDDEN_SOFT = $0003;
|
||||
ACONFIGURATION_NAVHIDDEN_ANY = $0000;
|
||||
ACONFIGURATION_NAVHIDDEN_NO = $0001;
|
||||
ACONFIGURATION_NAVHIDDEN_YES = $0002;
|
||||
ACONFIGURATION_SCREENSIZE_ANY = $00;
|
||||
ACONFIGURATION_SCREENSIZE_SMALL = $01;
|
||||
ACONFIGURATION_SCREENSIZE_NORMAL = $02;
|
||||
ACONFIGURATION_SCREENSIZE_LARGE = $03;
|
||||
ACONFIGURATION_SCREENSIZE_XLARGE = $04;
|
||||
ACONFIGURATION_SCREENLONG_ANY = $00;
|
||||
ACONFIGURATION_SCREENLONG_NO = $1;
|
||||
ACONFIGURATION_SCREENLONG_YES = $2;
|
||||
ACONFIGURATION_UI_MODE_TYPE_ANY = $00;
|
||||
ACONFIGURATION_UI_MODE_TYPE_NORMAL = $01;
|
||||
ACONFIGURATION_UI_MODE_TYPE_DESK = $02;
|
||||
ACONFIGURATION_UI_MODE_TYPE_CAR = $03;
|
||||
ACONFIGURATION_UI_MODE_NIGHT_ANY = $00;
|
||||
ACONFIGURATION_UI_MODE_NIGHT_NO = $1;
|
||||
ACONFIGURATION_UI_MODE_NIGHT_YES = $2;
|
||||
ACONFIGURATION_MCC = $0001;
|
||||
ACONFIGURATION_MNC = $0002;
|
||||
ACONFIGURATION_LOCALE = $0004;
|
||||
ACONFIGURATION_TOUCHSCREEN = $0008;
|
||||
ACONFIGURATION_KEYBOARD = $0010;
|
||||
ACONFIGURATION_KEYBOARD_HIDDEN = $0020;
|
||||
ACONFIGURATION_NAVIGATION = $0040;
|
||||
ACONFIGURATION_ORIENTATION = $0080;
|
||||
ACONFIGURATION_DENSITY = $0100;
|
||||
ACONFIGURATION_SCREEN_SIZE = $0200;
|
||||
ACONFIGURATION_VERSION = $0400;
|
||||
ACONFIGURATION_SCREEN_LAYOUT = $0800;
|
||||
ACONFIGURATION_UI_MODE = $1000;
|
||||
|
||||
(**
|
||||
* Create a new AConfiguration, initialized with no values set.
|
||||
*)
|
||||
function AConfiguration_new: PAConfiguration; cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Free an AConfiguration that was previously created with
|
||||
* AConfiguration_new().
|
||||
*)
|
||||
procedure AConfiguration_delete(config: PAConfiguration); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Create and return a new AConfiguration based on the current configuration in
|
||||
* use in the given AssetManager.
|
||||
*)
|
||||
procedure AConfiguration_fromAssetManager(out_: PAConfiguration; am: PAAssetManager); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Copy the contents of 'src' to 'dest'.
|
||||
*)
|
||||
procedure AConfiguration_copy(dest, src: PAConfiguration); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Return the current MCC set in the configuration. 0 if not set.
|
||||
*)
|
||||
function AConfiguration_getMcc(config: PAConfiguration): cint32; cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Set the current MCC in the configuration. 0 to clear.
|
||||
*)
|
||||
procedure AConfiguration_setMcc(config: PAConfiguration; mcc: cint32); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Return the current MNC set in the configuration. 0 if not set.
|
||||
*)
|
||||
function AConfiguration_getMnc(config: PAConfiguration): cint32; cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Set the current MNC in the configuration. 0 to clear.
|
||||
*)
|
||||
procedure AConfiguration_setMnc(config: PAConfiguration; mnc: cint32); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Return the current language code set in the configuration. The output will
|
||||
* be filled with an array of two characters. They are not 0-terminated. If
|
||||
* a language is not set, they will be 0.
|
||||
*)
|
||||
procedure AConfiguration_getLanguage(config: PAConfiguration; outLanguage: Pchar); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Set the current language code in the configuration, from the first two
|
||||
* characters in the string.
|
||||
*)
|
||||
procedure AConfiguration_setLanguage(config: PAConfiguration; language: Pchar); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Return the current country code set in the configuration. The output will
|
||||
* be filled with an array of two characters. They are not 0-terminated. If
|
||||
* a country is not set, they will be 0.
|
||||
*)
|
||||
procedure AConfiguration_getCountry(config: PAConfiguration; outCountry: Pchar); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Set the current country code in the configuration, from the first two
|
||||
* characters in the string.
|
||||
*)
|
||||
procedure AConfiguration_setCountry(config: PAConfiguration; country: Pchar); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Return the current ACONFIGURATION_ORIENTATION_* set in the configuration.
|
||||
*)
|
||||
function AConfiguration_getOrientation(config: PAConfiguration): cint32; cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Set the current orientation in the configuration.
|
||||
*)
|
||||
procedure AConfiguration_setOrientation(config: PAConfiguration; orientation: cint32); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Return the current ACONFIGURATION_TOUCHSCREEN_* set in the configuration.
|
||||
*)
|
||||
function AConfiguration_getTouchscreen(config: PAConfiguration): cint32; cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Set the current touchscreen in the configuration.
|
||||
*)
|
||||
procedure AConfiguration_setTouchscreen(config: PAConfiguration; touchscreen: cint32); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Return the current ACONFIGURATION_DENSITY_* set in the configuration.
|
||||
*)
|
||||
function AConfiguration_getDensity(config: PAConfiguration): cint32; cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Set the current density in the configuration.
|
||||
*)
|
||||
procedure AConfiguration_setDensity(config: PAConfiguration; density: cint32); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Return the current ACONFIGURATION_KEYBOARD_* set in the configuration.
|
||||
*)
|
||||
function AConfiguration_getKeyboard(config: PAConfiguration): cint32; cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Set the current keyboard in the configuration.
|
||||
*)
|
||||
procedure AConfiguration_setKeyboard(config: PAConfiguration; keyboard: cint32); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Return the current ACONFIGURATION_NAVIGATION_* set in the configuration.
|
||||
*)
|
||||
function AConfiguration_getNavigation(config: PAConfiguration): cint32; cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Set the current navigation in the configuration.
|
||||
*)
|
||||
procedure AConfiguration_setNavigation(config: PAConfiguration; navigation: cint32); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Return the current ACONFIGURATION_KEYSHIDDEN_* set in the configuration.
|
||||
*)
|
||||
function AConfiguration_getKeysHidden(config: PAConfiguration): cint32; cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Set the current keys hidden in the configuration.
|
||||
*)
|
||||
procedure AConfiguration_setKeysHidden(config: PAConfiguration; keysHidden: cint32); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Return the current ACONFIGURATION_NAVHIDDEN_* set in the configuration.
|
||||
*)
|
||||
function AConfiguration_getNavHidden(config: PAConfiguration): cint32; cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Set the current nav hidden in the configuration.
|
||||
*)
|
||||
procedure AConfiguration_setNavHidden(config: PAConfiguration; navHidden: cint32); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Return the current SDK (API) version set in the configuration.
|
||||
*)
|
||||
function AConfiguration_getSdkVersion(config: PAConfiguration): cint32; cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Set the current SDK version in the configuration.
|
||||
*)
|
||||
procedure AConfiguration_setSdkVersion(config: PAConfiguration; sdkVersion: cint32); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Return the current ACONFIGURATION_SCREENSIZE_* set in the configuration.
|
||||
*)
|
||||
function AConfiguration_getScreenSize(config: PAConfiguration): cint32; cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Set the current screen size in the configuration.
|
||||
*)
|
||||
procedure AConfiguration_setScreenSize(config: PAConfiguration; screenSize: cint32); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Return the current ACONFIGURATION_SCREENLONG_* set in the configuration.
|
||||
*)
|
||||
function AConfiguration_getScreenLong(config: PAConfiguration): cint32; cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Set the current screen long in the configuration.
|
||||
*)
|
||||
procedure AConfiguration_setScreenLong(config: PAConfiguration; screenLong: cint32); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Return the current ACONFIGURATION_UI_MODE_TYPE_* set in the configuration.
|
||||
*)
|
||||
function AConfiguration_getUiModeType(config: PAConfiguration): cint32; cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Set the current UI mode type in the configuration.
|
||||
*)
|
||||
procedure AConfiguration_setUiModeType(config: PAConfiguration; uiModeType: cint32); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Return the current ACONFIGURATION_UI_MODE_NIGHT_* set in the configuration.
|
||||
*)
|
||||
function AConfiguration_getUiModeNight(config: PAConfiguration): cint32; cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Set the current UI mode night in the configuration.
|
||||
*)
|
||||
procedure AConfiguration_setUiModeNight(config: PAConfiguration; uiModeNight: cint32); cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Perform a diff between two configurations. Returns a bit mask of
|
||||
* ACONFIGURATION_* constants, each bit set meaning that configuration element
|
||||
* is different between them.
|
||||
*)
|
||||
function AConfiguration_diff(config1, config2: PAConfiguration): cint32; cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Determine whether 'base' is a valid configuration for use within the
|
||||
* environment 'requested'. Returns 0 if there are any values in 'base'
|
||||
* that conflict with 'requested'. Returns 1 if it does not conflict.
|
||||
*)
|
||||
function AConfiguration_match(base, requested: PAConfiguration): cint32; cdecl; external LibName;
|
||||
|
||||
(**
|
||||
* Determine whether the configuration in 'test' is better than the existing
|
||||
* configuration in 'base'. If 'requested' is non-NULL, this decision is based
|
||||
* on the overall configuration given there. If it is NULL, this decision is
|
||||
* simply based on which configuration is more specific. Returns non-0 if
|
||||
* 'test' is better than 'base'.
|
||||
*
|
||||
* This assumes you have already filtered the configurations with
|
||||
* AConfiguration_match().
|
||||
*)
|
||||
function AConfiguration_isBetterThan(base, test, requested: PAConfiguration) : cint32; cdecl; external LibName;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
323
bindings/android-ndk/egl.pas
Normal file
323
bindings/android-ndk/egl.pas
Normal file
@ -0,0 +1,323 @@
|
||||
{
|
||||
** Copyright (c) 2007-2009 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
}
|
||||
|
||||
unit egl;
|
||||
|
||||
interface
|
||||
|
||||
uses ctypes
|
||||
{$IF DEFINED(WINDOWS)}
|
||||
,windows
|
||||
{$ELSEIF DEFINED(ANDROID)}
|
||||
{$ELSEIF DEFINED(UNIX)}
|
||||
,x,xlib,xutil
|
||||
{$ENDIF};
|
||||
|
||||
const
|
||||
LibName = 'libEGL.so';
|
||||
|
||||
type
|
||||
EGLBoolean = cuint;
|
||||
EGLenum = cuint;
|
||||
EGLint = cint;
|
||||
|
||||
PEGLint = ^EGLint;
|
||||
|
||||
type
|
||||
EGLConfig = Pointer;
|
||||
EGLContext = Pointer;
|
||||
EGLDisplay = Pointer;
|
||||
EGLSurface = Pointer;
|
||||
EGLClientBuffer = Pointer;
|
||||
|
||||
PEGLConfig = ^EGLConfig;
|
||||
|
||||
{$IF defined(WINDOWS)}
|
||||
EGLNativeDisplayType = HDC;
|
||||
EGLNativePixmapType = HBITMAP;
|
||||
EGLNativeWindowType = HWINDOW;
|
||||
{$ELSEIF defined(SYMBIAN)}
|
||||
EGLNativeDisplayType = cint;
|
||||
EGLNativePixmapType = Pointer;
|
||||
EGLNativeWindowType = Pointer;
|
||||
{$ELSEIF defined(ANDROID)}
|
||||
EGLNativeDisplayType = Pointer;
|
||||
EGLNativePixmapType = Pointer;
|
||||
EGLNativeWindowType = Pointer;
|
||||
{$ELSEIF defined(UNIX)}
|
||||
EGLNativeDisplayType = PDisplay;
|
||||
EGLNativePixmapType = TPixmap;
|
||||
EGLNativeWindowType = TWindow;
|
||||
{$ENDIF}
|
||||
|
||||
NativeDisplayType = EGLNativeDisplayType;
|
||||
NativePixmapType = EGLNativePixmapType;
|
||||
NativeWindowType = EGLNativeWindowType;
|
||||
|
||||
(* EGL Versioning *)
|
||||
|
||||
const
|
||||
EGL_VERSION_1_0 = 1;
|
||||
EGL_VERSION_1_1 = 1;
|
||||
EGL_VERSION_1_2 = 1;
|
||||
EGL_VERSION_1_3 = 1;
|
||||
EGL_VERSION_1_4 = 1;
|
||||
(* EGL Enumerants. Bitmasks and other exceptional cases aside, most
|
||||
* enums are assigned unique values starting at 0x3000.
|
||||
*)
|
||||
|
||||
(* EGL aliases *)
|
||||
|
||||
EGL_FALSE = 0;
|
||||
EGL_TRUE = 1;
|
||||
(* Out-of-band handle values *)
|
||||
|
||||
EGL_DEFAULT_DISPLAY = EGLNativeDisplayType(0);
|
||||
EGL_NO_CONTEXT = EGLContext(0);
|
||||
EGL_NO_DISPLAY = EGLDisplay(0);
|
||||
EGL_NO_SURFACE = EGLSurface(0);
|
||||
(* Out-of-band attribute value *)
|
||||
|
||||
EGL_DONT_CARE = -1;
|
||||
(* Errors / GetError return values *)
|
||||
|
||||
EGL_SUCCESS = $3000;
|
||||
EGL_NOT_INITIALIZED = $3001;
|
||||
EGL_BAD_ACCESS = $3002;
|
||||
EGL_BAD_ALLOC = $3003;
|
||||
EGL_BAD_ATTRIBUTE = $3004;
|
||||
EGL_BAD_CONFIG = $3005;
|
||||
EGL_BAD_CONTEXT = $3006;
|
||||
EGL_BAD_CURRENT_SURFACE = $3007;
|
||||
EGL_BAD_DISPLAY = $3008;
|
||||
EGL_BAD_MATCH = $3009;
|
||||
EGL_BAD_NATIVE_PIXMAP = $300A;
|
||||
EGL_BAD_NATIVE_WINDOW = $300B;
|
||||
EGL_BAD_PARAMETER = $300C;
|
||||
EGL_BAD_SURFACE = $300D;
|
||||
EGL_CONTEXT_LOST = $300E; (* EGL 1.1 - IMG_power_management *)
|
||||
(* Reserved 0x300F-0x301F for additional errors *)
|
||||
|
||||
(* Config attributes *)
|
||||
|
||||
EGL_BUFFER_SIZE = $3020;
|
||||
EGL_ALPHA_SIZE = $3021;
|
||||
EGL_BLUE_SIZE = $3022;
|
||||
EGL_GREEN_SIZE = $3023;
|
||||
EGL_RED_SIZE = $3024;
|
||||
EGL_DEPTH_SIZE = $3025;
|
||||
EGL_STENCIL_SIZE = $3026;
|
||||
EGL_CONFIG_CAVEAT = $3027;
|
||||
EGL_CONFIG_ID = $3028;
|
||||
EGL_LEVEL = $3029;
|
||||
EGL_MAX_PBUFFER_HEIGHT = $302A;
|
||||
EGL_MAX_PBUFFER_PIXELS = $302B;
|
||||
EGL_MAX_PBUFFER_WIDTH = $302C;
|
||||
EGL_NATIVE_RENDERABLE = $302D;
|
||||
EGL_NATIVE_VISUAL_ID = $302E;
|
||||
EGL_NATIVE_VISUAL_TYPE = $302F;
|
||||
EGL_SAMPLES = $3031;
|
||||
EGL_SAMPLE_BUFFERS = $3032;
|
||||
EGL_SURFACE_TYPE = $3033;
|
||||
EGL_TRANSPARENT_TYPE = $3034;
|
||||
EGL_TRANSPARENT_BLUE_VALUE = $3035;
|
||||
EGL_TRANSPARENT_GREEN_VALUE = $3036;
|
||||
EGL_TRANSPARENT_RED_VALUE = $3037;
|
||||
EGL_NONE = $3038; (* Attrib list terminator *)
|
||||
EGL_BIND_TO_TEXTURE_RGB = $3039;
|
||||
EGL_BIND_TO_TEXTURE_RGBA = $303A;
|
||||
EGL_MIN_SWAP_INTERVAL = $303B;
|
||||
EGL_MAX_SWAP_INTERVAL = $303C;
|
||||
EGL_LUMINANCE_SIZE = $303D;
|
||||
EGL_ALPHA_MASK_SIZE = $303E;
|
||||
EGL_COLOR_BUFFER_TYPE = $303F;
|
||||
EGL_RENDERABLE_TYPE = $3040;
|
||||
EGL_MATCH_NATIVE_PIXMAP = $3041; (* Pseudo-attribute (not queryable) *)
|
||||
EGL_CONFORMANT = $3042;
|
||||
(* Reserved 0x3041-0x304F for additional config attributes *)
|
||||
|
||||
(* Config attribute values *)
|
||||
|
||||
EGL_SLOW_CONFIG = $3050; (* EGL_CONFIG_CAVEAT value *)
|
||||
EGL_NON_CONFORMANT_CONFIG = $3051; (* EGL_CONFIG_CAVEAT value *)
|
||||
EGL_TRANSPARENT_RGB = $3052; (* EGL_TRANSPARENT_TYPE value *)
|
||||
EGL_RGB_BUFFER = $308E; (* EGL_COLOR_BUFFER_TYPE value *)
|
||||
EGL_LUMINANCE_BUFFER = $308F; (* EGL_COLOR_BUFFER_TYPE value *)
|
||||
(* More config attribute values, for EGL_TEXTURE_FORMAT *)
|
||||
|
||||
EGL_NO_TEXTURE = $305C;
|
||||
EGL_TEXTURE_RGB = $305D;
|
||||
EGL_TEXTURE_RGBA = $305E;
|
||||
EGL_TEXTURE_2D = $305F;
|
||||
(* Config attribute mask bits *)
|
||||
|
||||
EGL_PBUFFER_BIT = $0001; (* EGL_SURFACE_TYPE mask bits *)
|
||||
EGL_PIXMAP_BIT = $0002; (* EGL_SURFACE_TYPE mask bits *)
|
||||
EGL_WINDOW_BIT = $0004; (* EGL_SURFACE_TYPE mask bits *)
|
||||
EGL_VG_COLORSPACE_LINEAR_BIT = $0020; (* EGL_SURFACE_TYPE mask bits *)
|
||||
EGL_VG_ALPHA_FORMAT_PRE_BIT = $0040; (* EGL_SURFACE_TYPE mask bits *)
|
||||
EGL_MULTISAMPLE_RESOLVE_BOX_BIT = $0200; (* EGL_SURFACE_TYPE mask bits *)
|
||||
EGL_SWAP_BEHAVIOR_PRESERVED_BIT = $0400; (* EGL_SURFACE_TYPE mask bits *)
|
||||
EGL_OPENGL_ES_BIT = $0001; (* EGL_RENDERABLE_TYPE mask bits *)
|
||||
EGL_OPENVG_BIT = $0002; (* EGL_RENDERABLE_TYPE mask bits *)
|
||||
EGL_OPENGL_ES2_BIT = $0004; (* EGL_RENDERABLE_TYPE mask bits *)
|
||||
EGL_OPENGL_BIT = $0008; (* EGL_RENDERABLE_TYPE mask bits *)
|
||||
(* QueryString targets *)
|
||||
|
||||
EGL_VENDOR = $3053;
|
||||
EGL_VERSION = $3054;
|
||||
EGL_EXTENSIONS = $3055;
|
||||
EGL_CLIENT_APIS = $308D;
|
||||
(* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets *)
|
||||
|
||||
EGL_HEIGHT = $3056;
|
||||
EGL_WIDTH = $3057;
|
||||
EGL_LARGEST_PBUFFER = $3058;
|
||||
EGL_TEXTURE_FORMAT = $3080;
|
||||
EGL_TEXTURE_TARGET = $3081;
|
||||
EGL_MIPMAP_TEXTURE = $3082;
|
||||
EGL_MIPMAP_LEVEL = $3083;
|
||||
EGL_RENDER_BUFFER = $3086;
|
||||
EGL_VG_COLORSPACE = $3087;
|
||||
EGL_VG_ALPHA_FORMAT = $3088;
|
||||
EGL_HORIZONTAL_RESOLUTION = $3090;
|
||||
EGL_VERTICAL_RESOLUTION = $3091;
|
||||
EGL_PIXEL_ASPECT_RATIO = $3092;
|
||||
EGL_SWAP_BEHAVIOR = $3093;
|
||||
EGL_MULTISAMPLE_RESOLVE = $3099;
|
||||
(* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets *)
|
||||
|
||||
EGL_BACK_BUFFER = $3084;
|
||||
EGL_SINGLE_BUFFER = $3085;
|
||||
(* OpenVG color spaces *)
|
||||
|
||||
EGL_VG_COLORSPACE_sRGB = $3089; (* EGL_VG_COLORSPACE value *)
|
||||
EGL_VG_COLORSPACE_LINEAR = $308A; (* EGL_VG_COLORSPACE value *)
|
||||
(* OpenVG alpha formats *)
|
||||
|
||||
EGL_VG_ALPHA_FORMAT_NONPRE = $308B; (* EGL_ALPHA_FORMAT value *)
|
||||
EGL_VG_ALPHA_FORMAT_PRE = $308C; (* EGL_ALPHA_FORMAT value *)
|
||||
(* Constant scale factor by which fractional display resolutions &
|
||||
* aspect ratio are scaled when queried as integer values.
|
||||
*)
|
||||
|
||||
EGL_DISPLAY_SCALING = 10000;
|
||||
(* Unknown display resolution/aspect ratio *)
|
||||
|
||||
EGL_UNKNOWN = -1;
|
||||
(* Back buffer swap behaviors *)
|
||||
|
||||
EGL_BUFFER_PRESERVED = $3094; (* EGL_SWAP_BEHAVIOR value *)
|
||||
EGL_BUFFER_DESTROYED = $3095; (* EGL_SWAP_BEHAVIOR value *)
|
||||
(* CreatePbufferFromClientBuffer buffer types *)
|
||||
|
||||
EGL_OPENVG_IMAGE = $3096;
|
||||
(* QueryContext targets *)
|
||||
|
||||
EGL_CONTEXT_CLIENT_TYPE = $3097;
|
||||
(* CreateContext attributes *)
|
||||
|
||||
EGL_CONTEXT_CLIENT_VERSION = $3098;
|
||||
(* Multisample resolution behaviors *)
|
||||
|
||||
EGL_MULTISAMPLE_RESOLVE_DEFAULT = $309A; (* EGL_MULTISAMPLE_RESOLVE value *)
|
||||
EGL_MULTISAMPLE_RESOLVE_BOX = $309B; (* EGL_MULTISAMPLE_RESOLVE value *)
|
||||
(* BindAPI/QueryAPI targets *)
|
||||
|
||||
EGL_OPENGL_ES_API = $30A0;
|
||||
EGL_OPENVG_API = $30A1;
|
||||
EGL_OPENGL_API = $30A2;
|
||||
(* GetCurrentSurface targets *)
|
||||
|
||||
EGL_DRAW = $3059;
|
||||
EGL_READ = $305A;
|
||||
(* WaitNative engines *)
|
||||
|
||||
EGL_CORE_NATIVE_ENGINE = $305B;
|
||||
(* EGL 1.2 tokens renamed for consistency in EGL 1.3 *)
|
||||
|
||||
EGL_COLORSPACE = EGL_VG_COLORSPACE;
|
||||
EGL_ALPHA_FORMAT = EGL_VG_ALPHA_FORMAT;
|
||||
EGL_COLORSPACE_sRGB = EGL_VG_COLORSPACE_sRGB;
|
||||
EGL_COLORSPACE_LINEAR = EGL_VG_COLORSPACE_LINEAR;
|
||||
EGL_ALPHA_FORMAT_NONPRE = EGL_VG_ALPHA_FORMAT_NONPRE;
|
||||
EGL_ALPHA_FORMAT_PRE = EGL_VG_ALPHA_FORMAT_PRE;
|
||||
(* EGL extensions must request enum blocks from the Khronos
|
||||
* API Registrar, who maintains the enumerant registry. Submit
|
||||
* a bug in Khronos Bugzilla against task "Registry".
|
||||
*)
|
||||
|
||||
|
||||
(* EGL Functions *)
|
||||
|
||||
function eglGetError: EGLint; cdecl; external LibName;
|
||||
|
||||
function eglGetDisplay(display_id: EGLNativeDisplayType): EGLDisplay; cdecl; external LibName;
|
||||
function eglInitialize(dpy: EGLDisplay; major, minor: PEGLint): EGLBoolean; cdecl; external LibName;
|
||||
function eglTerminate(dpy: EGLDisplay): EGLBoolean; cdecl; external LibName;
|
||||
|
||||
function eglQueryString(dpy: EGLDisplay; name_: EGLint): Pchar; cdecl; external LibName;
|
||||
|
||||
function eglGetConfigs(dpy: EGLDisplay; configs: PEGLConfig; config_size: EGLint; num_config: PEGLint): EGLBoolean; cdecl; external LibName;
|
||||
function eglChooseConfig(dpy: EGLDisplay; attrib_list: PEGLint; configs: PEGLConfig; config_size: EGLint; num_config: PEGLint): EGLBoolean; cdecl; external LibName;
|
||||
function eglGetConfigAttrib(dpy: EGLDisplay; config: EGLConfig; attribute: EGLint; value: PEGLint): EGLBoolean; cdecl; external LibName;
|
||||
function eglCreateWindowSurface(dpy: EGLDisplay; config: EGLConfig; win: EGLNativeWindowType; attrib_list: PEGLint): EGLSurface; cdecl; external LibName;
|
||||
function eglCreatePbufferSurface(dpy: EGLDisplay; config: EGLConfig; attrib_list: PEGLint): EGLSurface; cdecl; external LibName;
|
||||
function eglCreatePixmapSurface(dpy: EGLDisplay; config: EGLConfig; pixmap: EGLNativePixmapType; attrib_list: PEGLint): EGLSurface; cdecl; external LibName;
|
||||
function eglDestroySurface(dpy: EGLDisplay; surface: EGLSurface): EGLBoolean; cdecl; external LibName;
|
||||
function eglQuerySurface(dpy: EGLDisplay; surface: EGLSurface; attribute: EGLint; value: PEGLint): EGLBoolean; cdecl; external LibName;
|
||||
function eglBindAPI(api: EGLenum): EGLBoolean; cdecl; external LibName;
|
||||
function eglQueryAPI: EGLenum; cdecl; external LibName;
|
||||
function eglWaitClient: EGLBoolean; cdecl; external LibName;
|
||||
function eglReleaseThread: EGLBoolean; cdecl; external LibName;
|
||||
function eglCreatePbufferFromClientBuffer(dpy: EGLDisplay; buftype: EGLenum; buffer: EGLClientBuffer; config: EGLConfig; attrib_list: PEGLint): EGLSurface; cdecl; external LibName;
|
||||
function eglSurfaceAttrib(dpy: EGLDisplay; surface: EGLSurface; attribute, value: EGLint): EGLBoolean; cdecl; external LibName;
|
||||
function eglBindTexImage(dpy: EGLDisplay; surface: EGLSurface; buffer: EGLint): EGLBoolean; cdecl; external LibName;
|
||||
function eglReleaseTexImage(dpy: EGLDisplay; surface: EGLSurface; buffer: EGLint): EGLBoolean; cdecl; external LibName;
|
||||
|
||||
function eglSwapInterval(dpy: EGLDisplay; interval: EGLint): EGLBoolean; cdecl; external LibName;
|
||||
|
||||
function eglCreateContext(dpy: EGLDisplay; config: EGLConfig; share_context: EGLContext; attrib_list: PEGLint): EGLContext; cdecl; external LibName;
|
||||
function eglDestroyContext(dpy: EGLDisplay; ctx: EGLContext): EGLBoolean; cdecl; external LibName;
|
||||
function eglMakeCurrent(dpy: EGLDisplay; draw, read_: EGLSurface; ctx: EGLContext): EGLBoolean; cdecl; external LibName;
|
||||
function eglGetCurrentContext: EGLContext; cdecl; external LibName;
|
||||
function eglGetCurrentSurface(readdraw: EGLint): EGLSurface; cdecl; external LibName;
|
||||
function eglGetCurrentDisplay: EGLDisplay; cdecl; external LibName;
|
||||
function eglQueryContext(dpy: EGLDisplay; ctx: EGLContext; attribute: EGLint; value: PEGLint): EGLBoolean; cdecl; external LibName;
|
||||
function eglWaitGL: EGLBoolean; cdecl; external LibName;
|
||||
function eglWaitNative(engine: EGLint): EGLBoolean; cdecl; external LibName;
|
||||
function eglSwapBuffers(dpy: EGLDisplay; surface: EGLSurface): EGLBoolean; cdecl; external LibName;
|
||||
function eglCopyBuffers(dpy: EGLDisplay; surface: EGLSurface; target: EGLNativePixmapType): EGLBoolean; cdecl; external LibName;
|
||||
|
||||
(* This is a generic function pointer type, whose name indicates it must
|
||||
* be cast to the proper type *and calling convention* before use.
|
||||
*)
|
||||
|
||||
type
|
||||
__eglMustCastToProperFunctionPointerType = procedure; cdecl;
|
||||
|
||||
function eglGetProcAddress(procname: Pchar): __eglMustCastToProperFunctionPointerType; cdecl; external LibName;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
0
bindings/android-ndk/eglplatform.pas
Normal file
0
bindings/android-ndk/eglplatform.pas
Normal file
BIN
bindings/android-ndk/examples/test/test.ico
Normal file
BIN
bindings/android-ndk/examples/test/test.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
408
bindings/android-ndk/examples/test/test.lpi
Normal file
408
bindings/android-ndk/examples/test/test.lpi
Normal file
@ -0,0 +1,408 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
</Flags>
|
||||
<MainUnit Value="0"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
<ActiveWindowIndexAtStart Value="0"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1" Active="Default">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<Units Count="23">
|
||||
<Unit0>
|
||||
<Filename Value="test.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="test"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="165"/>
|
||||
<CursorPos X="35" Y="182"/>
|
||||
<UsageCount Value="27"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="android_native_app_glue.pas"/>
|
||||
<UnitName Value="android_native_app_glue"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="89"/>
|
||||
<CursorPos X="13" Y="106"/>
|
||||
<UsageCount Value="13"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="native_activity.pas"/>
|
||||
<UnitName Value="native_activity"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="238"/>
|
||||
<CursorPos X="77" Y="256"/>
|
||||
<UsageCount Value="12"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="asset_manager.pas"/>
|
||||
<UnitName Value="asset_manager"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="87"/>
|
||||
<CursorPos X="1" Y="133"/>
|
||||
<UsageCount Value="12"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="native_window.pas"/>
|
||||
<UnitName Value="native_window"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="23"/>
|
||||
<CursorPos X="16" Y="33"/>
|
||||
<UsageCount Value="12"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="rect.pas"/>
|
||||
<UnitName Value="rect"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="14"/>
|
||||
<CursorPos X="13" Y="24"/>
|
||||
<UsageCount Value="12"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="input.pas"/>
|
||||
<UnitName Value="input"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="70"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<UsageCount Value="12"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="looper.pas"/>
|
||||
<UnitName Value="looper"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="204"/>
|
||||
<CursorPos X="112" Y="228"/>
|
||||
<UsageCount Value="12"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="keycodes.pas"/>
|
||||
<UnitName Value="keycodes"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="112"/>
|
||||
<CursorPos X="1" Y="158"/>
|
||||
<UsageCount Value="12"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
<Filename Value="configuration.pas"/>
|
||||
<UnitName Value="configuration"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="284"/>
|
||||
<CursorPos X="112" Y="301"/>
|
||||
<UsageCount Value="12"/>
|
||||
</Unit9>
|
||||
<Unit10>
|
||||
<Filename Value="D:\src\fpc-real\packages\pthreads\src\pthreads.pp"/>
|
||||
<UnitName Value="pthreads"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="32"/>
|
||||
<CursorPos X="24" Y="29"/>
|
||||
<UsageCount Value="12"/>
|
||||
</Unit10>
|
||||
<Unit11>
|
||||
<Filename Value="D:\src\fpc-real\rtl\unix\initc.pp"/>
|
||||
<UnitName Value="initc"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="1"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit11>
|
||||
<Unit12>
|
||||
<Filename Value="D:\src\fpc-real\rtl\unix\unixtype.pp"/>
|
||||
<UnitName Value="unixtype"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="1"/>
|
||||
<CursorPos X="7" Y="21"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit12>
|
||||
<Unit13>
|
||||
<Filename Value="D:\src\fpc-real\rtl\linux\ptypes.inc"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="196"/>
|
||||
<CursorPos X="18" Y="210"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit13>
|
||||
<Unit14>
|
||||
<Filename Value="D:\src\fpc-real\rtl\inc\cmem.pp"/>
|
||||
<UnitName Value="cmem"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="43"/>
|
||||
<CursorPos X="15" Y="47"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit14>
|
||||
<Unit15>
|
||||
<Filename Value="log.pas"/>
|
||||
<UnitName Value="log"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="4"/>
|
||||
<CursorPos X="24" Y="17"/>
|
||||
<UsageCount Value="12"/>
|
||||
</Unit15>
|
||||
<Unit16>
|
||||
<Filename Value="D:\src\fpc-real\rtl\linux\pthread.inc"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="56"/>
|
||||
<CursorPos X="35" Y="73"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit16>
|
||||
<Unit17>
|
||||
<Filename Value="..\default.properties"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="1"/>
|
||||
<CursorPos X="19" Y="10"/>
|
||||
<UsageCount Value="10"/>
|
||||
<DefaultSyntaxHighlighter Value="None"/>
|
||||
</Unit17>
|
||||
<Unit18>
|
||||
<Filename Value="..\AndroidManifest.xml"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="1"/>
|
||||
<CursorPos X="73" Y="13"/>
|
||||
<UsageCount Value="10"/>
|
||||
<DefaultSyntaxHighlighter Value="XML"/>
|
||||
</Unit18>
|
||||
<Unit19>
|
||||
<Filename Value="gles.pas"/>
|
||||
<UnitName Value="gles"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="1"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit19>
|
||||
<Unit20>
|
||||
<Filename Value="egl.pas"/>
|
||||
<UnitName Value="egl"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="28"/>
|
||||
<CursorPos X="137" Y="55"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit20>
|
||||
<Unit21>
|
||||
<Filename Value="..\libs\armeabi\link.res"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="1"/>
|
||||
<CursorPos X="22" Y="2"/>
|
||||
<UsageCount Value="10"/>
|
||||
<DefaultSyntaxHighlighter Value="None"/>
|
||||
</Unit21>
|
||||
<Unit22>
|
||||
<Filename Value="..\libs\armeabi\d.txt"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="753"/>
|
||||
<CursorPos X="47" Y="792"/>
|
||||
<UsageCount Value="10"/>
|
||||
<DefaultSyntaxHighlighter Value="None"/>
|
||||
</Unit22>
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="204" Column="29" TopLine="193"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="9" Column="9" TopLine="7"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="144" Column="22" TopLine="139"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="130" Column="17" TopLine="120"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="18" Column="23" TopLine="6"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="55" Column="17" TopLine="38"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="68" Column="48" TopLine="51"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="70" Column="66" TopLine="53"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="129" Column="46" TopLine="112"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="132" Column="25" TopLine="115"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="134" Column="10" TopLine="117"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="137" Column="24" TopLine="120"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="138" Column="37" TopLine="121"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="139" Column="24" TopLine="122"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="141" Column="10" TopLine="124"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="144" Column="28" TopLine="127"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="151" Column="10" TopLine="134"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="156" Column="10" TopLine="139"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="158" Column="28" TopLine="141"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="166" Column="10" TopLine="149"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="168" Column="28" TopLine="151"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="179" Column="47" TopLine="162"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="182" Column="25" TopLine="165"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="194" Column="43" TopLine="177"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="201" Column="7" TopLine="184"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="android_native_app_glue.pas"/>
|
||||
<Caret Line="613" Column="66" TopLine="596"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="android_native_app_glue.pas"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="207" Column="19" TopLine="191"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="test.pas"/>
|
||||
<Caret Line="132" Column="35" TopLine="127"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="..\libs\armeabi\libexample.so" ApplyConventions="False"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<Libraries Value="libs;libs\egl"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<CStyleOperator Value="False"/>
|
||||
<AllowLabel Value="False"/>
|
||||
<CPPInline Value="False"/>
|
||||
<UseAnsiStrings Value="False"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<CodeGeneration>
|
||||
<TargetCPU Value="arm"/>
|
||||
<TargetOS Value="linux"/>
|
||||
<Optimizations>
|
||||
<OptimizationLevel Value="2"/>
|
||||
</Optimizations>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<UseLineInfoUnit Value="False"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
<ExecutableType Value="Library"/>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<UseMsgFile Value="True"/>
|
||||
</CompilerMessages>
|
||||
<CustomOptions Value="-dANDROID
|
||||
-Cccdecl"/>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
291
bindings/android-ndk/examples/test/test.pas
Normal file
291
bindings/android-ndk/examples/test/test.pas
Normal file
@ -0,0 +1,291 @@
|
||||
library test;
|
||||
|
||||
uses cmem,gles,egl,ctypes,
|
||||
native_activity,native_window,looper,input,
|
||||
android_native_app_glue,
|
||||
log;
|
||||
|
||||
type
|
||||
Psaved_state = ^Tsaved_state;
|
||||
Tsaved_state = packed record
|
||||
angle : cfloat;
|
||||
x : cint32;
|
||||
y : cint32;
|
||||
end;
|
||||
|
||||
Pengine = ^Tengine;
|
||||
Tengine = packed record
|
||||
app : Pandroid_app;
|
||||
animating : cint;
|
||||
display : EGLDisplay;
|
||||
surface : EGLSurface;
|
||||
context : EGLContext;
|
||||
width : cint32;
|
||||
height : cint32;
|
||||
state : Tsaved_state;
|
||||
end;
|
||||
|
||||
const
|
||||
attribs: array[0..8] of EGLint = (
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
EGL_BLUE_SIZE, 8,
|
||||
EGL_GREEN_SIZE, 8,
|
||||
EGL_RED_SIZE, 8,
|
||||
EGL_NONE);
|
||||
|
||||
function engine_init_display(engine: Pengine): cint;
|
||||
var w, h, dummy, format,numConfigs: EGLint;
|
||||
config: EGLConfig;
|
||||
surface: EGLSurface;
|
||||
context: EGLContext;
|
||||
display: Pointer;
|
||||
begin
|
||||
// initialize OpenGL ES and EGL
|
||||
|
||||
(*
|
||||
* Here specify the attributes of the desired configuration.
|
||||
* Below, we select an EGLConfig with at least 8 bits per color
|
||||
* component compatible with on-screen windows
|
||||
*)
|
||||
|
||||
display := eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
|
||||
eglInitialize(display, nil,nil);
|
||||
|
||||
(* Here, the application chooses the configuration it desires. In this
|
||||
* sample, we have a very simplified selection process, where we pick
|
||||
* the first EGLConfig that matches our criteria *)
|
||||
|
||||
eglChooseConfig(display, attribs, @config, 1, @numConfigs);
|
||||
|
||||
(* EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is
|
||||
* guaranteed to be accepted by ANativeWindow_setBuffersGeometry().
|
||||
* As soon as we picked a EGLConfig, we can safely reconfigure the
|
||||
* ANativeWindow buffers to match, using EGL_NATIVE_VISUAL_ID. *)
|
||||
|
||||
eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, @format);
|
||||
|
||||
ANativeWindow_setBuffersGeometry(engine^.app^.window, 0, 0, format);
|
||||
|
||||
surface := eglCreateWindowSurface(display, config, engine^.app^.window, nil);
|
||||
context := eglCreateContext(display, config, nil, nil);
|
||||
|
||||
if eglMakeCurrent(display, surface, surface, context) = EGL_FALSE then
|
||||
begin
|
||||
LOGW('Unable to eglMakeCurrent');
|
||||
exit(-1);
|
||||
end;
|
||||
|
||||
eglQuerySurface(display, surface, EGL_WIDTH, @w);
|
||||
eglQuerySurface(display, surface, EGL_HEIGHT, @h);
|
||||
|
||||
engine^.display := display;
|
||||
engine^.context := context;
|
||||
engine^.surface := surface;
|
||||
engine^.width := w;
|
||||
engine^.height := h;
|
||||
engine^.state.angle := 0;
|
||||
|
||||
// Initialize GL state.
|
||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glShadeModel(GL_SMOOTH);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
result := 0;
|
||||
end;
|
||||
|
||||
procedure engine_draw_frame(engine: Pengine);
|
||||
begin
|
||||
if engine^.display = nil then
|
||||
exit;
|
||||
|
||||
// Just fill the screen with a color.
|
||||
glClearColor(engine^.state.x/engine^.width, engine^.state.angle, engine^.state.y/engine^.height, 1);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
eglSwapBuffers(engine^.display, engine^.surface);
|
||||
end;
|
||||
|
||||
|
||||
procedure engine_term_display(engine: Pengine);
|
||||
begin
|
||||
if (engine^.display <> EGL_NO_DISPLAY) then
|
||||
begin
|
||||
eglMakeCurrent(engine^.display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
if (engine^.context <> EGL_NO_CONTEXT) then
|
||||
eglDestroyContext(engine^.display, engine^.context);
|
||||
if (engine^.surface <> EGL_NO_SURFACE) then
|
||||
eglDestroySurface(engine^.display, engine^.surface);
|
||||
eglTerminate(engine^.display);
|
||||
end;
|
||||
|
||||
engine^.animating := 0;
|
||||
engine^.display := EGL_NO_DISPLAY;
|
||||
engine^.context := EGL_NO_CONTEXT;
|
||||
engine^.surface := EGL_NO_SURFACE;
|
||||
end;
|
||||
|
||||
procedure engine_handle_cmd(app: Pandroid_app; cmd: cint32); cdecl;
|
||||
var engine: Pengine;
|
||||
begin
|
||||
engine := Pengine(app^.userData);
|
||||
case cmd of
|
||||
APP_CMD_SAVE_STATE:
|
||||
begin
|
||||
// The system has asked us to save our current state. Do so.
|
||||
engine^.app^.savedState := malloc(sizeof(Tsaved_state));
|
||||
Psaved_state(engine^.app^.savedState)^ := engine^.state;
|
||||
engine^.app^.savedStateSize := sizeof(Tsaved_state);
|
||||
end;
|
||||
APP_CMD_INIT_WINDOW:
|
||||
begin
|
||||
// The window is being shown, get it ready.
|
||||
if (engine^.app^.window <> Nil) then
|
||||
begin
|
||||
LOGW('Initializing display');
|
||||
engine_init_display(engine);
|
||||
engine_draw_frame(engine);
|
||||
end;
|
||||
end;
|
||||
APP_CMD_TERM_WINDOW:
|
||||
begin
|
||||
// The window is being hidden or closed, clean it up.
|
||||
engine_term_display(engine);
|
||||
end;
|
||||
APP_CMD_GAINED_FOCUS:
|
||||
begin
|
||||
// When our app gains focus, we start monitoring the accelerometer.
|
||||
{if (engine^.accelerometerSensor <> Nil) then
|
||||
begin
|
||||
ASensorEventQueue_enableSensor(engine^.sensorEventQueue, engine^.accelerometerSensor);
|
||||
// We'd like to get 60 events per second (in us).
|
||||
ASensorEventQueue_setEventRate(engine^.sensorEventQueue, engine^.accelerometerSensor, (1000L/60)*1000);
|
||||
end;}
|
||||
end;
|
||||
APP_CMD_LOST_FOCUS:
|
||||
begin
|
||||
// When our app loses focus, we stop monitoring the accelerometer.
|
||||
// This is to avoid consuming battery while not being used.
|
||||
{if engine^.accelerometerSensor <> NULL then
|
||||
ASensorEventQueue_disableSensor(engine^.sensorEventQueue, engine^.accelerometerSensor);}
|
||||
// Also stop animating.
|
||||
engine^.animating := 0;
|
||||
engine_draw_frame(engine);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function engine_handle_input(app: Pandroid_app; event: PAInputEvent): cint32; cdecl;
|
||||
var engine: Pengine;
|
||||
begin
|
||||
engine := Pengine(app^.userData);
|
||||
if AInputEvent_getType(event) = AINPUT_EVENT_TYPE_MOTION then
|
||||
begin
|
||||
engine^.animating := 1;
|
||||
{engine^.state.x := AMotionEvent_getX(event, 0);
|
||||
engine^.state.y := AMotionEvent_getY(event, 0);}
|
||||
result := 1;
|
||||
end
|
||||
else
|
||||
result := 0;
|
||||
end;
|
||||
|
||||
procedure android_main(state: Pandroid_app); cdecl; export;
|
||||
var engine: Tengine;
|
||||
ident,events: cint;
|
||||
source: Pandroid_poll_source;
|
||||
val: cint;
|
||||
begin
|
||||
// Make sure glue isn't stripped.
|
||||
app_dummy();
|
||||
LOGW('Android main!');
|
||||
|
||||
FillChar(engine, sizeof(Tengine), 0);
|
||||
LOGW('Android main 2!');
|
||||
|
||||
state^.userData := @engine;
|
||||
state^.onAppCmd := @engine_handle_cmd;
|
||||
state^.onInputEvent := @engine_handle_input;
|
||||
engine.app := state;
|
||||
LOGW('Android main 3!');
|
||||
|
||||
if state^.savedState <> nil then
|
||||
// We are starting with a previous saved state; restore from it.
|
||||
engine.state := Psaved_state(state^.savedState)^;
|
||||
|
||||
LOGW('Entering loop');
|
||||
// loop waiting for stuff to do.
|
||||
|
||||
while true do
|
||||
begin// Read all pending events.
|
||||
// If not animating, we will block forever waiting for events.
|
||||
// If animating, we loop until all events are read, then continue
|
||||
// to draw the next frame of animation.
|
||||
|
||||
if engine.animating<>0 then
|
||||
val := 0
|
||||
else
|
||||
val := -1;
|
||||
ident := ALooper_pollAll(val, nil, @events,@source);
|
||||
while (ident >= 0) do
|
||||
begin
|
||||
// Process this event.
|
||||
if (source <> nil) then
|
||||
source^.process(state, source);
|
||||
|
||||
// If a sensor has data, process it now.
|
||||
if (ident = LOOPER_ID_USER) then
|
||||
begin
|
||||
{if (engine.accelerometerSensor != nil) then
|
||||
begin
|
||||
ASensorEvent event;
|
||||
while (ASensorEventQueue_getEvents(engine.sensorEventQueue, &event, 1) > 0) do
|
||||
begin
|
||||
LOGI("accelerometer: x=%f y=%f z=%f",
|
||||
[event.acceleration.x, event.acceleration.y,
|
||||
event.acceleration.z]);
|
||||
end;
|
||||
end;}
|
||||
end;
|
||||
|
||||
// Check if we are exiting.
|
||||
if (state^.destroyRequested <> 0) then
|
||||
begin
|
||||
LOGW('Destroy requested');
|
||||
engine_term_display(@engine);
|
||||
exit;
|
||||
end;
|
||||
|
||||
if engine.animating<>0 then
|
||||
val := 0
|
||||
else
|
||||
val := -1;
|
||||
ident := ALooper_pollAll(val, nil, @events,@source);
|
||||
end;
|
||||
|
||||
if engine.animating <> 0 then
|
||||
begin
|
||||
// Done with events; draw next animation frame.
|
||||
engine.state.angle := engine.state.angle + 0.01;
|
||||
if (engine.state.angle > 1) then
|
||||
engine.state.angle := 0;
|
||||
end;
|
||||
|
||||
// Drawing is throttled to the screen update rate, so there
|
||||
// is no need to do timing here.
|
||||
engine_draw_frame(@engine);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure PASCALMAIN; external name 'PASCALMAIN';
|
||||
|
||||
procedure FPC_SHARED_LIB_START; [public, alias: 'FPC_SHARED_LIB_START'];
|
||||
begin
|
||||
PASCALMAIN;
|
||||
end;
|
||||
|
||||
exports //android_main name 'android_main',
|
||||
ANativeActivity_onCreate name 'ANativeActivity_onCreate';
|
||||
|
||||
end.
|
BIN
bindings/android-ndk/examples/test/test.res
Normal file
BIN
bindings/android-ndk/examples/test/test.res
Normal file
Binary file not shown.
809
bindings/android-ndk/gles.pas
Normal file
809
bindings/android-ndk/gles.pas
Normal file
@ -0,0 +1,809 @@
|
||||
unit gles;
|
||||
|
||||
interface
|
||||
|
||||
uses ctypes;
|
||||
|
||||
const
|
||||
libname = 'libGLESv1_CM.so';
|
||||
|
||||
type
|
||||
GLvoid = pointer;
|
||||
GLenum = cuint;
|
||||
GLboolean = cuchar;
|
||||
GLbitfield = cuint;
|
||||
GLbyte = byte;
|
||||
GLshort = cshort;
|
||||
GLint = cint;
|
||||
GLsizei = cint;
|
||||
GLubyte = cuchar;
|
||||
GLushort = cushort;
|
||||
GLuint = cuint;
|
||||
GLfloat = cfloat;
|
||||
GLclampf = cfloat;
|
||||
GLfixed = longint;
|
||||
GLclampx = longint;
|
||||
|
||||
GLintptr = ptrint;
|
||||
GLsizeiptr = sizeint;
|
||||
|
||||
PGLfloat = ^GLfloat;
|
||||
PGLvoid = ^GLvoid;
|
||||
PGLubyte = ^GLubyte;
|
||||
PGLint = ^GLint;
|
||||
PGLboolean = ^GLboolean;
|
||||
PGLuint = ^GLuint;
|
||||
PGLfixed = ^GLfixed;
|
||||
|
||||
const
|
||||
GL_VERSION_ES_CM_1_0 = 1;
|
||||
GL_VERSION_ES_CL_1_0 = 1;
|
||||
GL_VERSION_ES_CM_1_1 = 1;
|
||||
GL_VERSION_ES_CL_1_1 = 1;
|
||||
|
||||
(* ClearBufferMask *)
|
||||
GL_DEPTH_BUFFER_BIT = $00000100;
|
||||
GL_STENCIL_BUFFER_BIT = $00000400;
|
||||
GL_COLOR_BUFFER_BIT = $00004000;
|
||||
|
||||
(* Boolean *)
|
||||
GL_FALSE = 0;
|
||||
GL_TRUE = 1;
|
||||
|
||||
(* BeginMode *)
|
||||
GL_POINTS = $0000;
|
||||
GL_LINES = $0001;
|
||||
GL_LINE_LOOP = $0002;
|
||||
GL_LINE_STRIP = $0003;
|
||||
GL_TRIANGLES = $0004;
|
||||
GL_TRIANGLE_STRIP = $0005;
|
||||
GL_TRIANGLE_FAN = $0006;
|
||||
(* AlphaFunction *)
|
||||
|
||||
GL_NEVER = $0200;
|
||||
GL_LESS = $0201;
|
||||
GL_EQUAL = $0202;
|
||||
GL_LEQUAL = $0203;
|
||||
GL_GREATER = $0204;
|
||||
GL_NOTEQUAL = $0205;
|
||||
GL_GEQUAL = $0206;
|
||||
GL_ALWAYS = $0207;
|
||||
(* BlendingFactorDest *)
|
||||
|
||||
GL_ZERO = 0;
|
||||
GL_ONE = 1;
|
||||
GL_SRC_COLOR = $0300;
|
||||
GL_ONE_MINUS_SRC_COLOR = $0301;
|
||||
GL_SRC_ALPHA = $0302;
|
||||
GL_ONE_MINUS_SRC_ALPHA = $0303;
|
||||
GL_DST_ALPHA = $0304;
|
||||
GL_ONE_MINUS_DST_ALPHA = $0305;
|
||||
(* BlendingFactorSrc *)
|
||||
|
||||
(* GL_ZERO *)
|
||||
|
||||
(* GL_ONE *)
|
||||
|
||||
GL_DST_COLOR = $0306;
|
||||
GL_ONE_MINUS_DST_COLOR = $0307;
|
||||
GL_SRC_ALPHA_SATURATE = $0308;
|
||||
(* GL_SRC_ALPHA *)
|
||||
|
||||
(* GL_ONE_MINUS_SRC_ALPHA *)
|
||||
|
||||
(* GL_DST_ALPHA *)
|
||||
|
||||
(* GL_ONE_MINUS_DST_ALPHA *)
|
||||
|
||||
(* ClipPlaneName *)
|
||||
|
||||
GL_CLIP_PLANE0 = $3000;
|
||||
GL_CLIP_PLANE1 = $3001;
|
||||
GL_CLIP_PLANE2 = $3002;
|
||||
GL_CLIP_PLANE3 = $3003;
|
||||
GL_CLIP_PLANE4 = $3004;
|
||||
GL_CLIP_PLANE5 = $3005;
|
||||
(* ColorMaterialFace *)
|
||||
|
||||
(* GL_FRONT_AND_BACK *)
|
||||
|
||||
(* ColorMaterialParameter *)
|
||||
|
||||
(* GL_AMBIENT_AND_DIFFUSE *)
|
||||
|
||||
(* ColorPointerType *)
|
||||
|
||||
(* GL_UNSIGNED_BYTE *)
|
||||
|
||||
(* GL_FLOAT *)
|
||||
|
||||
(* GL_FIXED *)
|
||||
|
||||
(* CullFaceMode *)
|
||||
|
||||
GL_FRONT = $0404;
|
||||
GL_BACK = $0405;
|
||||
GL_FRONT_AND_BACK = $0408;
|
||||
(* DepthFunction *)
|
||||
|
||||
(* GL_NEVER *)
|
||||
|
||||
(* GL_LESS *)
|
||||
|
||||
(* GL_EQUAL *)
|
||||
|
||||
(* GL_LEQUAL *)
|
||||
|
||||
(* GL_GREATER *)
|
||||
|
||||
(* GL_NOTEQUAL *)
|
||||
|
||||
(* GL_GEQUAL *)
|
||||
|
||||
(* GL_ALWAYS *)
|
||||
|
||||
(* EnableCap *)
|
||||
|
||||
GL_FOG = $0B60;
|
||||
GL_LIGHTING = $0B50;
|
||||
GL_TEXTURE_2D = $0DE1;
|
||||
GL_CULL_FACE = $0B44;
|
||||
GL_ALPHA_TEST = $0BC0;
|
||||
GL_BLEND = $0BE2;
|
||||
GL_COLOR_LOGIC_OP = $0BF2;
|
||||
GL_DITHER = $0BD0;
|
||||
GL_STENCIL_TEST = $0B90;
|
||||
GL_DEPTH_TEST = $0B71;
|
||||
(* GL_LIGHT0 *)
|
||||
|
||||
(* GL_LIGHT1 *)
|
||||
|
||||
(* GL_LIGHT2 *)
|
||||
|
||||
(* GL_LIGHT3 *)
|
||||
|
||||
(* GL_LIGHT4 *)
|
||||
|
||||
(* GL_LIGHT5 *)
|
||||
|
||||
(* GL_LIGHT6 *)
|
||||
|
||||
(* GL_LIGHT7 *)
|
||||
|
||||
GL_POINT_SMOOTH = $0B10;
|
||||
GL_LINE_SMOOTH = $0B20;
|
||||
GL_SCISSOR_TEST = $0C11;
|
||||
GL_COLOR_MATERIAL = $0B57;
|
||||
GL_NORMALIZE = $0BA1;
|
||||
GL_RESCALE_NORMAL = $803A;
|
||||
GL_POLYGON_OFFSET_FILL = $8037;
|
||||
GL_VERTEX_ARRAY = $8074;
|
||||
GL_NORMAL_ARRAY = $8075;
|
||||
GL_COLOR_ARRAY = $8076;
|
||||
GL_TEXTURE_COORD_ARRAY = $8078;
|
||||
GL_MULTISAMPLE = $809D;
|
||||
GL_SAMPLE_ALPHA_TO_COVERAGE = $809E;
|
||||
GL_SAMPLE_ALPHA_TO_ONE = $809F;
|
||||
GL_SAMPLE_COVERAGE = $80A0;
|
||||
|
||||
(* ErrorCode *)
|
||||
GL_NO_ERROR = 0;
|
||||
GL_INVALID_ENUM = $0500;
|
||||
GL_INVALID_VALUE = $0501;
|
||||
GL_INVALID_OPERATION = $0502;
|
||||
GL_STACK_OVERFLOW = $0503;
|
||||
GL_STACK_UNDERFLOW = $0504;
|
||||
GL_OUT_OF_MEMORY = $0505;
|
||||
|
||||
(* FogMode *)
|
||||
(* GL_LINEAR *)
|
||||
GL_EXP = $0800;
|
||||
GL_EXP2 = $0801;
|
||||
|
||||
(* FogParameter *)
|
||||
GL_FOG_DENSITY = $0B62;
|
||||
GL_FOG_START = $0B63;
|
||||
GL_FOG_END = $0B64;
|
||||
GL_FOG_MODE = $0B65;
|
||||
GL_FOG_COLOR = $0B66;
|
||||
|
||||
(* FrontFaceDirection *)
|
||||
GL_CW = $0900;
|
||||
GL_CCW = $0901;
|
||||
|
||||
(* GetPName *)
|
||||
GL_CURRENT_COLOR = $0B00;
|
||||
GL_CURRENT_NORMAL = $0B02;
|
||||
GL_CURRENT_TEXTURE_COORDS = $0B03;
|
||||
GL_POINT_SIZE = $0B11;
|
||||
GL_POINT_SIZE_MIN = $8126;
|
||||
GL_POINT_SIZE_MAX = $8127;
|
||||
GL_POINT_FADE_THRESHOLD_SIZE = $8128;
|
||||
GL_POINT_DISTANCE_ATTENUATION = $8129;
|
||||
GL_SMOOTH_POINT_SIZE_RANGE = $0B12;
|
||||
GL_LINE_WIDTH = $0B21;
|
||||
GL_SMOOTH_LINE_WIDTH_RANGE = $0B22;
|
||||
GL_ALIASED_POINT_SIZE_RANGE = $846D;
|
||||
GL_ALIASED_LINE_WIDTH_RANGE = $846E;
|
||||
GL_CULL_FACE_MODE = $0B45;
|
||||
GL_FRONT_FACE = $0B46;
|
||||
GL_SHADE_MODEL = $0B54;
|
||||
GL_DEPTH_RANGE = $0B70;
|
||||
GL_DEPTH_WRITEMASK = $0B72;
|
||||
GL_DEPTH_CLEAR_VALUE = $0B73;
|
||||
GL_DEPTH_FUNC = $0B74;
|
||||
GL_STENCIL_CLEAR_VALUE = $0B91;
|
||||
GL_STENCIL_FUNC = $0B92;
|
||||
GL_STENCIL_VALUE_MASK = $0B93;
|
||||
GL_STENCIL_FAIL = $0B94;
|
||||
GL_STENCIL_PASS_DEPTH_FAIL = $0B95;
|
||||
GL_STENCIL_PASS_DEPTH_PASS = $0B96;
|
||||
GL_STENCIL_REF = $0B97;
|
||||
GL_STENCIL_WRITEMASK = $0B98;
|
||||
GL_MATRIX_MODE = $0BA0;
|
||||
GL_VIEWPORT = $0BA2;
|
||||
GL_MODELVIEW_STACK_DEPTH = $0BA3;
|
||||
GL_PROJECTION_STACK_DEPTH = $0BA4;
|
||||
GL_TEXTURE_STACK_DEPTH = $0BA5;
|
||||
GL_MODELVIEW_MATRIX = $0BA6;
|
||||
GL_PROJECTION_MATRIX = $0BA7;
|
||||
GL_TEXTURE_MATRIX = $0BA8;
|
||||
GL_ALPHA_TEST_FUNC = $0BC1;
|
||||
GL_ALPHA_TEST_REF = $0BC2;
|
||||
GL_BLEND_DST = $0BE0;
|
||||
GL_BLEND_SRC = $0BE1;
|
||||
GL_LOGIC_OP_MODE = $0BF0;
|
||||
GL_SCISSOR_BOX = $0C10;
|
||||
GL_COLOR_CLEAR_VALUE = $0C22;
|
||||
GL_COLOR_WRITEMASK = $0C23;
|
||||
GL_UNPACK_ALIGNMENT = $0CF5;
|
||||
GL_PACK_ALIGNMENT = $0D05;
|
||||
GL_MAX_LIGHTS = $0D31;
|
||||
GL_MAX_CLIP_PLANES = $0D32;
|
||||
GL_MAX_TEXTURE_SIZE = $0D33;
|
||||
GL_MAX_MODELVIEW_STACK_DEPTH = $0D36;
|
||||
GL_MAX_PROJECTION_STACK_DEPTH = $0D38;
|
||||
GL_MAX_TEXTURE_STACK_DEPTH = $0D39;
|
||||
GL_MAX_VIEWPORT_DIMS = $0D3A;
|
||||
GL_MAX_TEXTURE_UNITS = $84E2;
|
||||
GL_SUBPIXEL_BITS = $0D50;
|
||||
GL_RED_BITS = $0D52;
|
||||
GL_GREEN_BITS = $0D53;
|
||||
GL_BLUE_BITS = $0D54;
|
||||
GL_ALPHA_BITS = $0D55;
|
||||
GL_DEPTH_BITS = $0D56;
|
||||
GL_STENCIL_BITS = $0D57;
|
||||
GL_POLYGON_OFFSET_UNITS = $2A00;
|
||||
GL_POLYGON_OFFSET_FACTOR = $8038;
|
||||
GL_TEXTURE_BINDING_2D = $8069;
|
||||
GL_VERTEX_ARRAY_SIZE = $807A;
|
||||
GL_VERTEX_ARRAY_TYPE = $807B;
|
||||
GL_VERTEX_ARRAY_STRIDE = $807C;
|
||||
GL_NORMAL_ARRAY_TYPE = $807E;
|
||||
GL_NORMAL_ARRAY_STRIDE = $807F;
|
||||
GL_COLOR_ARRAY_SIZE = $8081;
|
||||
GL_COLOR_ARRAY_TYPE = $8082;
|
||||
GL_COLOR_ARRAY_STRIDE = $8083;
|
||||
GL_TEXTURE_COORD_ARRAY_SIZE = $8088;
|
||||
GL_TEXTURE_COORD_ARRAY_TYPE = $8089;
|
||||
GL_TEXTURE_COORD_ARRAY_STRIDE = $808A;
|
||||
GL_VERTEX_ARRAY_POINTER = $808E;
|
||||
GL_NORMAL_ARRAY_POINTER = $808F;
|
||||
GL_COLOR_ARRAY_POINTER = $8090;
|
||||
GL_TEXTURE_COORD_ARRAY_POINTER = $8092;
|
||||
GL_SAMPLE_BUFFERS = $80A8;
|
||||
GL_SAMPLES = $80A9;
|
||||
GL_SAMPLE_COVERAGE_VALUE = $80AA;
|
||||
GL_SAMPLE_COVERAGE_INVERT = $80AB;
|
||||
(* GetTextureParameter *)
|
||||
|
||||
(* GL_TEXTURE_MAG_FILTER *)
|
||||
|
||||
(* GL_TEXTURE_MIN_FILTER *)
|
||||
|
||||
(* GL_TEXTURE_WRAP_S *)
|
||||
|
||||
(* GL_TEXTURE_WRAP_T *)
|
||||
|
||||
GL_NUM_COMPRESSED_TEXTURE_FORMATS = $86A2;
|
||||
GL_COMPRESSED_TEXTURE_FORMATS = $86A3;
|
||||
(* HintMode *)
|
||||
|
||||
GL_DONT_CARE = $1100;
|
||||
GL_FASTEST = $1101;
|
||||
GL_NICEST = $1102;
|
||||
(* HintTarget *)
|
||||
|
||||
GL_PERSPECTIVE_CORRECTION_HINT = $0C50;
|
||||
GL_POINT_SMOOTH_HINT = $0C51;
|
||||
GL_LINE_SMOOTH_HINT = $0C52;
|
||||
GL_FOG_HINT = $0C54;
|
||||
GL_GENERATE_MIPMAP_HINT = $8192;
|
||||
(* LightModelParameter *)
|
||||
|
||||
GL_LIGHT_MODEL_AMBIENT = $0B53;
|
||||
GL_LIGHT_MODEL_TWO_SIDE = $0B52;
|
||||
(* LightParameter *)
|
||||
|
||||
GL_AMBIENT = $1200;
|
||||
GL_DIFFUSE = $1201;
|
||||
GL_SPECULAR = $1202;
|
||||
GL_POSITION = $1203;
|
||||
GL_SPOT_DIRECTION = $1204;
|
||||
GL_SPOT_EXPONENT = $1205;
|
||||
GL_SPOT_CUTOFF = $1206;
|
||||
GL_CONSTANT_ATTENUATION = $1207;
|
||||
GL_LINEAR_ATTENUATION = $1208;
|
||||
GL_QUADRATIC_ATTENUATION = $1209;
|
||||
(* DataType *)
|
||||
|
||||
GL_BYTE = $1400;
|
||||
GL_UNSIGNED_BYTE = $1401;
|
||||
GL_SHORT = $1402;
|
||||
GL_UNSIGNED_SHORT = $1403;
|
||||
GL_FLOAT = $1406;
|
||||
GL_FIXED = $140C;
|
||||
(* LogicOp *)
|
||||
|
||||
GL_CLEAR = $1500;
|
||||
GL_AND = $1501;
|
||||
GL_AND_REVERSE = $1502;
|
||||
GL_COPY = $1503;
|
||||
GL_AND_INVERTED = $1504;
|
||||
GL_NOOP = $1505;
|
||||
GL_XOR = $1506;
|
||||
GL_OR = $1507;
|
||||
GL_NOR = $1508;
|
||||
GL_EQUIV = $1509;
|
||||
GL_INVERT = $150A;
|
||||
GL_OR_REVERSE = $150B;
|
||||
GL_COPY_INVERTED = $150C;
|
||||
GL_OR_INVERTED = $150D;
|
||||
GL_NAND = $150E;
|
||||
GL_SET = $150F;
|
||||
(* MaterialFace *)
|
||||
|
||||
(* GL_FRONT_AND_BACK *)
|
||||
|
||||
(* MaterialParameter *)
|
||||
|
||||
GL_EMISSION = $1600;
|
||||
GL_SHININESS = $1601;
|
||||
GL_AMBIENT_AND_DIFFUSE = $1602;
|
||||
(* GL_AMBIENT *)
|
||||
|
||||
(* GL_DIFFUSE *)
|
||||
|
||||
(* GL_SPECULAR *)
|
||||
|
||||
(* MatrixMode *)
|
||||
|
||||
GL_MODELVIEW = $1700;
|
||||
GL_PROJECTION = $1701;
|
||||
GL_TEXTURE = $1702;
|
||||
(* NormalPointerType *)
|
||||
|
||||
(* GL_BYTE *)
|
||||
|
||||
(* GL_SHORT *)
|
||||
|
||||
(* GL_FLOAT *)
|
||||
|
||||
(* GL_FIXED *)
|
||||
|
||||
(* PixelFormat *)
|
||||
|
||||
GL_ALPHA = $1906;
|
||||
GL_RGB = $1907;
|
||||
GL_RGBA = $1908;
|
||||
GL_LUMINANCE = $1909;
|
||||
GL_LUMINANCE_ALPHA = $190A;
|
||||
|
||||
(* PixelType *)
|
||||
(* GL_UNSIGNED_BYTE *)
|
||||
|
||||
GL_UNSIGNED_SHORT_4_4_4_4 = $8033;
|
||||
GL_UNSIGNED_SHORT_5_5_5_1 = $8034;
|
||||
GL_UNSIGNED_SHORT_5_6_5 = $8363;
|
||||
(* ShadingModel *)
|
||||
|
||||
GL_FLAT = $1D00;
|
||||
GL_SMOOTH = $1D01;
|
||||
(* StencilFunction *)
|
||||
|
||||
(* GL_NEVER *)
|
||||
|
||||
(* GL_LESS *)
|
||||
|
||||
(* GL_EQUAL *)
|
||||
|
||||
(* GL_LEQUAL *)
|
||||
|
||||
(* GL_GREATER *)
|
||||
|
||||
(* GL_NOTEQUAL *)
|
||||
|
||||
(* GL_GEQUAL *)
|
||||
|
||||
(* GL_ALWAYS *)
|
||||
|
||||
(* StencilOp *)
|
||||
|
||||
(* GL_ZERO *)
|
||||
|
||||
GL_KEEP = $1E00;
|
||||
GL_REPLACE = $1E01;
|
||||
GL_INCR = $1E02;
|
||||
GL_DECR = $1E03;
|
||||
(* GL_INVERT *)
|
||||
|
||||
(* StringName *)
|
||||
|
||||
GL_VENDOR = $1F00;
|
||||
GL_RENDERER = $1F01;
|
||||
GL_VERSION = $1F02;
|
||||
GL_EXTENSIONS = $1F03;
|
||||
(* TexCoordPointerType *)
|
||||
|
||||
(* GL_SHORT *)
|
||||
|
||||
(* GL_FLOAT *)
|
||||
|
||||
(* GL_FIXED *)
|
||||
|
||||
(* GL_BYTE *)
|
||||
|
||||
(* TextureEnvMode *)
|
||||
|
||||
GL_MODULATE = $2100;
|
||||
GL_DECAL = $2101;
|
||||
(* GL_BLEND *)
|
||||
|
||||
GL_ADD = $0104;
|
||||
(* GL_REPLACE *)
|
||||
|
||||
(* TextureEnvParameter *)
|
||||
|
||||
GL_TEXTURE_ENV_MODE = $2200;
|
||||
GL_TEXTURE_ENV_COLOR = $2201;
|
||||
(* TextureEnvTarget *)
|
||||
|
||||
GL_TEXTURE_ENV = $2300;
|
||||
(* TextureMagFilter *)
|
||||
|
||||
GL_NEAREST = $2600;
|
||||
GL_LINEAR = $2601;
|
||||
(* TextureMinFilter *)
|
||||
|
||||
(* GL_NEAREST *)
|
||||
|
||||
(* GL_LINEAR *)
|
||||
|
||||
GL_NEAREST_MIPMAP_NEAREST = $2700;
|
||||
GL_LINEAR_MIPMAP_NEAREST = $2701;
|
||||
GL_NEAREST_MIPMAP_LINEAR = $2702;
|
||||
GL_LINEAR_MIPMAP_LINEAR = $2703;
|
||||
(* TextureParameterName *)
|
||||
|
||||
GL_TEXTURE_MAG_FILTER = $2800;
|
||||
GL_TEXTURE_MIN_FILTER = $2801;
|
||||
GL_TEXTURE_WRAP_S = $2802;
|
||||
GL_TEXTURE_WRAP_T = $2803;
|
||||
GL_GENERATE_MIPMAP = $8191;
|
||||
(* TextureTarget *)
|
||||
|
||||
(* GL_TEXTURE_2D *)
|
||||
|
||||
(* TextureUnit *)
|
||||
|
||||
GL_TEXTURE0 = $84C0;
|
||||
GL_TEXTURE1 = $84C1;
|
||||
GL_TEXTURE2 = $84C2;
|
||||
GL_TEXTURE3 = $84C3;
|
||||
GL_TEXTURE4 = $84C4;
|
||||
GL_TEXTURE5 = $84C5;
|
||||
GL_TEXTURE6 = $84C6;
|
||||
GL_TEXTURE7 = $84C7;
|
||||
GL_TEXTURE8 = $84C8;
|
||||
GL_TEXTURE9 = $84C9;
|
||||
GL_TEXTURE10 = $84CA;
|
||||
GL_TEXTURE11 = $84CB;
|
||||
GL_TEXTURE12 = $84CC;
|
||||
GL_TEXTURE13 = $84CD;
|
||||
GL_TEXTURE14 = $84CE;
|
||||
GL_TEXTURE15 = $84CF;
|
||||
GL_TEXTURE16 = $84D0;
|
||||
GL_TEXTURE17 = $84D1;
|
||||
GL_TEXTURE18 = $84D2;
|
||||
GL_TEXTURE19 = $84D3;
|
||||
GL_TEXTURE20 = $84D4;
|
||||
GL_TEXTURE21 = $84D5;
|
||||
GL_TEXTURE22 = $84D6;
|
||||
GL_TEXTURE23 = $84D7;
|
||||
GL_TEXTURE24 = $84D8;
|
||||
GL_TEXTURE25 = $84D9;
|
||||
GL_TEXTURE26 = $84DA;
|
||||
GL_TEXTURE27 = $84DB;
|
||||
GL_TEXTURE28 = $84DC;
|
||||
GL_TEXTURE29 = $84DD;
|
||||
GL_TEXTURE30 = $84DE;
|
||||
GL_TEXTURE31 = $84DF;
|
||||
GL_ACTIVE_TEXTURE = $84E0;
|
||||
GL_CLIENT_ACTIVE_TEXTURE = $84E1;
|
||||
(* TextureWrapMode *)
|
||||
|
||||
GL_REPEAT = $2901;
|
||||
GL_CLAMP_TO_EDGE = $812F;
|
||||
(* VertexPointerType *)
|
||||
|
||||
(* GL_SHORT *)
|
||||
|
||||
(* GL_FLOAT *)
|
||||
|
||||
(* GL_FIXED *)
|
||||
|
||||
(* GL_BYTE *)
|
||||
|
||||
(* LightName *)
|
||||
|
||||
GL_LIGHT0 = $4000;
|
||||
GL_LIGHT1 = $4001;
|
||||
GL_LIGHT2 = $4002;
|
||||
GL_LIGHT3 = $4003;
|
||||
GL_LIGHT4 = $4004;
|
||||
GL_LIGHT5 = $4005;
|
||||
GL_LIGHT6 = $4006;
|
||||
GL_LIGHT7 = $4007;
|
||||
(* Buffer Objects *)
|
||||
|
||||
GL_ARRAY_BUFFER = $8892;
|
||||
GL_ELEMENT_ARRAY_BUFFER = $8893;
|
||||
GL_ARRAY_BUFFER_BINDING = $8894;
|
||||
GL_ELEMENT_ARRAY_BUFFER_BINDING = $8895;
|
||||
GL_VERTEX_ARRAY_BUFFER_BINDING = $8896;
|
||||
GL_NORMAL_ARRAY_BUFFER_BINDING = $8897;
|
||||
GL_COLOR_ARRAY_BUFFER_BINDING = $8898;
|
||||
GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = $889A;
|
||||
GL_STATIC_DRAW = $88E4;
|
||||
GL_DYNAMIC_DRAW = $88E8;
|
||||
GL_BUFFER_SIZE = $8764;
|
||||
GL_BUFFER_USAGE = $8765;
|
||||
(* Texture combine + dot3 *)
|
||||
|
||||
GL_SUBTRACT = $84E7;
|
||||
GL_COMBINE = $8570;
|
||||
GL_COMBINE_RGB = $8571;
|
||||
GL_COMBINE_ALPHA = $8572;
|
||||
GL_RGB_SCALE = $8573;
|
||||
GL_ADD_SIGNED = $8574;
|
||||
GL_INTERPOLATE = $8575;
|
||||
GL_CONSTANT = $8576;
|
||||
GL_PRIMARY_COLOR = $8577;
|
||||
GL_PREVIOUS = $8578;
|
||||
GL_OPERAND0_RGB = $8590;
|
||||
GL_OPERAND1_RGB = $8591;
|
||||
GL_OPERAND2_RGB = $8592;
|
||||
GL_OPERAND0_ALPHA = $8598;
|
||||
GL_OPERAND1_ALPHA = $8599;
|
||||
GL_OPERAND2_ALPHA = $859A;
|
||||
GL_ALPHA_SCALE = $0D1C;
|
||||
GL_SRC0_RGB = $8580;
|
||||
GL_SRC1_RGB = $8581;
|
||||
GL_SRC2_RGB = $8582;
|
||||
GL_SRC0_ALPHA = $8588;
|
||||
GL_SRC1_ALPHA = $8589;
|
||||
GL_SRC2_ALPHA = $858A;
|
||||
GL_DOT3_RGB = $86AE;
|
||||
GL_DOT3_RGBA = $86AF;
|
||||
(*------------------------------------------------------------------------*
|
||||
* required OES extension tokens
|
||||
*------------------------------------------------------------------------ *)
|
||||
|
||||
(* OES_read_format *)
|
||||
|
||||
GL_IMPLEMENTATION_COLOR_READ_TYPE_OES = $8B9A;
|
||||
GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES = $8B9B;
|
||||
|
||||
(* GL_OES_compressed_paletted_texture *)
|
||||
|
||||
GL_PALETTE4_RGB8_OES = $8B90;
|
||||
GL_PALETTE4_RGBA8_OES = $8B91;
|
||||
GL_PALETTE4_R5_G6_B5_OES = $8B92;
|
||||
GL_PALETTE4_RGBA4_OES = $8B93;
|
||||
GL_PALETTE4_RGB5_A1_OES = $8B94;
|
||||
GL_PALETTE8_RGB8_OES = $8B95;
|
||||
GL_PALETTE8_RGBA8_OES = $8B96;
|
||||
GL_PALETTE8_R5_G6_B5_OES = $8B97;
|
||||
GL_PALETTE8_RGBA4_OES = $8B98;
|
||||
GL_PALETTE8_RGB5_A1_OES = $8B99;
|
||||
|
||||
(* OES_point_size_array *)
|
||||
|
||||
GL_POINT_SIZE_ARRAY_OES = $8B9C;
|
||||
GL_POINT_SIZE_ARRAY_TYPE_OES = $898A;
|
||||
GL_POINT_SIZE_ARRAY_STRIDE_OES = $898B;
|
||||
GL_POINT_SIZE_ARRAY_POINTER_OES = $898C;
|
||||
GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES = $8B9F;
|
||||
|
||||
(* GL_OES_point_sprite *)
|
||||
|
||||
GL_POINT_SPRITE_OES = $8861;
|
||||
GL_COORD_REPLACE_OES = $8862;
|
||||
|
||||
(************************************************************ *)
|
||||
|
||||
(* Available only in Common profile *)
|
||||
|
||||
procedure glAlphaFunc(func: GLenum; ref: GLclampf); cdecl; external;
|
||||
procedure glClearColor(red, green, blue, alpha: GLclampf); cdecl; external libname;
|
||||
procedure glClearDepthf(depth: GLclampf); cdecl; external libname;
|
||||
procedure glClipPlanef(plane: GLenum; equation: PGLfloat); cdecl; external libname;
|
||||
procedure glColor4f(red, green, blue, alpha: GLfloat); cdecl; external libname;
|
||||
procedure glDepthRangef(zNear, zFar: GLclampf); cdecl; external libname;
|
||||
procedure glFogf(pname: GLenum; param: GLfloat); cdecl; external libname;
|
||||
procedure glFogfv(pname: GLenum; params: PGLfloat); cdecl; external libname;
|
||||
procedure glFrustumf(left, right, bottom, top, zNear, zFar: GLfloat); cdecl; external libname;
|
||||
procedure glGetClipPlanef(pname: GLenum; eqn: GLfloat); cdecl; external libname;
|
||||
procedure glGetFloatv(pname: GLenum; params: PGLfloat); cdecl; external libname;
|
||||
procedure glGetLightfv(light, pname: GLenum; params: PGLfloat); cdecl; external libname;
|
||||
procedure glGetMaterialfv(face, pname: GLenum; params: PGLfloat); cdecl; external libname;
|
||||
procedure glGetTexEnvfv(env, pname: GLenum; params: PGLfloat); cdecl; external libname;
|
||||
procedure glGetTexParameterfv(target, pname: GLenum; params: PGLfloat); cdecl; external libname;
|
||||
procedure glLightModelf(pname: GLenum; param: GLfloat); cdecl; external libname;
|
||||
procedure glLightModelfv(pname: GLenum; params: PGLfloat); cdecl; external libname;
|
||||
procedure glLightf(light, pname: GLenum; param: GLfloat); cdecl; external libname;
|
||||
procedure glLightfv(light, pname: GLenum; params: PGLfloat); cdecl; external libname;
|
||||
procedure glLineWidth(width: GLfloat); cdecl; external libname;
|
||||
procedure glLoadMatrixf(m: PGLfloat); cdecl; external libname;
|
||||
procedure glMaterialf(face, pname: GLenum; param: GLfloat); cdecl; external libname;
|
||||
procedure glMaterialfv(face, pname: GLenum; params: PGLfloat); cdecl; external libname;
|
||||
procedure glMultMatrixf(m: PGLfloat); cdecl; external libname;
|
||||
procedure glMultiTexCoord4f(target: GLenum; s, t, r, q: GLfloat); cdecl; external libname;
|
||||
procedure glNormal3f(nx, ny, nz: GLfloat); cdecl; external libname;
|
||||
procedure glOrthof(left, right, bottom, top, zNear, zFar: GLfloat); cdecl; external libname;
|
||||
procedure glPointParameterf(pname: GLenum; param: GLfloat); cdecl; external libname;
|
||||
procedure glPointParameterfv(pname: GLenum; params: PGLfloat); cdecl; external libname;
|
||||
procedure glPointSize(size: GLfloat); cdecl; external libname;
|
||||
procedure glPolygonOffset(factor, units: GLfloat); cdecl; external libname;
|
||||
procedure glRotatef(angle, x, y, z: GLfloat); cdecl; external libname;
|
||||
procedure glScalef(x, y, z: GLfloat); cdecl; external libname;
|
||||
procedure glTexEnvf(target, pname: GLenum; param: GLfloat); cdecl; external libname;
|
||||
procedure glTexEnvfv(target, pname: GLenum; params: PGLfloat); cdecl; external libname;
|
||||
procedure glTexParameterf(target, pname: GLenum; param: GLfloat); cdecl; external libname;
|
||||
procedure glTexParameterfv(target, pname: GLenum; params: PGLfloat); cdecl; external libname;
|
||||
procedure glTranslatef(x, y, z: GLfloat); cdecl; external libname;
|
||||
|
||||
(* Available in both Common and Common-Lite profiles *)
|
||||
procedure glActiveTexture(texture: GLenum); cdecl; external libname;
|
||||
procedure glAlphaFuncx(func: GLenum; ref: GLclampx); cdecl; external libname;
|
||||
procedure glBindBuffer(target: GLenum; buffer: GLuint); cdecl; external libname;
|
||||
procedure glBindTexture(target: GLenum; texture: GLuint); cdecl; external libname;
|
||||
procedure glBlendFunc(sfactor, dfactor: GLenum); cdecl; external libname;
|
||||
procedure glBufferData(target: GLenum; size: GLsizeiptr; data: PGLvoid; usage: GLenum); cdecl; external libname;
|
||||
procedure glBufferSubData(target: GLenum; offset: GLintptr; size: GLsizeiptr; data: PGLvoid); cdecl; external libname;
|
||||
procedure glClear(mask: GLbitfield); cdecl; external libname;
|
||||
procedure glClearColorx(red, green, blue, alpha: GLclampx); cdecl; external libname;
|
||||
procedure glClearDepthx(depth: GLclampx); cdecl; external libname;
|
||||
procedure glClearStencil(s: GLint); cdecl; external libname;
|
||||
procedure glClientActiveTexture(texture: GLenum); cdecl; external libname;
|
||||
procedure glClipPlanex(plane: GLenum; equation: PGLfixed); cdecl; external libname;
|
||||
procedure glColor4ub(red, green, blue, alpha: GLubyte); cdecl; external libname;
|
||||
procedure glColor4x(red, green, blue, alpha: GLfixed); cdecl; external libname;
|
||||
procedure glColorMask(red, green, blue, alpha: GLboolean); cdecl; external libname;
|
||||
procedure glColorPointer(size: GLint; type_: GLenum; stride: GLsizei; pointer: PGLvoid); cdecl; external libname;
|
||||
procedure glCompressedTexImage2D(target: GLenum; level: GLint; internalformat: GLenum; width, height: GLsizei; border: GLint; imageSize: GLsizei; data: PGLvoid); cdecl; external libname;
|
||||
procedure glCompressedTexSubImage2D(target: GLenum;level, xoffset, yoffset: GLint; width, height: GLsizei; format: GLenum;imageSize: GLsizei; data: PGLvoid); cdecl; external libname;
|
||||
procedure glCopyTexImage2D(target: GLenum; level: GLint; internalformat: GLenum; x, y: GLint; width, height: GLsizei; border: GLint); cdecl; external libname;
|
||||
procedure glCopyTexSubImage2D(target: GLenum; level, xoffset, yoffset, x, y: GLint; width, height: GLsizei); cdecl; external libname;
|
||||
procedure glCullFace(mode: GLenum); cdecl; external libname;
|
||||
procedure glDeleteBuffers(n: GLsizei; buffers: PGLuint); cdecl; external libname;
|
||||
procedure glDeleteTextures(n: GLsizei; textures: PGLuint); cdecl; external libname;
|
||||
procedure glDepthFunc(func: GLenum); cdecl; external libname;
|
||||
procedure glDepthMask(flag: GLboolean); cdecl; external libname;
|
||||
procedure glDepthRangex(zNear, zFar: GLclampx); cdecl; external libname;
|
||||
procedure glDisable(cap: GLenum); cdecl; external libname;
|
||||
procedure glDisableClientState(array_: GLenum); cdecl; external libname;
|
||||
procedure glDrawArrays(mode: GLenum; first: GLint; count: GLsizei); cdecl; external libname;
|
||||
procedure glDrawElements(mode: GLenum; count: GLsizei; type_: GLenum; indices: PGLvoid); cdecl; external libname;
|
||||
procedure glEnable(cap: GLenum); cdecl; external libname;
|
||||
procedure glEnableClientState(array_: GLenum); cdecl; external libname;
|
||||
procedure glFinish; cdecl; external libname;
|
||||
procedure glFlush; cdecl; external libname;
|
||||
procedure glFogx(pname: GLenum; param: GLfixed); cdecl; external libname;
|
||||
procedure glFogxv(pname: GLenum; params: PGLfixed); cdecl; external libname;
|
||||
procedure glFrontFace(mode: GLenum); cdecl; external libname;
|
||||
procedure glFrustumx(left, right, bottom, top, zNear, zFar: GLfixed); cdecl; external libname;
|
||||
procedure glGetBooleanv(pname: GLenum; params: PGLboolean); cdecl; external libname;
|
||||
procedure glGetBufferParameteriv(target, pname: GLenum; params: PGLint); cdecl; external libname;
|
||||
procedure glGetClipPlanex(pname: GLenum; eqn: GLfixed); cdecl; external libname;
|
||||
procedure glGenBuffers(n: GLsizei; buffers: PGLuint); cdecl; external libname;
|
||||
procedure glGenTextures(n: GLsizei; textures: PGLuint); cdecl; external libname;
|
||||
function glGetError: GLenum; cdecl; external libname;
|
||||
procedure glGetFixedv(pname: GLenum; params: PGLfixed); cdecl; external libname;
|
||||
procedure glGetIntegerv(pname: GLenum; params: PGLint); cdecl; external libname;
|
||||
procedure glGetLightxv(light, pname: GLenum; params: PGLfixed); cdecl; external libname;
|
||||
procedure glGetMaterialxv(face, pname: GLenum; params: PGLfixed); cdecl; external libname;
|
||||
procedure glGetPointerv(pname: GLenum; params: PPointer); cdecl; external libname;
|
||||
function glGetString(name_: GLenum): PGLubyte; cdecl; external libname;
|
||||
procedure glGetTexEnviv(env, pname: GLenum; params: PGLint); cdecl; external libname;
|
||||
procedure glGetTexEnvxv(env, pname: GLenum; params: PGLfixed); cdecl; external libname;
|
||||
procedure glGetTexParameteriv(target, pname: GLenum; params: PGLint); cdecl; external libname;
|
||||
procedure glGetTexParameterxv(target, pname: GLenum; params: PGLfixed); cdecl; external libname;
|
||||
procedure glHint(target, mode: GLenum); cdecl; external libname;
|
||||
function glIsBuffer(buffer: GLuint): GLboolean; cdecl; external libname;
|
||||
function glIsEnabled(cap: GLenum): GLboolean; cdecl; external libname;
|
||||
function glIsTexture(texture: GLuint): GLboolean; cdecl; external libname;
|
||||
procedure glLightModelx(pname: GLenum; param: GLfixed); cdecl; external libname;
|
||||
procedure glLightModelxv(pname: GLenum; params: PGLfixed); cdecl; external libname;
|
||||
procedure glLightx(light, pname: GLenum; param: GLfixed); cdecl; external libname;
|
||||
procedure glLightxv(light, pname: GLenum; params: PGLfixed); cdecl; external libname;
|
||||
procedure glLineWidthx(width: GLfixed); cdecl; external libname;
|
||||
procedure glLoadIdentity; cdecl; external libname;
|
||||
procedure glLoadMatrixx(m: PGLfixed); cdecl; external libname;
|
||||
procedure glLogicOp(opcode: GLenum); cdecl; external libname;
|
||||
procedure glMaterialx(face, pname: GLenum; param: GLfixed); cdecl; external libname;
|
||||
procedure glMaterialxv(face, pname: GLenum; params: PGLfixed); cdecl; external libname;
|
||||
procedure glMatrixMode(mode: GLenum); cdecl; external libname;
|
||||
procedure glMultMatrixx(m: PGLfixed); cdecl; external libname;
|
||||
procedure glMultiTexCoord4x(target: GLenum; s, t, r, q: GLfixed); cdecl; external libname;
|
||||
procedure glNormal3x(nx, ny, nz: GLfixed); cdecl; external libname;
|
||||
procedure glNormalPointer(type_: GLenum; stride: GLsizei; pointer: PGLvoid); cdecl; external libname;
|
||||
procedure glOrthox(left, right, bottom, top, zNear, zFar: GLfixed); cdecl; external libname;
|
||||
procedure glPixelStorei(pname: GLenum; param: GLint); cdecl; external libname;
|
||||
procedure glPointParameterx(pname: GLenum; param: GLfixed); cdecl; external libname;
|
||||
procedure glPointParameterxv(pname: GLenum; params: PGLfixed); cdecl; external libname;
|
||||
procedure glPointSizex(size: GLfixed); cdecl; external libname;
|
||||
procedure glPolygonOffsetx(factor, units: GLfixed); cdecl; external libname;
|
||||
procedure glPopMatrix; cdecl; external libname;
|
||||
procedure glPushMatrix; cdecl; external libname;
|
||||
procedure glReadPixels(x, y: GLint; width, height: GLsizei; format, type_: GLenum; pixels: PGLvoid); cdecl; external libname;
|
||||
procedure glRotatex(angle, x, y, z: GLfixed); cdecl; external libname;
|
||||
procedure glSampleCoverage(value: GLclampf; invert: GLboolean); cdecl; external libname;
|
||||
procedure glSampleCoveragex(value: GLclampx; invert: GLboolean); cdecl; external libname;
|
||||
procedure glScalex(x, y, z: GLfixed); cdecl; external libname;
|
||||
procedure glScissor(x, y: GLint; width, height: GLsizei); cdecl; external libname;
|
||||
procedure glShadeModel(mode: GLenum); cdecl; external libname;
|
||||
procedure glStencilFunc(func: GLenum; ref: GLint; mask: GLuint); cdecl; external libname;
|
||||
procedure glStencilMask(mask: GLuint); cdecl; external libname;
|
||||
procedure glStencilOp(fail, zfail, zpass: GLenum); cdecl; external libname;
|
||||
procedure glTexCoordPointer(size: GLint; type_: GLenum; stride: GLsizei; pointer: PGLvoid); cdecl; external libname;
|
||||
procedure glTexEnvi(target, pname: GLenum; param: GLint); cdecl; external libname;
|
||||
procedure glTexEnvx(target, pname: GLenum; param: GLfixed); cdecl; external libname;
|
||||
procedure glTexEnviv(target, pname: GLenum; params: PGLint); cdecl; external libname;
|
||||
procedure glTexEnvxv(target, pname: GLenum; params: PGLfixed); cdecl; external libname;
|
||||
procedure glTexImage2D(target: GLenum; level, internalformat: GLint; width, height: GLsizei; border: GLint; format, type_: GLenum; pixels: PGLvoid); cdecl; external libname;
|
||||
procedure glTexParameteri(target, pname: GLenum; param: GLint); cdecl; external libname;
|
||||
procedure glTexParameterx(target, pname: GLenum; param: GLfixed); cdecl; external libname;
|
||||
procedure glTexParameteriv(target, pname: GLenum; params: PGLint); cdecl; external libname;
|
||||
procedure glTexParameterxv(target, pname: GLenum; params: PGLfixed); cdecl; external libname;
|
||||
procedure glTexSubImage2D(target: GLenum; level, xoffset, yoffset: GLint; width, height: GLsizei; format, type_: GLenum; pixels: PGLvoid); cdecl; external libname;
|
||||
procedure glTranslatex(x, y, z: GLfixed); cdecl; external libname;
|
||||
procedure glVertexPointer(size: GLint; type_: GLenum; stride: GLsizei; pointer: PGLvoid); cdecl; external libname;
|
||||
procedure glViewport(x, y: GLint; width, height: GLsizei); cdecl; external libname;
|
||||
(*------------------------------------------------------------------------*
|
||||
* Required OES extension functions
|
||||
*------------------------------------------------------------------------ *)
|
||||
|
||||
(* GL_OES_read_format *)
|
||||
|
||||
const
|
||||
GL_OES_read_format = 1;
|
||||
|
||||
(* GL_OES_compressed_paletted_texture *)
|
||||
GL_OES_compressed_paletted_texture = 1;
|
||||
|
||||
(* GL_OES_point_size_array *)
|
||||
GL_OES_point_size_array = 1;
|
||||
|
||||
procedure glPointSizePointerOES(type_: GLenum; stride: GLsizei; pointer: PGLvoid); cdecl; external libname;
|
||||
|
||||
(* GL_OES_point_sprite *)
|
||||
|
||||
const
|
||||
GL_OES_point_sprite = 1;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
678
bindings/android-ndk/input.pas
Normal file
678
bindings/android-ndk/input.pas
Normal file
@ -0,0 +1,678 @@
|
||||
(*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*)
|
||||
|
||||
unit input;
|
||||
|
||||
interface
|
||||
|
||||
uses ctypes,looper,keycodes;
|
||||
|
||||
(******************************************************************
|
||||
*
|
||||
* IMPORTANT NOTICE:
|
||||
*
|
||||
* This file is part of Android's set of stable system headers
|
||||
* exposed by the Android NDK (Native Development Kit).
|
||||
*
|
||||
* Third-party source AND binary code relies on the definitions
|
||||
* here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
|
||||
*
|
||||
* - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
|
||||
* - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
|
||||
* - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
|
||||
* - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
|
||||
*)
|
||||
|
||||
(*
|
||||
* Structures and functions to receive and process input events in
|
||||
* native code.
|
||||
*
|
||||
* NOTE: These functions MUST be implemented by /system/lib/libui.so
|
||||
*)
|
||||
|
||||
(*
|
||||
* Key states (may be returned by queries about the current state of a
|
||||
* particular key code, scan code or switch).
|
||||
*)
|
||||
const
|
||||
(* The key state is unknown or the requested key itself is not supported. *)
|
||||
AKEY_STATE_UNKNOWN = - 1;
|
||||
(* The key is up. *)
|
||||
AKEY_STATE_UP = 0;
|
||||
(* The key is down. *)
|
||||
AKEY_STATE_DOWN = 1;
|
||||
(* The key is down but is a virtual key press that is being emulated by the system. *)
|
||||
AKEY_STATE_VIRTUAL = 2;
|
||||
|
||||
(*
|
||||
* Meta key / modifer state.
|
||||
*)
|
||||
const
|
||||
(* No meta keys are pressed. *)
|
||||
AMETA_NONE = 0;
|
||||
(* This mask is used to check whether one of the ALT meta keys is pressed. *)
|
||||
AMETA_ALT_ON = $02;
|
||||
(* This mask is used to check whether the left ALT meta key is pressed. *)
|
||||
AMETA_ALT_LEFT_ON = $10;
|
||||
(* This mask is used to check whether the right ALT meta key is pressed. *)
|
||||
AMETA_ALT_RIGHT_ON = $20;
|
||||
(* This mask is used to check whether one of the SHIFT meta keys is pressed. *)
|
||||
AMETA_SHIFT_ON = $01;
|
||||
(* This mask is used to check whether the left SHIFT meta key is pressed. *)
|
||||
AMETA_SHIFT_LEFT_ON = $40;
|
||||
(* This mask is used to check whether the right SHIFT meta key is pressed. *)
|
||||
AMETA_SHIFT_RIGHT_ON = $80;
|
||||
(* This mask is used to check whether the SYM meta key is pressed. *)
|
||||
AMETA_SYM_ON = $04;
|
||||
|
||||
(*
|
||||
* Input events.
|
||||
*
|
||||
* Input events are opaque structures. Use the provided accessors functions to
|
||||
* read their properties.
|
||||
*)
|
||||
type
|
||||
PPAInputEvent = ^PAInputEvent;
|
||||
PAInputEvent = ^AInputEvent;
|
||||
|
||||
AInputEvent = record end;
|
||||
|
||||
(*
|
||||
* Input event types.
|
||||
*)
|
||||
const
|
||||
(* Indicates that the input event is a key event. *)
|
||||
AINPUT_EVENT_TYPE_KEY = 1;
|
||||
(* Indicates that the input event is a motion event. *)
|
||||
AINPUT_EVENT_TYPE_MOTION = 2;
|
||||
|
||||
(*
|
||||
* Key event actions.
|
||||
*)
|
||||
const
|
||||
(* The key has been pressed down. *)
|
||||
AKEY_EVENT_ACTION_DOWN = 0;
|
||||
(* The key has been released. *)
|
||||
AKEY_EVENT_ACTION_UP = 1;
|
||||
(* Multiple duplicate key events have occurred in a row, or a complex string is
|
||||
* being delivered. The repeat_count property of the key event contains the number
|
||||
* of times the given key code should be executed.
|
||||
*)
|
||||
AKEY_EVENT_ACTION_MULTIPLE = 2;
|
||||
|
||||
(*
|
||||
* Key event flags.
|
||||
*)
|
||||
const
|
||||
(* This mask is set if the device woke because of this key event. *)
|
||||
AKEY_EVENT_FLAG_WOKE_HERE = $1;
|
||||
(* This mask is set if the key event was generated by a software keyboard. *)
|
||||
AKEY_EVENT_FLAG_SOFT_KEYBOARD = $2;
|
||||
(* This mask is set if we don't want the key event to cause us to leave touch mode. *)
|
||||
AKEY_EVENT_FLAG_KEEP_TOUCH_MODE = $4;
|
||||
(* This mask is set if an event was known to come from a trusted part
|
||||
* of the system. That is, the event is known to come from the user,
|
||||
* and could not have been spoofed by a third party component. *)
|
||||
AKEY_EVENT_FLAG_FROM_SYSTEM = $8;
|
||||
(* This mask is used for compatibility, to identify enter keys that are
|
||||
* coming from an IME whose enter key has been auto-labelled "next" or
|
||||
* "done". This allows TextView to dispatch these as normal enter keys
|
||||
* for old applications, but still do the appropriate action when
|
||||
* receiving them. *)
|
||||
AKEY_EVENT_FLAG_EDITOR_ACTION = $10;
|
||||
(* When associated with up key events, this indicates that the key press
|
||||
* has been canceled. Typically this is used with virtual touch screen
|
||||
* keys, where the user can slide from the virtual key area on to the
|
||||
* display: in that case, the application will receive a canceled up
|
||||
* event and should not perform the action normally associated with the
|
||||
* key. Note that for this to work, the application can not perform an
|
||||
* action for a key until it receives an up or the long press timeout has
|
||||
* expired. *)
|
||||
AKEY_EVENT_FLAG_CANCELED = $20;
|
||||
(* This key event was generated by a virtual (on-screen) hard key area.
|
||||
* Typically this is an area of the touchscreen, outside of the regular
|
||||
* display, dedicated to "hardware" buttons. *)
|
||||
AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY = $40;
|
||||
(* This flag is set for the first key repeat that occurs after the
|
||||
* long press timeout. *)
|
||||
AKEY_EVENT_FLAG_LONG_PRESS = $80;
|
||||
(* Set when a key event has AKEY_EVENT_FLAG_CANCELED set because a long
|
||||
* press action was executed while it was down. *)
|
||||
AKEY_EVENT_FLAG_CANCELED_LONG_PRESS = $100;
|
||||
(* Set for AKEY_EVENT_ACTION_UP when this event's key code is still being
|
||||
* tracked from its initial down. That is, somebody requested that tracking
|
||||
* started on the key down and a long press has not caused
|
||||
* the tracking to be canceled. *)
|
||||
AKEY_EVENT_FLAG_TRACKING = $200;
|
||||
|
||||
|
||||
(*
|
||||
* Motion event actions.
|
||||
*)
|
||||
|
||||
(* Bit shift for the action bits holding the pointer index as
|
||||
* defined by AMOTION_EVENT_ACTION_POINTER_INDEX_MASK.
|
||||
*)
|
||||
const
|
||||
AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT = 8;
|
||||
|
||||
const
|
||||
(* Bit mask of the parts of the action code that are the action itself.
|
||||
*)
|
||||
AMOTION_EVENT_ACTION_MASK = $ff;
|
||||
(* Bits in the action code that represent a pointer index, used with
|
||||
* AMOTION_EVENT_ACTION_POINTER_DOWN and AMOTION_EVENT_ACTION_POINTER_UP. Shifting
|
||||
* down by AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer
|
||||
* index where the data for the pointer going up or down can be found.
|
||||
*)
|
||||
AMOTION_EVENT_ACTION_POINTER_INDEX_MASK = $ff00;
|
||||
(* A pressed gesture has started, the motion contains the initial starting location.
|
||||
*)
|
||||
AMOTION_EVENT_ACTION_DOWN = 0;
|
||||
(* A pressed gesture has finished, the motion contains the final release location
|
||||
* as well as any intermediate points since the last down or move event.
|
||||
*)
|
||||
AMOTION_EVENT_ACTION_UP = 1;
|
||||
(* A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and
|
||||
* AMOTION_EVENT_ACTION_UP). The motion contains the most recent point, as well as
|
||||
* any intermediate points since the last down or move event.
|
||||
*)
|
||||
AMOTION_EVENT_ACTION_MOVE = 2;
|
||||
(* The current gesture has been aborted.
|
||||
* You will not receive any more points in it. You should treat this as
|
||||
* an up event, but not perform any action that you normally would.
|
||||
*)
|
||||
AMOTION_EVENT_ACTION_CANCEL = 3;
|
||||
(* A movement has happened outside of the normal bounds of the UI element.
|
||||
* This does not provide a full gesture, but only the initial location of the movement/touch.
|
||||
*)
|
||||
AMOTION_EVENT_ACTION_OUTSIDE = 4;
|
||||
(* A non-primary pointer has gone down.
|
||||
* The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
|
||||
*)
|
||||
AMOTION_EVENT_ACTION_POINTER_DOWN = 5;
|
||||
(* A non-primary pointer has gone up.
|
||||
* The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
|
||||
*)
|
||||
AMOTION_EVENT_ACTION_POINTER_UP = 6;
|
||||
|
||||
(*
|
||||
* Motion event flags.
|
||||
*)
|
||||
|
||||
const
|
||||
(* This flag indicates that the window that received this motion event is partly
|
||||
* or wholly obscured by another visible window above it. This flag is set to true
|
||||
* even if the event did not directly pass through the obscured area.
|
||||
* A security sensitive application can check this flag to identify situations in which
|
||||
* a malicious application may have covered up part of its content for the purpose
|
||||
* of misleading the user or hijacking touches. An appropriate response might be
|
||||
* to drop the suspect touches or to take additional precautions to confirm the user's
|
||||
* actual intent.
|
||||
*)
|
||||
AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = $1;
|
||||
|
||||
(*
|
||||
* Motion event edge touch flags.
|
||||
*)
|
||||
|
||||
const
|
||||
(* No edges intersected *)
|
||||
AMOTION_EVENT_EDGE_FLAG_NONE = 0;
|
||||
(* Flag indicating the motion event intersected the top edge of the screen. *)
|
||||
AMOTION_EVENT_EDGE_FLAG_TOP = $01;
|
||||
(* Flag indicating the motion event intersected the bottom edge of the screen. *)
|
||||
AMOTION_EVENT_EDGE_FLAG_BOTTOM = $02;
|
||||
(* Flag indicating the motion event intersected the left edge of the screen. *)
|
||||
AMOTION_EVENT_EDGE_FLAG_LEFT = $04;
|
||||
(* Flag indicating the motion event intersected the right edge of the screen. *)
|
||||
AMOTION_EVENT_EDGE_FLAG_RIGHT = $08;
|
||||
|
||||
(*
|
||||
* Input sources.
|
||||
*
|
||||
* Refer to the documentation on android.view.InputDevice for more details about input sources
|
||||
* and their correct interpretation.
|
||||
*)
|
||||
|
||||
const
|
||||
AINPUT_SOURCE_CLASS_MASK = $000000ff;
|
||||
AINPUT_SOURCE_CLASS_BUTTON = $00000001;
|
||||
AINPUT_SOURCE_CLASS_POINTER = $00000002;
|
||||
AINPUT_SOURCE_CLASS_NAVIGATION = $00000004;
|
||||
AINPUT_SOURCE_CLASS_POSITION = $00000008;
|
||||
|
||||
const
|
||||
AINPUT_SOURCE_UNKNOWN = $00000000;
|
||||
AINPUT_SOURCE_KEYBOARD = $00000100 or AINPUT_SOURCE_CLASS_BUTTON;
|
||||
AINPUT_SOURCE_DPAD = $00000200 or AINPUT_SOURCE_CLASS_BUTTON;
|
||||
AINPUT_SOURCE_TOUCHSCREEN = $00001000 or AINPUT_SOURCE_CLASS_POINTER;
|
||||
AINPUT_SOURCE_MOUSE = $00002000 or AINPUT_SOURCE_CLASS_POINTER;
|
||||
AINPUT_SOURCE_TRACKBALL = $00010000 or AINPUT_SOURCE_CLASS_NAVIGATION;
|
||||
AINPUT_SOURCE_TOUCHPAD = $00100000 or AINPUT_SOURCE_CLASS_POSITION;
|
||||
AINPUT_SOURCE_ANY = $ffffff00;
|
||||
|
||||
(*
|
||||
* Keyboard types.
|
||||
*
|
||||
* Refer to the documentation on android.view.InputDevice for more details.
|
||||
*)
|
||||
|
||||
const
|
||||
AINPUT_KEYBOARD_TYPE_NONE = 0;
|
||||
AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC = 1;
|
||||
AINPUT_KEYBOARD_TYPE_ALPHABETIC = 2;
|
||||
|
||||
(*
|
||||
* Constants used to retrieve information about the range of motion for a particular
|
||||
* coordinate of a motion event.
|
||||
*
|
||||
* Refer to the documentation on android.view.InputDevice for more details about input sources
|
||||
* and their correct interpretation.
|
||||
*)
|
||||
|
||||
const
|
||||
AINPUT_MOTION_RANGE_X = 0;
|
||||
AINPUT_MOTION_RANGE_Y = 1;
|
||||
AINPUT_MOTION_RANGE_PRESSURE = 2;
|
||||
AINPUT_MOTION_RANGE_SIZE = 3;
|
||||
AINPUT_MOTION_RANGE_TOUCH_MAJOR = 4;
|
||||
AINPUT_MOTION_RANGE_TOUCH_MINOR = 5;
|
||||
AINPUT_MOTION_RANGE_TOOL_MAJOR = 6;
|
||||
AINPUT_MOTION_RANGE_TOOL_MINOR = 7;
|
||||
AINPUT_MOTION_RANGE_ORIENTATION = 8;
|
||||
|
||||
|
||||
(*
|
||||
* Input event accessors.
|
||||
*
|
||||
* Note that most functions can only be used on input events that are of a given type.
|
||||
* Calling these functions on input events of other types will yield undefined behavior.
|
||||
*)
|
||||
|
||||
(*** Accessors for all input events. ** *)
|
||||
|
||||
(* Get the input event type. *)
|
||||
function AInputEvent_getType(event: PAInputEvent): cint32; cdecl; external;
|
||||
|
||||
(* Get the id for the device that an input event came from.
|
||||
*
|
||||
* Input events can be generated by multiple different input devices.
|
||||
* Use the input device id to obtain information about the input
|
||||
* device that was responsible for generating a particular event.
|
||||
*
|
||||
* An input device id of 0 indicates that the event didn't come from a physical device;
|
||||
* other numbers are arbitrary and you shouldn't depend on the values.
|
||||
* Use the provided input device query API to obtain information about input devices.
|
||||
*)
|
||||
function AInputEvent_getDeviceId(event: PAInputEvent): cint32; cdecl; external;
|
||||
|
||||
(* Get the input event source. *)
|
||||
function AInputEvent_getSource(event: PAInputEvent): cint32; cdecl; external;
|
||||
|
||||
(*** Accessors for key events only. ** *)
|
||||
|
||||
(* Get the key event action. *)
|
||||
|
||||
function AKeyEvent_getAction(key_event: PAInputEvent): cint32; cdecl; external;
|
||||
|
||||
(* Get the key event flags. *)
|
||||
|
||||
function AKeyEvent_getFlags(key_event: PAInputEvent): cint32; cdecl; external;
|
||||
|
||||
(* Get the key code of the key event.
|
||||
* This is the physical key that was pressed, not the Unicode character. *)
|
||||
|
||||
function AKeyEvent_getKeyCode(key_event: PAInputEvent): cint32; cdecl; external;
|
||||
|
||||
(* Get the hardware key id of this key event.
|
||||
* These values are not reliable and vary from device to device. *)
|
||||
|
||||
function AKeyEvent_getScanCode(key_event: PAInputEvent): cint32; cdecl; external;
|
||||
|
||||
(* Get the meta key state. *)
|
||||
|
||||
function AKeyEvent_getMetaState(key_event: PAInputEvent): cint32; cdecl; external;
|
||||
|
||||
(* Get the repeat count of the event.
|
||||
* For both key up an key down events, this is the number of times the key has
|
||||
* repeated with the first down starting at 0 and counting up from there. For
|
||||
* multiple key events, this is the number of down/up pairs that have occurred. *)
|
||||
|
||||
function AKeyEvent_getRepeatCount(key_event: PAInputEvent): cint32; cdecl; external;
|
||||
|
||||
(* Get the time of the most recent key down event, in the
|
||||
* java.lang.System.nanoTime() time base. If this is a down event,
|
||||
* this will be the same as eventTime.
|
||||
* Note that when chording keys, this value is the down time of the most recently
|
||||
* pressed key, which may not be the same physical key of this event. *)
|
||||
|
||||
function AKeyEvent_getDownTime(key_event: PAInputEvent): cint64; cdecl; external;
|
||||
|
||||
(* Get the time this event occurred, in the
|
||||
* java.lang.System.nanoTime() time base. *)
|
||||
|
||||
function AKeyEvent_getEventTime(key_event: PAInputEvent): cint64; cdecl; external;
|
||||
|
||||
(*** Accessors for motion events only. ** *)
|
||||
|
||||
(* Get the combined motion event action code and pointer index. *)
|
||||
|
||||
function AMotionEvent_getAction(motion_event: PAInputEvent): cint32; cdecl; external;
|
||||
|
||||
(* Get the motion event flags. *)
|
||||
|
||||
function AMotionEvent_getFlags(motion_event: PAInputEvent): cint32; cdecl; external;
|
||||
|
||||
(* Get the state of any meta / modifier keys that were in effect when the
|
||||
* event was generated. *)
|
||||
|
||||
function AMotionEvent_getMetaState(motion_event: PAInputEvent): cint32; cdecl; external;
|
||||
|
||||
(* Get a bitfield indicating which edges, if any, were touched by this motion event.
|
||||
* For touch events, clients can use this to determine if the user's finger was
|
||||
* touching the edge of the display. *)
|
||||
|
||||
function AMotionEvent_getEdgeFlags(motion_event: PAInputEvent): cint32; cdecl; external;
|
||||
|
||||
(* Get the time when the user originally pressed down to start a stream of
|
||||
* position events, in the java.lang.System.nanoTime() time base. *)
|
||||
|
||||
function AMotionEvent_getDownTime(motion_event: PAInputEvent): cint64; cdecl; external;
|
||||
|
||||
(* Get the time when this specific event was generated,
|
||||
* in the java.lang.System.nanoTime() time base. *)
|
||||
|
||||
function AMotionEvent_getEventTime(motion_event: PAInputEvent): cint64; cdecl; external;
|
||||
|
||||
(* Get the X coordinate offset.
|
||||
* For touch events on the screen, this is the delta that was added to the raw
|
||||
* screen coordinates to adjust for the absolute position of the containing windows
|
||||
* and views. *)
|
||||
|
||||
function AMotionEvent_getXOffset(motion_event: PAInputEvent): cfloat; cdecl; external;
|
||||
|
||||
(* Get the precision of the Y coordinates being reported.
|
||||
* For touch events on the screen, this is the delta that was added to the raw
|
||||
* screen coordinates to adjust for the absolute position of the containing windows
|
||||
* and views. *)
|
||||
|
||||
function AMotionEvent_getYOffset(motion_event: PAInputEvent): cfloat; cdecl; external;
|
||||
|
||||
(* Get the precision of the X coordinates being reported.
|
||||
* You can multiply this number with an X coordinate sample to find the
|
||||
* actual hardware value of the X coordinate. *)
|
||||
|
||||
function AMotionEvent_getXPrecision(motion_event: PAInputEvent): cfloat; cdecl; external;
|
||||
|
||||
(* Get the precision of the Y coordinates being reported.
|
||||
* You can multiply this number with a Y coordinate sample to find the
|
||||
* actual hardware value of the Y coordinate. *)
|
||||
|
||||
function AMotionEvent_getYPrecision(motion_event: PAInputEvent): cfloat; cdecl; external;
|
||||
|
||||
(* Get the number of pointers of data contained in this event.
|
||||
* Always >= 1. *)
|
||||
|
||||
function AMotionEvent_getPointerCount(motion_event: PAInputEvent): csize_t; cdecl; external;
|
||||
|
||||
(* Get the pointer identifier associated with a particular pointer
|
||||
* data index is this event. The identifier tells you the actual pointer
|
||||
* number associated with the data, accounting for individual pointers
|
||||
* going up and down since the start of the current gesture. *)
|
||||
|
||||
function AMotionEvent_getPointerId(motion_event: PAInputEvent; pointer_index: csize_t): cint32; cdecl; external;
|
||||
|
||||
(* Get the original raw X coordinate of this event.
|
||||
* For touch events on the screen, this is the original location of the event
|
||||
* on the screen, before it had been adjusted for the containing window
|
||||
* and views. *)
|
||||
|
||||
function AMotionEvent_getRawX(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the original raw X coordinate of this event.
|
||||
* For touch events on the screen, this is the original location of the event
|
||||
* on the screen, before it had been adjusted for the containing window
|
||||
* and views. *)
|
||||
|
||||
function AMotionEvent_getRawY(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the current X coordinate of this event for the given pointer index.
|
||||
* Whole numbers are pixels; the value may have a fraction for input devices
|
||||
* that are sub-pixel precise. *)
|
||||
|
||||
function AMotionEvent_getX(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the current Y coordinate of this event for the given pointer index.
|
||||
* Whole numbers are pixels; the value may have a fraction for input devices
|
||||
* that are sub-pixel precise. *)
|
||||
|
||||
function AMotionEvent_getY(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the current pressure of this event for the given pointer index.
|
||||
* The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
|
||||
* however values higher than 1 may be generated depending on the calibration of
|
||||
* the input device. *)
|
||||
|
||||
function AMotionEvent_getPressure(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the current scaled value of the approximate size for the given pointer index.
|
||||
* This represents some approximation of the area of the screen being
|
||||
* pressed; the actual value in pixels corresponding to the
|
||||
* touch is normalized with the device specific range of values
|
||||
* and scaled to a value between 0 and 1. The value of size can be used to
|
||||
* determine fat touch events. *)
|
||||
|
||||
function AMotionEvent_getSize(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the current length of the major axis of an ellipse that describes the touch area
|
||||
* at the point of contact for the given pointer index. *)
|
||||
|
||||
function AMotionEvent_getTouchMajor(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the current length of the minor axis of an ellipse that describes the touch area
|
||||
* at the point of contact for the given pointer index. *)
|
||||
|
||||
function AMotionEvent_getTouchMinor(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the current length of the major axis of an ellipse that describes the size
|
||||
* of the approaching tool for the given pointer index.
|
||||
* The tool area represents the estimated size of the finger or pen that is
|
||||
* touching the device independent of its actual touch area at the point of contact. *)
|
||||
|
||||
function AMotionEvent_getToolMajor(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the current length of the minor axis of an ellipse that describes the size
|
||||
* of the approaching tool for the given pointer index.
|
||||
* The tool area represents the estimated size of the finger or pen that is
|
||||
* touching the device independent of its actual touch area at the point of contact. *)
|
||||
|
||||
function AMotionEvent_getToolMinor(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the current orientation of the touch area and tool area in radians clockwise from
|
||||
* vertical for the given pointer index.
|
||||
* An angle of 0 degrees indicates that the major axis of contact is oriented
|
||||
* upwards, is perfectly circular or is of unknown orientation. A positive angle
|
||||
* indicates that the major axis of contact is oriented to the right. A negative angle
|
||||
* indicates that the major axis of contact is oriented to the left.
|
||||
* The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
|
||||
* (finger pointing fully right). *)
|
||||
|
||||
function AMotionEvent_getOrientation(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the number of historical points in this event. These are movements that
|
||||
* have occurred between this event and the previous event. This only applies
|
||||
* to AMOTION_EVENT_ACTION_MOVE events -- all other actions will have a size of 0.
|
||||
* Historical samples are indexed from oldest to newest. *)
|
||||
|
||||
function AMotionEvent_getHistorySize(motion_event: PAInputEvent): csize_t; cdecl; external;
|
||||
|
||||
(* Get the time that a historical movement occurred between this event and
|
||||
* the previous event, in the java.lang.System.nanoTime() time base. *)
|
||||
|
||||
function AMotionEvent_getHistoricalEventTime(motion_event: PAInputEvent; history_index: csize_t): cint64; cdecl; external;
|
||||
|
||||
(* Get the historical raw X coordinate of this event for the given pointer index that
|
||||
* occurred between this event and the previous motion event.
|
||||
* For touch events on the screen, this is the original location of the event
|
||||
* on the screen, before it had been adjusted for the containing window
|
||||
* and views.
|
||||
* Whole numbers are pixels; the value may have a fraction for input devices
|
||||
* that are sub-pixel precise. *)
|
||||
|
||||
function AMotionEvent_getHistoricalRawX(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the historical raw Y coordinate of this event for the given pointer index that
|
||||
* occurred between this event and the previous motion event.
|
||||
* For touch events on the screen, this is the original location of the event
|
||||
* on the screen, before it had been adjusted for the containing window
|
||||
* and views.
|
||||
* Whole numbers are pixels; the value may have a fraction for input devices
|
||||
* that are sub-pixel precise. *)
|
||||
|
||||
function AMotionEvent_getHistoricalRawY(motion_event: PAInputEvent; pointer_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the historical X coordinate of this event for the given pointer index that
|
||||
* occurred between this event and the previous motion event.
|
||||
* Whole numbers are pixels; the value may have a fraction for input devices
|
||||
* that are sub-pixel precise. *)
|
||||
|
||||
function AMotionEvent_getHistoricalX(motion_event: PAInputEvent; pointer_index, history_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the historical Y coordinate of this event for the given pointer index that
|
||||
* occurred between this event and the previous motion event.
|
||||
* Whole numbers are pixels; the value may have a fraction for input devices
|
||||
* that are sub-pixel precise. *)
|
||||
|
||||
function AMotionEvent_getHistoricalY(motion_event: PAInputEvent; pointer_index, history_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the historical pressure of this event for the given pointer index that
|
||||
* occurred between this event and the previous motion event.
|
||||
* The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
|
||||
* however values higher than 1 may be generated depending on the calibration of
|
||||
* the input device. *)
|
||||
|
||||
function AMotionEvent_getHistoricalPressure(motion_event: PAInputEvent; pointer_index, history_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the current scaled value of the approximate size for the given pointer index that
|
||||
* occurred between this event and the previous motion event.
|
||||
* This represents some approximation of the area of the screen being
|
||||
* pressed; the actual value in pixels corresponding to the
|
||||
* touch is normalized with the device specific range of values
|
||||
* and scaled to a value between 0 and 1. The value of size can be used to
|
||||
* determine fat touch events. *)
|
||||
|
||||
function AMotionEvent_getHistoricalSize(motion_event: PAInputEvent; pointer_index, history_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the historical length of the major axis of an ellipse that describes the touch area
|
||||
* at the point of contact for the given pointer index that
|
||||
* occurred between this event and the previous motion event. *)
|
||||
|
||||
function AMotionEvent_getHistoricalTouchMajor(motion_event: PAInputEvent; pointer_index, history_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the historical length of the minor axis of an ellipse that describes the touch area
|
||||
* at the point of contact for the given pointer index that
|
||||
* occurred between this event and the previous motion event. *)
|
||||
|
||||
function AMotionEvent_getHistoricalTouchMinor(motion_event: PAInputEvent; pointer_index, history_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the historical length of the major axis of an ellipse that describes the size
|
||||
* of the approaching tool for the given pointer index that
|
||||
* occurred between this event and the previous motion event.
|
||||
* The tool area represents the estimated size of the finger or pen that is
|
||||
* touching the device independent of its actual touch area at the point of contact. *)
|
||||
|
||||
function AMotionEvent_getHistoricalToolMajor(motion_event: PAInputEvent; pointer_index, history_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the historical length of the minor axis of an ellipse that describes the size
|
||||
* of the approaching tool for the given pointer index that
|
||||
* occurred between this event and the previous motion event.
|
||||
* The tool area represents the estimated size of the finger or pen that is
|
||||
* touching the device independent of its actual touch area at the point of contact. *)
|
||||
|
||||
function AMotionEvent_getHistoricalToolMinor(motion_event: PAInputEvent; pointer_index, history_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
(* Get the historical orientation of the touch area and tool area in radians clockwise from
|
||||
* vertical for the given pointer index that
|
||||
* occurred between this event and the previous motion event.
|
||||
* An angle of 0 degrees indicates that the major axis of contact is oriented
|
||||
* upwards, is perfectly circular or is of unknown orientation. A positive angle
|
||||
* indicates that the major axis of contact is oriented to the right. A negative angle
|
||||
* indicates that the major axis of contact is oriented to the left.
|
||||
* The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
|
||||
* (finger pointing fully right). *)
|
||||
|
||||
function AMotionEvent_getHistoricalOrientation(motion_event: PAInputEvent; pointer_index, history_index: csize_t): cfloat; cdecl; external;
|
||||
|
||||
|
||||
(*
|
||||
* Input queue
|
||||
*
|
||||
* An input queue is the facility through which you retrieve input
|
||||
* events.
|
||||
*)
|
||||
|
||||
type
|
||||
PAInputQueue = ^AInputQueue;
|
||||
AInputQueue = record end;
|
||||
|
||||
(*
|
||||
* Add this input queue to a looper for processing. See
|
||||
* ALooper_addFd() for information on the ident, callback, and data params.
|
||||
*)
|
||||
procedure AInputQueue_attachLooper(queue: PAInputQueue; looper: PALooper; ident: cint; callback: ALooper_callbackFunc; data: Pointer); cdecl; external;
|
||||
|
||||
(*
|
||||
* Remove the input queue from the looper it is currently attached to.
|
||||
*)
|
||||
|
||||
procedure AInputQueue_detachLooper(queue: PAInputQueue); cdecl; external;
|
||||
|
||||
(*
|
||||
* Returns true if there are one or more events available in the
|
||||
* input queue. Returns 1 if the queue has events; 0 if
|
||||
* it does not have events; and a negative value if there is an error.
|
||||
*)
|
||||
|
||||
function AInputQueue_hasEvents(queue: PAInputQueue): cint32; cdecl; external;
|
||||
|
||||
(*
|
||||
* Returns the next available event from the queue. Returns a negative
|
||||
* value if no events are available or an error has occurred.
|
||||
*)
|
||||
function AInputQueue_getEvent(queue: PAInputQueue; outEvent: PPAInputEvent): cint32; cdecl; external;
|
||||
|
||||
(*
|
||||
* Sends the key for standard pre-dispatching -- that is, possibly deliver
|
||||
* it to the current IME to be consumed before the app. Returns 0 if it
|
||||
* was not pre-dispatched, meaning you can process it right now. If non-zero
|
||||
* is returned, you must abandon the current event processing and allow the
|
||||
* event to appear again in the event queue (if it does not get consumed during
|
||||
* pre-dispatching).
|
||||
*)
|
||||
function AInputQueue_preDispatchEvent(queue: PAInputQueue; event: PAInputEvent): cint32; cdecl; external;
|
||||
|
||||
(*
|
||||
* Report that dispatching has finished with the given event.
|
||||
* This must be called after receiving an event with AInputQueue_get_event().
|
||||
*)
|
||||
|
||||
procedure AInputQueue_finishEvent(queue: PAInputQueue; event: PAInputEvent; handled: cint); cdecl; external;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
536
bindings/android-ndk/jni.pas
Normal file
536
bindings/android-ndk/jni.pas
Normal file
@ -0,0 +1,536 @@
|
||||
unit jni;
|
||||
{$ifdef fpc}
|
||||
{$mode delphi}
|
||||
{$packrecords c}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
(*
|
||||
* Manifest constants.
|
||||
*)
|
||||
const JNI_FALSE=0;
|
||||
JNI_TRUE=1;
|
||||
|
||||
JNI_VERSION_1_1=$00010001;
|
||||
JNI_VERSION_1_2=$00010002;
|
||||
JNI_VERSION_1_4=$00010004;
|
||||
JNI_VERSION_1_6=$00010006;
|
||||
|
||||
JNI_OK=0; // no error
|
||||
JNI_ERR=-1; // generic error
|
||||
JNI_EDETACHED=-2; // thread detached from the VM
|
||||
JNI_EVERSION=-3; // JNI version error
|
||||
|
||||
JNI_COMMIT=1; // copy content, do not free buffer
|
||||
JNI_ABORT=2; // free buffer w/o copying back
|
||||
|
||||
(*
|
||||
* Type definitions.
|
||||
*)
|
||||
type va_list=pointer;
|
||||
|
||||
jboolean=byte; // unsigned 8 bits
|
||||
jbyte=shortint; // signed 8 bits
|
||||
jchar=word; // unsigned 16 bits
|
||||
jshort=smallint; // signed 16 bits
|
||||
jint=longint; // signed 32 bits
|
||||
jlong=int64; // signed 64 bits
|
||||
jfloat=single; // 32-bit IEEE 754
|
||||
jdouble=double; // 64-bit IEEE 754
|
||||
|
||||
jsize=jint; // "cardinal indices and sizes"
|
||||
|
||||
Pjboolean=^jboolean;
|
||||
Pjbyte=^jbyte;
|
||||
Pjchar=^jchar;
|
||||
Pjshort=^jshort;
|
||||
Pjint=^jint;
|
||||
Pjlong=^jlong;
|
||||
Pjfloat=^jfloat;
|
||||
Pjdouble=^jdouble;
|
||||
|
||||
Pjsize=^jsize;
|
||||
|
||||
// Reference type
|
||||
jobject=pointer;
|
||||
jclass=jobject;
|
||||
jstring=jobject;
|
||||
jarray=jobject;
|
||||
jobjectArray=jarray;
|
||||
jbooleanArray=jarray;
|
||||
jbyteArray=jarray;
|
||||
jcharArray=jarray;
|
||||
jshortArray=jarray;
|
||||
jintArray=jarray;
|
||||
jlongArray=jarray;
|
||||
jfloatArray=jarray;
|
||||
jdoubleArray=jarray;
|
||||
jthrowable=jobject;
|
||||
jweak=jobject;
|
||||
jref=jobject;
|
||||
|
||||
PPointer=^pointer;
|
||||
Pjobject=^jobject;
|
||||
Pjclass=^jclass;
|
||||
Pjstring=^jstring;
|
||||
Pjarray=^jarray;
|
||||
PjobjectArray=^jobjectArray;
|
||||
PjbooleanArray=^jbooleanArray;
|
||||
PjbyteArray=^jbyteArray;
|
||||
PjcharArray=^jcharArray;
|
||||
PjshortArray=^jshortArray;
|
||||
PjintArray=^jintArray;
|
||||
PjlongArray=^jlongArray;
|
||||
PjfloatArray=^jfloatArray;
|
||||
PjdoubleArray=^jdoubleArray;
|
||||
Pjthrowable=^jthrowable;
|
||||
Pjweak=^jweak;
|
||||
Pjref=^jref;
|
||||
|
||||
_jfieldID=record // opaque structure
|
||||
end;
|
||||
jfieldID=^_jfieldID;// field IDs
|
||||
PjfieldID=^jfieldID;
|
||||
|
||||
_jmethodID=record // opaque structure
|
||||
end;
|
||||
jmethodID=^_jmethodID;// method IDs
|
||||
PjmethodID=^jmethodID;
|
||||
|
||||
PJNIInvokeInterface=^JNIInvokeInterface;
|
||||
|
||||
Pjvalue=^jvalue;
|
||||
jvalue={$ifdef packedrecords}packed{$endif} record
|
||||
case integer of
|
||||
0:(z:jboolean);
|
||||
1:(b:jbyte);
|
||||
2:(c:jchar);
|
||||
3:(s:jshort);
|
||||
4:(i:jint);
|
||||
5:(j:jlong);
|
||||
6:(f:jfloat);
|
||||
7:(d:jdouble);
|
||||
8:(l:jobject);
|
||||
end;
|
||||
|
||||
jobjectRefType=(
|
||||
JNIInvalidRefType=0,
|
||||
JNILocalRefType=1,
|
||||
JNIGlobalRefType=2,
|
||||
JNIWeakGlobalRefType=3);
|
||||
|
||||
PJNINativeMethod=^JNINativeMethod;
|
||||
JNINativeMethod={$ifdef packedrecords}packed{$endif} record
|
||||
name:pchar;
|
||||
signature:pchar;
|
||||
fnPtr:pointer;
|
||||
end;
|
||||
|
||||
PJNINativeInterface=^JNINativeInterface;
|
||||
|
||||
_JNIEnv={$ifdef packedrecords}packed{$endif} record
|
||||
functions:PJNINativeInterface;
|
||||
end;
|
||||
|
||||
_JavaVM={$ifdef packedrecords}packed{$endif} record
|
||||
functions:PJNIInvokeInterface;
|
||||
end;
|
||||
|
||||
C_JNIEnv=^JNINativeInterface;
|
||||
JNIEnv=^JNINativeInterface;
|
||||
JavaVM=^JNIInvokeInterface;
|
||||
|
||||
PPJNIEnv=^PJNIEnv;
|
||||
PJNIEnv=^JNIEnv;
|
||||
|
||||
PPJavaVM=^PJavaVM;
|
||||
PJavaVM=^JavaVM;
|
||||
|
||||
JNINativeInterface={$ifdef packedrecords}packed{$endif} record
|
||||
reserved0:pointer;
|
||||
reserved1:pointer;
|
||||
reserved2:pointer;
|
||||
reserved3:pointer;
|
||||
|
||||
GetVersion:function(Env:PJNIEnv):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
DefineClass:function(Env:PJNIEnv;const Name:pchar;Loader:JObject;const Buf:PJByte;Len:JSize):JClass;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
FindClass:function(Env:PJNIEnv;const Name:pchar):JClass;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
// Reflection Support
|
||||
FromReflectedMethod:function(Env:PJNIEnv;Method:JObject):JMethodID;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
FromReflectedField:function(Env:PJNIEnv;Field:JObject):JFieldID;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
ToReflectedMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;IsStatic:JBoolean):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
GetSuperclass:function(Env:PJNIEnv;Sub:JClass):JClass;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
IsAssignableFrom:function(Env:PJNIEnv;Sub:JClass;Sup:JClass):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
// Reflection Support
|
||||
ToReflectedField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;IsStatic:JBoolean):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
Throw:function(Env:PJNIEnv;Obj:JThrowable):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
ThrowNew:function(Env:PJNIEnv;AClass:JClass;const Msg:pchar):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
ExceptionOccurred:function(Env:PJNIEnv):JThrowable;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
ExceptionDescribe:procedure(Env:PJNIEnv);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
ExceptionClear:procedure(Env:PJNIEnv);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
FatalError:procedure(Env:PJNIEnv;const Msg:pchar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
// Local Reference Management
|
||||
PushLocalFrame:function(Env:PJNIEnv;Capacity:JInt):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
PopLocalFrame:function(Env:PJNIEnv;Result:JObject):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
NewGlobalRef:function(Env:PJNIEnv;LObj:JObject):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
DeleteGlobalRef:procedure(Env:PJNIEnv;GRef:JObject);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
DeleteLocalRef:procedure(Env:PJNIEnv;Obj:JObject);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
IsSameObject:function(Env:PJNIEnv;Obj1:JObject;Obj2:JObject):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
// Local Reference Management
|
||||
NewLocalRef:function(Env:PJNIEnv;Ref:JObject):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
EnsureLocalCapacity:function(Env:PJNIEnv;Capacity:JInt):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
AllocObject:function(Env:PJNIEnv;AClass:JClass):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
NewObject:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
NewObjectV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
NewObjectA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
GetObjectClass:function(Env:PJNIEnv;Obj:JObject):JClass;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
IsInstanceOf:function(Env:PJNIEnv;Obj:JObject;AClass:JClass):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
GetMethodID:function(Env:PJNIEnv;AClass:JClass;const Name:pchar;const Sig:pchar):JMethodID;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallObjectMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallObjectMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallObjectMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallBooleanMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallBooleanMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallBooleanMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallByteMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallByteMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallByteMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallCharMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallCharMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallCharMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallShortMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallShortMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallShortMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallIntMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallIntMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallIntMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallLongMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallLongMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallLongMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallFloatMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallFloatMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallFloatMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallDoubleMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallDoubleMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallDoubleMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallVoidMethod:procedure(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallVoidMethodV:procedure(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallVoidMethodA:procedure(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallNonvirtualObjectMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualObjectMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualObjectMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallNonvirtualBooleanMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualBooleanMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualBooleanMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallNonvirtualByteMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualByteMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualByteMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallNonvirtualCharMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualCharMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualCharMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallNonvirtualShortMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualShortMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualShortMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallNonvirtualIntMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualIntMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualIntMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallNonvirtualLongMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualLongMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualLongMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallNonvirtualFloatMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualFloatMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualFloatMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallNonvirtualDoubleMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualDoubleMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualDoubleMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallNonvirtualVoidMethod:procedure(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualVoidMethodV:procedure(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallNonvirtualVoidMethodA:procedure(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
GetFieldID:function(Env:PJNIEnv;AClass:JClass;const Name:pchar;const Sig:pchar):JFieldID;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
GetObjectField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetBooleanField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetByteField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetCharField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetShortField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetIntField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetLongField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetFloatField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetDoubleField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
SetObjectField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JObject);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetBooleanField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JBoolean);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetByteField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JByte);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetCharField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JChar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetShortField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JShort);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetIntField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetLongField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JLong);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetFloatField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JFloat);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetDoubleField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JDouble);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
GetStaticMethodID:function(Env:PJNIEnv;AClass:JClass;const Name:pchar;const Sig:pchar):JMethodID;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallStaticObjectMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticObjectMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticObjectMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallStaticBooleanMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticBooleanMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticBooleanMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallStaticByteMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticByteMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticByteMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallStaticCharMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticCharMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticCharMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallStaticShortMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticShortMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticShortMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallStaticIntMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticIntMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticIntMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallStaticLongMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticLongMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticLongMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallStaticFloatMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticFloatMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticFloatMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallStaticDoubleMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticDoubleMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticDoubleMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
CallStaticVoidMethod:procedure(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticVoidMethodV:procedure(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
CallStaticVoidMethodA:procedure(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
GetStaticFieldID:function(Env:PJNIEnv;AClass:JClass;const Name:pchar;const Sig:pchar):JFieldID;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetStaticObjectField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetStaticBooleanField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetStaticByteField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetStaticCharField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetStaticShortField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetStaticIntField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetStaticLongField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetStaticFloatField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetStaticDoubleField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
SetStaticObjectField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JObject);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetStaticBooleanField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JBoolean);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetStaticByteField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JByte);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetStaticCharField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JChar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetStaticShortField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JShort);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetStaticIntField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetStaticLongField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JLong);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetStaticFloatField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JFloat);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetStaticDoubleField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JDouble);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
NewString:function(Env:PJNIEnv;const Unicode:PJChar;Len:JSize):JString;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetStringLength:function(Env:PJNIEnv;Str:JString):JSize;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetStringChars:function(Env:PJNIEnv;Str:JString;var IsCopy:JBoolean):PJChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
ReleaseStringChars:procedure(Env:PJNIEnv;Str:JString;const Chars:PJChar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
NewStringUTF:function(Env:PJNIEnv;const UTF:pchar):JString;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetStringUTFLength:function(Env:PJNIEnv;Str:JString):JSize;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetStringUTFChars:function(Env:PJNIEnv;Str:JString;var IsCopy:JBoolean):pchar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
ReleaseStringUTFChars:procedure(Env:PJNIEnv;Str:JString;const Chars:pchar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
GetArrayLength:function(Env:PJNIEnv;AArray:JArray):JSize;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
NewObjectArray:function(Env:PJNIEnv;Len:JSize;AClass:JClass;Init:JObject):JObjectArray;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetObjectArrayElement:function(Env:PJNIEnv;AArray:JObjectArray;Index:JSize):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetObjectArrayElement:procedure(Env:PJNIEnv;AArray:JObjectArray;Index:JSize;Val:JObject);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
NewBooleanArray:function(Env:PJNIEnv;Len:JSize):JBooleanArray;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
NewByteArray:function(Env:PJNIEnv;Len:JSize):JByteArray;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
NewCharArray:function(Env:PJNIEnv;Len:JSize):JCharArray;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
NewShortArray:function(Env:PJNIEnv;Len:JSize):JShortArray;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
NewIntArray:function(Env:PJNIEnv;Len:JSize):JIntArray;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
NewLongArray:function(Env:PJNIEnv;Len:JSize):JLongArray;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
NewFloatArray:function(Env:PJNIEnv;Len:JSize):JFloatArray;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
NewDoubleArray:function(Env:PJNIEnv;Len:JSize):JDoubleArray;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
GetBooleanArrayElements:function(Env:PJNIEnv;AArray:JBooleanArray;var IsCopy:JBoolean):PJBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetByteArrayElements:function(Env:PJNIEnv;AArray:JByteArray;var IsCopy:JBoolean):PJByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetCharArrayElements:function(Env:PJNIEnv;AArray:JCharArray;var IsCopy:JBoolean):PJChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetShortArrayElements:function(Env:PJNIEnv;AArray:JShortArray;var IsCopy:JBoolean):PJShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetIntArrayElements:function(Env:PJNIEnv;AArray:JIntArray;var IsCopy:JBoolean):PJInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetLongArrayElements:function(Env:PJNIEnv;AArray:JLongArray;var IsCopy:JBoolean):PJLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetFloatArrayElements:function(Env:PJNIEnv;AArray:JFloatArray;var IsCopy:JBoolean):PJFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetDoubleArrayElements:function(Env:PJNIEnv;AArray:JDoubleArray;var IsCopy:JBoolean):PJDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
ReleaseBooleanArrayElements:procedure(Env:PJNIEnv;AArray:JBooleanArray;Elems:PJBoolean;Mode:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
ReleaseByteArrayElements:procedure(Env:PJNIEnv;AArray:JByteArray;Elems:PJByte;Mode:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
ReleaseCharArrayElements:procedure(Env:PJNIEnv;AArray:JCharArray;Elems:PJChar;Mode:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
ReleaseShortArrayElements:procedure(Env:PJNIEnv;AArray:JShortArray;Elems:PJShort;Mode:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
ReleaseIntArrayElements:procedure(Env:PJNIEnv;AArray:JIntArray;Elems:PJInt;Mode:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
ReleaseLongArrayElements:procedure(Env:PJNIEnv;AArray:JLongArray;Elems:PJLong;Mode:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
ReleaseFloatArrayElements:procedure(Env:PJNIEnv;AArray:JFloatArray;Elems:PJFloat;Mode:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
ReleaseDoubleArrayElements:procedure(Env:PJNIEnv;AArray:JDoubleArray;Elems:PJDouble;Mode:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
GetBooleanArrayRegion:procedure(Env:PJNIEnv;AArray:JBooleanArray;Start:JSize;Len:JSize;Buf:PJBoolean);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetByteArrayRegion:procedure(Env:PJNIEnv;AArray:JByteArray;Start:JSize;Len:JSize;Buf:PJByte);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetCharArrayRegion:procedure(Env:PJNIEnv;AArray:JCharArray;Start:JSize;Len:JSize;Buf:PJChar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetShortArrayRegion:procedure(Env:PJNIEnv;AArray:JShortArray;Start:JSize;Len:JSize;Buf:PJShort);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetIntArrayRegion:procedure(Env:PJNIEnv;AArray:JIntArray;Start:JSize;Len:JSize;Buf:PJInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetLongArrayRegion:procedure(Env:PJNIEnv;AArray:JLongArray;Start:JSize;Len:JSize;Buf:PJLong);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetFloatArrayRegion:procedure(Env:PJNIEnv;AArray:JFloatArray;Start:JSize;Len:JSize;Buf:PJFloat);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetDoubleArrayRegion:procedure(Env:PJNIEnv;AArray:JDoubleArray;Start:JSize;Len:JSize;Buf:PJDouble);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
SetBooleanArrayRegion:procedure(Env:PJNIEnv;AArray:JBooleanArray;Start:JSize;Len:JSize;Buf:PJBoolean);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetByteArrayRegion:procedure(Env:PJNIEnv;AArray:JByteArray;Start:JSize;Len:JSize;Buf:PJByte);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetCharArrayRegion:procedure(Env:PJNIEnv;AArray:JCharArray;Start:JSize;Len:JSize;Buf:PJChar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetShortArrayRegion:procedure(Env:PJNIEnv;AArray:JShortArray;Start:JSize;Len:JSize;Buf:PJShort);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetIntArrayRegion:procedure(Env:PJNIEnv;AArray:JIntArray;Start:JSize;Len:JSize;Buf:PJInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetLongArrayRegion:procedure(Env:PJNIEnv;AArray:JLongArray;Start:JSize;Len:JSize;Buf:PJLong);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetFloatArrayRegion:procedure(Env:PJNIEnv;AArray:JFloatArray;Start:JSize;Len:JSize;Buf:PJFloat);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
SetDoubleArrayRegion:procedure(Env:PJNIEnv;AArray:JDoubleArray;Start:JSize;Len:JSize;Buf:PJDouble);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
RegisterNatives:function(Env:PJNIEnv;AClass:JClass;const Methods:PJNINativeMethod;NMethods:JInt):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
UnregisterNatives:function(Env:PJNIEnv;AClass:JClass):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
MonitorEnter:function(Env:PJNIEnv;Obj:JObject):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
MonitorExit:function(Env:PJNIEnv;Obj:JObject):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
GetJavaVM:function(Env:PJNIEnv;var VM:JavaVM):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
// String Operations
|
||||
GetStringRegion:procedure(Env:PJNIEnv;Str:JString;Start:JSize;Len:JSize;Buf:PJChar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetStringUTFRegion:procedure(Env:PJNIEnv;Str:JString;Start:JSize;Len:JSize;Buf:pchar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
// Array Operations
|
||||
GetPrimitiveArrayCritical:function(Env:PJNIEnv;AArray:JArray;var IsCopy:JBoolean):pointer;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
ReleasePrimitiveArrayCritical:procedure(Env:PJNIEnv;AArray:JArray;CArray:pointer;Mode:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
// String Operations
|
||||
GetStringCritical:function(Env:PJNIEnv;Str:JString;var IsCopy:JBoolean):PJChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
ReleaseStringCritical:procedure(Env:PJNIEnv;Str:JString;CString:PJChar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
// Weak Global References
|
||||
NewWeakGlobalRef:function(Env:PJNIEnv;Obj:JObject):JWeak;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
DeleteWeakGlobalRef:procedure(Env:PJNIEnv;Ref:JWeak);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
// Exceptions
|
||||
ExceptionCheck:function(Env:PJNIEnv):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
// J2SDK1_4
|
||||
NewDirectByteBuffer:function(Env:PJNIEnv;Address:pointer;Capacity:JLong):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetDirectBufferAddress:function(Env:PJNIEnv;Buf:JObject):pointer;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetDirectBufferCapacity:function(Env:PJNIEnv;Buf:JObject):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
|
||||
// added in JNI 1.6
|
||||
GetObjectRefType:function(Env:PJNIEnv;AObject:JObject):jobjectRefType;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
end;
|
||||
|
||||
JNIInvokeInterface={$ifdef packedrecords}packed{$endif} record
|
||||
reserved0:pointer;
|
||||
reserved1:pointer;
|
||||
reserved2:pointer;
|
||||
|
||||
DestroyJavaVM:function(PVM:PJavaVM):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
AttachCurrentThread:function(PVM:PJavaVM;PEnv:PPJNIEnv;Args:pointer):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
DetachCurrentThread:function(PVM:PJavaVM):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
GetEnv:function(PVM:PJavaVM;PEnv:Ppointer;Version:JInt):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
AttachCurrentThreadAsDaemon:function(PVM:PJavaVM;PEnv:PPJNIEnv;Args:pointer):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
end;
|
||||
|
||||
JavaVMAttachArgs={$ifdef packedrecords}packed{$endif} record
|
||||
version:jint; // must be >= JNI_VERSION_1_2
|
||||
name:pchar; // NULL or name of thread as modified UTF-8 str
|
||||
group:jobject; // global ref of a ThreadGroup object, or NULL
|
||||
end;
|
||||
|
||||
(**
|
||||
* JNI 1.2+ initialization. (As of 1.6, the pre-1.2 structures are no
|
||||
* longer supported.)
|
||||
*)
|
||||
|
||||
PJavaVMOption=^JavaVMOption;
|
||||
JavaVMOption={$ifdef packedrecords}packed{$endif} record
|
||||
optionString:pchar;
|
||||
extraInfo:pointer;
|
||||
end;
|
||||
|
||||
JavaVMInitArgs={$ifdef packedrecords}packed{$endif} record
|
||||
version:jint; // use JNI_VERSION_1_2 or later
|
||||
nOptions:jint;
|
||||
options:PJavaVMOption;
|
||||
ignoreUnrecognized:Pjboolean;
|
||||
end;
|
||||
|
||||
(*
|
||||
* VM initialization functions.
|
||||
*
|
||||
* Note these are the only symbols exported for JNI by the VM.
|
||||
*)
|
||||
{$ifdef jniexternals}
|
||||
function JNI_GetDefaultJavaVMInitArgs(p:pointer):jint;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}external 'jni' name 'JNI_GetDefaultJavaVMInitArgs';
|
||||
function JNI_CreateJavaVM(vm:PPJavaVM;AEnv:PPJNIEnv;p:pointer):jint;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}external 'jni' name 'JNI_CreateJavaVM';
|
||||
function JNI_GetCreatedJavaVMs(vm:PPJavaVM;ASize:jsize;p:Pjsize):jint;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}external 'jni' name 'JNI_GetCreatedJavaVMs';
|
||||
{$endif}
|
||||
|
||||
(*
|
||||
* Prototypes for functions exported by loadable shared libs. These are
|
||||
* called by JNI, not provided by JNI.
|
||||
*)
|
||||
|
||||
const curVM:PJavaVM=nil;
|
||||
curEnv:PJNIEnv=nil;
|
||||
|
||||
(*
|
||||
function JNI_OnLoad(vm:PJavaVM;reserved:pointer):jint;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
procedure JNI_OnUnload(vm:PJavaVM;reserved:pointer);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
*)
|
||||
implementation
|
||||
|
||||
function JNI_OnLoad(vm:PJavaVM;reserved:pointer):jint;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
begin
|
||||
curVM:=vm;
|
||||
result:=JNI_VERSION_1_6;
|
||||
end;
|
||||
|
||||
procedure JNI_OnUnload(vm:PJavaVM;reserved:pointer);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
|
||||
begin
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
158
bindings/android-ndk/keycodes.pas
Normal file
158
bindings/android-ndk/keycodes.pas
Normal file
@ -0,0 +1,158 @@
|
||||
(*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*)
|
||||
|
||||
unit keycodes;
|
||||
|
||||
interface
|
||||
|
||||
uses ctypes;
|
||||
|
||||
(******************************************************************
|
||||
*
|
||||
* IMPORTANT NOTICE:
|
||||
*
|
||||
* This file is part of Android's set of stable system headers
|
||||
* exposed by the Android NDK (Native Development Kit).
|
||||
*
|
||||
* Third-party source AND binary code relies on the definitions
|
||||
* here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
|
||||
*
|
||||
* - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
|
||||
* - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
|
||||
* - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
|
||||
* - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
|
||||
*)
|
||||
|
||||
(*
|
||||
* Key codes.
|
||||
*)
|
||||
|
||||
const
|
||||
AKEYCODE_UNKNOWN = 0;
|
||||
AKEYCODE_SOFT_LEFT = 1;
|
||||
AKEYCODE_SOFT_RIGHT = 2;
|
||||
AKEYCODE_HOME = 3;
|
||||
AKEYCODE_BACK = 4;
|
||||
AKEYCODE_CALL = 5;
|
||||
AKEYCODE_ENDCALL = 6;
|
||||
AKEYCODE_0 = 7;
|
||||
AKEYCODE_1 = 8;
|
||||
AKEYCODE_2 = 9;
|
||||
AKEYCODE_3 = 10;
|
||||
AKEYCODE_4 = 11;
|
||||
AKEYCODE_5 = 12;
|
||||
AKEYCODE_6 = 13;
|
||||
AKEYCODE_7 = 14;
|
||||
AKEYCODE_8 = 15;
|
||||
AKEYCODE_9 = 16;
|
||||
AKEYCODE_STAR = 17;
|
||||
AKEYCODE_POUND = 18;
|
||||
AKEYCODE_DPAD_UP = 19;
|
||||
AKEYCODE_DPAD_DOWN = 20;
|
||||
AKEYCODE_DPAD_LEFT = 21;
|
||||
AKEYCODE_DPAD_RIGHT = 22;
|
||||
AKEYCODE_DPAD_CENTER = 23;
|
||||
AKEYCODE_VOLUME_UP = 24;
|
||||
AKEYCODE_VOLUME_DOWN = 25;
|
||||
AKEYCODE_POWER = 26;
|
||||
AKEYCODE_CAMERA = 27;
|
||||
AKEYCODE_CLEAR = 28;
|
||||
AKEYCODE_A = 29;
|
||||
AKEYCODE_B = 30;
|
||||
AKEYCODE_C = 31;
|
||||
AKEYCODE_D = 32;
|
||||
AKEYCODE_E = 33;
|
||||
AKEYCODE_F = 34;
|
||||
AKEYCODE_G = 35;
|
||||
AKEYCODE_H = 36;
|
||||
AKEYCODE_I = 37;
|
||||
AKEYCODE_J = 38;
|
||||
AKEYCODE_K = 39;
|
||||
AKEYCODE_L = 40;
|
||||
AKEYCODE_M = 41;
|
||||
AKEYCODE_N = 42;
|
||||
AKEYCODE_O = 43;
|
||||
AKEYCODE_P = 44;
|
||||
AKEYCODE_Q = 45;
|
||||
AKEYCODE_R = 46;
|
||||
AKEYCODE_S = 47;
|
||||
AKEYCODE_T = 48;
|
||||
AKEYCODE_U = 49;
|
||||
AKEYCODE_V = 50;
|
||||
AKEYCODE_W = 51;
|
||||
AKEYCODE_X = 52;
|
||||
AKEYCODE_Y = 53;
|
||||
AKEYCODE_Z = 54;
|
||||
AKEYCODE_COMMA = 55;
|
||||
AKEYCODE_PERIOD = 56;
|
||||
AKEYCODE_ALT_LEFT = 57;
|
||||
AKEYCODE_ALT_RIGHT = 58;
|
||||
AKEYCODE_SHIFT_LEFT = 59;
|
||||
AKEYCODE_SHIFT_RIGHT = 60;
|
||||
AKEYCODE_TAB = 61;
|
||||
AKEYCODE_SPACE = 62;
|
||||
AKEYCODE_SYM = 63;
|
||||
AKEYCODE_EXPLORER = 64;
|
||||
AKEYCODE_ENVELOPE = 65;
|
||||
AKEYCODE_ENTER = 66;
|
||||
AKEYCODE_DEL = 67;
|
||||
AKEYCODE_GRAVE = 68;
|
||||
AKEYCODE_MINUS = 69;
|
||||
AKEYCODE_EQUALS = 70;
|
||||
AKEYCODE_LEFT_BRACKET = 71;
|
||||
AKEYCODE_RIGHT_BRACKET = 72;
|
||||
AKEYCODE_BACKSLASH = 73;
|
||||
AKEYCODE_SEMICOLON = 74;
|
||||
AKEYCODE_APOSTROPHE = 75;
|
||||
AKEYCODE_SLASH = 76;
|
||||
AKEYCODE_AT = 77;
|
||||
AKEYCODE_NUM = 78;
|
||||
AKEYCODE_HEADSETHOOK = 79;
|
||||
AKEYCODE_FOCUS = 80; // *Camera* focus
|
||||
AKEYCODE_PLUS = 81;
|
||||
AKEYCODE_MENU = 82;
|
||||
AKEYCODE_NOTIFICATION = 83;
|
||||
AKEYCODE_SEARCH = 84;
|
||||
AKEYCODE_MEDIA_PLAY_PAUSE = 85;
|
||||
AKEYCODE_MEDIA_STOP = 86;
|
||||
AKEYCODE_MEDIA_NEXT = 87;
|
||||
AKEYCODE_MEDIA_PREVIOUS = 88;
|
||||
AKEYCODE_MEDIA_REWIND = 89;
|
||||
AKEYCODE_MEDIA_FAST_FORWARD = 90;
|
||||
AKEYCODE_MUTE = 91;
|
||||
AKEYCODE_PAGE_UP = 92;
|
||||
AKEYCODE_PAGE_DOWN = 93;
|
||||
AKEYCODE_PICTSYMBOLS = 94;
|
||||
AKEYCODE_SWITCH_CHARSET = 95;
|
||||
AKEYCODE_BUTTON_A = 96;
|
||||
AKEYCODE_BUTTON_B = 97;
|
||||
AKEYCODE_BUTTON_C = 98;
|
||||
AKEYCODE_BUTTON_X = 99;
|
||||
AKEYCODE_BUTTON_Y = 100;
|
||||
AKEYCODE_BUTTON_Z = 101;
|
||||
AKEYCODE_BUTTON_L1 = 102;
|
||||
AKEYCODE_BUTTON_R1 = 103;
|
||||
AKEYCODE_BUTTON_L2 = 104;
|
||||
AKEYCODE_BUTTON_R2 = 105;
|
||||
AKEYCODE_BUTTON_THUMBL = 106;
|
||||
AKEYCODE_BUTTON_THUMBR = 107;
|
||||
AKEYCODE_BUTTON_START = 108;
|
||||
AKEYCODE_BUTTON_SELECT = 109;
|
||||
AKEYCODE_BUTTON_MODE = 110;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
BIN
bindings/android-ndk/libs/libEGL.so
Normal file
BIN
bindings/android-ndk/libs/libEGL.so
Normal file
Binary file not shown.
BIN
bindings/android-ndk/libs/libGLESv1_CM.so
Normal file
BIN
bindings/android-ndk/libs/libGLESv1_CM.so
Normal file
Binary file not shown.
BIN
bindings/android-ndk/libs/libandroid.so
Normal file
BIN
bindings/android-ndk/libs/libandroid.so
Normal file
Binary file not shown.
BIN
bindings/android-ndk/libs/libc.so
Normal file
BIN
bindings/android-ndk/libs/libc.so
Normal file
Binary file not shown.
BIN
bindings/android-ndk/libs/libdl.so
Normal file
BIN
bindings/android-ndk/libs/libdl.so
Normal file
Binary file not shown.
BIN
bindings/android-ndk/libs/liblog.so
Normal file
BIN
bindings/android-ndk/libs/liblog.so
Normal file
Binary file not shown.
BIN
bindings/android-ndk/libs/libm.so
Normal file
BIN
bindings/android-ndk/libs/libm.so
Normal file
Binary file not shown.
35
bindings/android-ndk/log.pas
Normal file
35
bindings/android-ndk/log.pas
Normal file
@ -0,0 +1,35 @@
|
||||
unit log;
|
||||
{$ifdef fpc}
|
||||
{$mode delphi}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
const libname='liblog.so';
|
||||
|
||||
ANDROID_LOG_UNKNOWN=0;
|
||||
ANDROID_LOG_DEFAULT=1;
|
||||
ANDROID_LOG_VERBOSE=2;
|
||||
ANDROID_LOG_DEBUG=3;
|
||||
ANDROID_LOG_INFO=4;
|
||||
ANDROID_LOG_WARN=5;
|
||||
ANDROID_LOG_ERROR=6;
|
||||
ANDROID_LOG_FATAL=7;
|
||||
ANDROID_LOG_SILENT=8;
|
||||
|
||||
type android_LogPriority=integer;
|
||||
|
||||
function __android_log_write(prio:longint;tag,text:pchar):longint; cdecl; external libname name '__android_log_write';
|
||||
function LOGI(prio:longint;tag,text:pchar):longint; cdecl; varargs; external libname name '__android_log_print';
|
||||
|
||||
procedure LOGW(Text: pchar);
|
||||
//function __android_log_print(prio:longint;tag,print:pchar;params:array of pchar):longint; cdecl; external libname name '__android_log_print';
|
||||
|
||||
implementation
|
||||
|
||||
procedure LOGW(Text: pchar);
|
||||
begin
|
||||
__android_log_write(ANDROID_LOG_FATAL,'crap',text);
|
||||
end;
|
||||
|
||||
end.
|
253
bindings/android-ndk/looper.pas
Normal file
253
bindings/android-ndk/looper.pas
Normal file
@ -0,0 +1,253 @@
|
||||
(*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*)
|
||||
|
||||
unit looper;
|
||||
|
||||
interface
|
||||
|
||||
uses ctypes;
|
||||
|
||||
(**
|
||||
* ALooper
|
||||
*
|
||||
* A looper is the state tracking an event loop for a thread.
|
||||
* Loopers do not define event structures or other such things; rather
|
||||
* they are a lower-level facility to attach one or more discrete objects
|
||||
* listening for an event. An "event" here is simply data available on
|
||||
* a file descriptor: each attached object has an associated file descriptor,
|
||||
* and waiting for "events" means (internally) polling on all of these file
|
||||
* descriptors until one or more of them have data available.
|
||||
*
|
||||
* A thread can have only one ALooper associated with it.
|
||||
*)
|
||||
|
||||
type
|
||||
PALooper = ^ALooper;
|
||||
ALooper = record end;
|
||||
|
||||
Pint = ^cint;
|
||||
|
||||
(**
|
||||
* Returns the looper associated with the calling thread, or NULL if
|
||||
* there is not one.
|
||||
*)
|
||||
|
||||
function ALooper_forThread: PALooper; cdecl; external;
|
||||
|
||||
const
|
||||
(**
|
||||
* Option for ALooper_prepare: this looper will accept calls to
|
||||
* ALooper_addFd() that do not have a callback (that is provide NULL
|
||||
* for the callback). In this case the caller of ALooper_pollOnce()
|
||||
* or ALooper_pollAll() MUST check the return from these functions to
|
||||
* discover when data is available on such fds and process it.
|
||||
*)
|
||||
ALOOPER_PREPARE_ALLOW_NON_CALLBACKS = 1 shl 0;
|
||||
|
||||
(**
|
||||
* Prepares a looper associated with the calling thread, and returns it.
|
||||
* If the thread already has a looper, it is returned. Otherwise, a new
|
||||
* one is created, associated with the thread, and returned.
|
||||
*
|
||||
* The opts may be ALOOPER_PREPARE_ALLOW_NON_CALLBACKS or 0.
|
||||
*)
|
||||
|
||||
function ALooper_prepare(opts: cint): PALooper; cdecl; external;
|
||||
|
||||
const
|
||||
(**
|
||||
* Result from ALooper_pollOnce() and ALooper_pollAll():
|
||||
* The poll was awoken using wake() before the timeout expired
|
||||
* and no callbacks were executed and no other file descriptors were ready.
|
||||
*)
|
||||
ALOOPER_POLL_WAKE = - 1;
|
||||
(**
|
||||
* Result from ALooper_pollOnce() and ALooper_pollAll():
|
||||
* One or more callbacks were executed.
|
||||
*)
|
||||
ALOOPER_POLL_CALLBACK = - 2;
|
||||
(**
|
||||
* Result from ALooper_pollOnce() and ALooper_pollAll():
|
||||
* The timeout expired.
|
||||
*)
|
||||
ALOOPER_POLL_TIMEOUT = - 3;
|
||||
(**
|
||||
* Result from ALooper_pollOnce() and ALooper_pollAll():
|
||||
* An error occurred.
|
||||
*)
|
||||
ALOOPER_POLL_ERROR = - 4;
|
||||
|
||||
(**
|
||||
* Acquire a reference on the given ALooper object. This prevents the object
|
||||
* from being deleted until the reference is removed. This is only needed
|
||||
* to safely hand an ALooper from one thread to another.
|
||||
*)
|
||||
|
||||
procedure ALooper_acquire(looper: PALooper); cdecl; external;
|
||||
|
||||
(**
|
||||
* Remove a reference that was previously acquired with ALooper_acquire().
|
||||
*)
|
||||
|
||||
procedure ALooper_release(looper: PALooper); cdecl; external;
|
||||
|
||||
(**
|
||||
* Flags for file descriptor events that a looper can monitor.
|
||||
*
|
||||
* These flag bits can be combined to monitor multiple events at once.
|
||||
*)
|
||||
|
||||
const
|
||||
(**
|
||||
* The file descriptor is available for read operations.
|
||||
*)
|
||||
ALOOPER_EVENT_INPUT = 1 shl 0;
|
||||
(**
|
||||
* The file descriptor is available for write operations.
|
||||
*)
|
||||
ALOOPER_EVENT_OUTPUT = 1 shl 1;
|
||||
(**
|
||||
* The file descriptor has encountered an error condition.
|
||||
*
|
||||
* The looper always sends notifications about errors; it is not necessary
|
||||
* to specify this event flag in the requested event set.
|
||||
*)
|
||||
ALOOPER_EVENT_ERROR = 1 shl 2;
|
||||
(**
|
||||
* The file descriptor was hung up.
|
||||
* For example, indicates that the remote end of a pipe or socket was closed.
|
||||
*
|
||||
* The looper always sends notifications about hangups; it is not necessary
|
||||
* to specify this event flag in the requested event set.
|
||||
*)
|
||||
ALOOPER_EVENT_HANGUP = 1 shl 3;
|
||||
(**
|
||||
* The file descriptor is invalid.
|
||||
* For example, the file descriptor was closed prematurely.
|
||||
*
|
||||
* The looper always sends notifications about invalid file descriptors; it is not necessary
|
||||
* to specify this event flag in the requested event set.
|
||||
*)
|
||||
ALOOPER_EVENT_INVALID = 1 shl 4;
|
||||
|
||||
(**
|
||||
* For callback-based event loops, this is the prototype of the function
|
||||
* that is called. It is given the file descriptor it is associated with,
|
||||
* a bitmask of the poll events that were triggered (typically ALOOPER_EVENT_INPUT),
|
||||
* and the data pointer that was originally supplied.
|
||||
*
|
||||
* Implementations should return 1 to continue receiving callbacks, or 0
|
||||
* to have this file descriptor and callback unregistered from the looper.
|
||||
*)
|
||||
|
||||
type
|
||||
ALooper_callbackFunc = function(fd, events: cint; data: Pointer): cint; cdecl;
|
||||
|
||||
(**
|
||||
* Waits for events to be available, with optional timeout in milliseconds.
|
||||
* Invokes callbacks for all file descriptors on which an event occurred.
|
||||
*
|
||||
* If the timeout is zero, returns immediately without blocking.
|
||||
* If the timeout is negative, waits indefinitely until an event appears.
|
||||
*
|
||||
* Returns ALOOPER_POLL_WAKE if the poll was awoken using wake() before
|
||||
* the timeout expired and no callbacks were invoked and no other file
|
||||
* descriptors were ready.
|
||||
*
|
||||
* Returns ALOOPER_POLL_CALLBACK if one or more callbacks were invoked.
|
||||
*
|
||||
* Returns ALOOPER_POLL_TIMEOUT if there was no data before the given
|
||||
* timeout expired.
|
||||
*
|
||||
* Returns ALOOPER_POLL_ERROR if an error occurred.
|
||||
*
|
||||
* Returns a value >= 0 containing an identifier if its file descriptor has data
|
||||
* and it has no callback function (requiring the caller here to handle it).
|
||||
* In this (and only this) case outFd, outEvents and outData will contain the poll
|
||||
* events and data associated with the fd, otherwise they will be set to NULL.
|
||||
*
|
||||
* This method does not return until it has finished invoking the appropriate callbacks
|
||||
* for all file descriptors that were signalled.
|
||||
*)
|
||||
function ALooper_pollOnce(timeoutMillis: cint; outFd, outEvents: Pint; outData: PPointer): cint; cdecl; external;
|
||||
|
||||
(**
|
||||
* Like ALooper_pollOnce(), but performs all pending callbacks until all
|
||||
* data has been consumed or a file descriptor is available with no callback.
|
||||
* This function will never return ALOOPER_POLL_CALLBACK.
|
||||
*)
|
||||
function ALooper_pollAll(timeoutMillis: cint; outFd, outEvents: Pint; outData: PPointer): cint; cdecl; external;
|
||||
|
||||
(**
|
||||
* Wakes the poll asynchronously.
|
||||
*
|
||||
* This method can be called on any thread.
|
||||
* This method returns immediately.
|
||||
*)
|
||||
procedure ALooper_wake(looper: PALooper); cdecl; external;
|
||||
|
||||
(**
|
||||
* Adds a new file descriptor to be polled by the looper.
|
||||
* If the same file descriptor was previously added, it is replaced.
|
||||
*
|
||||
* "fd" is the file descriptor to be added.
|
||||
* "ident" is an identifier for this event, which is returned from ALooper_pollOnce().
|
||||
* The identifier must be >= 0, or ALOOPER_POLL_CALLBACK if providing a non-NULL callback.
|
||||
* "events" are the poll events to wake up on. Typically this is ALOOPER_EVENT_INPUT.
|
||||
* "callback" is the function to call when there is an event on the file descriptor.
|
||||
* "data" is a private data pointer to supply to the callback.
|
||||
*
|
||||
* There are two main uses of this function:
|
||||
*
|
||||
* (1) If "callback" is non-NULL, then this function will be called when there is
|
||||
* data on the file descriptor. It should execute any events it has pending,
|
||||
* appropriately reading from the file descriptor. The 'ident' is ignored in this case.
|
||||
*
|
||||
* (2) If "callback" is NULL, the 'ident' will be returned by ALooper_pollOnce
|
||||
* when its file descriptor has data available, requiring the caller to take
|
||||
* care of processing it.
|
||||
*
|
||||
* Returns 1 if the file descriptor was added or -1 if an error occurred.
|
||||
*
|
||||
* This method can be called on any thread.
|
||||
* This method may block briefly if it needs to wake the poll.
|
||||
*)
|
||||
function ALooper_addFd(looper: PALooper; fd, ident, events: cint; callback: ALooper_callbackFunc; data: Pointer): cint; cdecl; external;
|
||||
|
||||
(**
|
||||
* Removes a previously added file descriptor from the looper.
|
||||
*
|
||||
* When this method returns, it is safe to close the file descriptor since the looper
|
||||
* will no longer have a reference to it. However, it is possible for the callback to
|
||||
* already be running or for it to run one last time if the file descriptor was already
|
||||
* signalled. Calling code is responsible for ensuring that this case is safely handled.
|
||||
* For example, if the callback takes care of removing itself during its own execution either
|
||||
* by returning 0 or by calling this method, then it can be guaranteed to not be invoked
|
||||
* again at any later time unless registered anew.
|
||||
*
|
||||
* Returns 1 if the file descriptor was removed, 0 if none was previously registered
|
||||
* or -1 if an error occurred.
|
||||
*
|
||||
* This method can be called on any thread.
|
||||
* This method may block briefly if it needs to wake the poll.
|
||||
*)
|
||||
|
||||
function ALooper_removeFd(looper: PALooper; fd: cint): cint; cdecl; external;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
261
bindings/android-ndk/native_activity.pas
Normal file
261
bindings/android-ndk/native_activity.pas
Normal file
@ -0,0 +1,261 @@
|
||||
{
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
}
|
||||
|
||||
unit native_activity;
|
||||
|
||||
interface
|
||||
|
||||
uses asset_manager,input,native_window,rect,jni,ctypes;
|
||||
|
||||
{
|
||||
* This structure defines the native side of an android.app.NativeActivity.
|
||||
* It is created by the framework, and handed to the application's native
|
||||
* code as it is being launched.
|
||||
}
|
||||
type
|
||||
PANativeActivityCallbacks = ^ANativeActivityCallbacks;
|
||||
ANativeActivity = packed record
|
||||
(**
|
||||
* Pointer to the callback function table of the native application.
|
||||
* You can set the functions here to your own callbacks. The callbacks
|
||||
* pointer itself here should not be changed; it is allocated and managed
|
||||
* for you by the framework.
|
||||
*)
|
||||
callbacks : PANativeActivityCallbacks;
|
||||
(**
|
||||
* The global handle on the process's Java VM.
|
||||
*)
|
||||
vm : PJavaVM;
|
||||
(**
|
||||
* JNI context for the main thread of the app. Note that this field
|
||||
* can ONLY be used from the main thread of the process; that is, the
|
||||
* thread that calls into the ANativeActivityCallbacks.
|
||||
*)
|
||||
env : PJNIEnv;
|
||||
(**
|
||||
* The NativeActivity Java class.
|
||||
*)
|
||||
clazz : jobject;
|
||||
(**
|
||||
* Path to this application's internal data directory.
|
||||
*)
|
||||
internalDataPath : Pchar;
|
||||
(**
|
||||
* Path to this application's external (removable/mountable) data directory.
|
||||
*)
|
||||
externalDataPath : Pchar;
|
||||
(**
|
||||
* The platform's SDK version code.
|
||||
*)
|
||||
sdkVersion : longword;
|
||||
(**
|
||||
* This is the native instance of the application. It is not used by
|
||||
* the framework, but can be set by the application to its own instance
|
||||
* state.
|
||||
*)
|
||||
instance : Pointer;
|
||||
(**
|
||||
* Pointer to the Asset Manager instance for the application. The application
|
||||
* uses this to access binary assets bundled inside its own .apk file.
|
||||
*)
|
||||
assetManager : PAAssetManager;
|
||||
end;
|
||||
|
||||
|
||||
{*
|
||||
* These are the callbacks the framework makes into a native application.
|
||||
* All of these callbacks happen on the main thread of the application.
|
||||
* By default, all callbacks are NULL; set to a pointer to your own function
|
||||
* to have it called.
|
||||
}
|
||||
Psize_t = ^csize_t;
|
||||
PANativeActivity = ^ANativeActivity;
|
||||
ANativeActivityCallbacks = packed record
|
||||
(**
|
||||
* NativeActivity has started. See Java documentation for Activity.onStart()
|
||||
* for more information.
|
||||
*)
|
||||
onStart : procedure(activity: PANativeActivity); cdecl;
|
||||
(**
|
||||
* NativeActivity has resumed. See Java documentation for Activity.onResume()
|
||||
* for more information.
|
||||
*)
|
||||
onResume : procedure(activity: PANativeActivity); cdecl;
|
||||
(**
|
||||
* Framework is asking NativeActivity to save its current instance state.
|
||||
* See Java documentation for Activity.onSaveInstanceState() for more
|
||||
* information. The returned pointer needs to be created with malloc();
|
||||
* the framework will call free() on it for you. You also must fill in
|
||||
* outSize with the number of bytes in the allocation. Note that the
|
||||
* saved state will be persisted, so it can not contain any active
|
||||
* entities (pointers to memory, file descriptors, etc).
|
||||
*)
|
||||
onSaveInstanceState : function(activity: PANativeActivity; outSize: Psize_t): Pointer; cdecl;
|
||||
(**
|
||||
* NativeActivity has paused. See Java documentation for Activity.onPause()
|
||||
* for more information.
|
||||
*)
|
||||
onPause : procedure(activity: PANativeActivity); cdecl;
|
||||
(**
|
||||
* NativeActivity has stopped. See Java documentation for Activity.onStop()
|
||||
* for more information.
|
||||
*)
|
||||
onStop : procedure(activity: PANativeActivity); cdecl;
|
||||
(**
|
||||
* NativeActivity is being destroyed. See Java documentation for Activity.onDestroy()
|
||||
* for more information.
|
||||
*)
|
||||
onDestroy : procedure(activity: PANativeActivity); cdecl;
|
||||
(**
|
||||
* Focus has changed in this NativeActivity's window. This is often used,
|
||||
* for example, to pause a game when it loses input focus.
|
||||
*)
|
||||
onWindowFocusChanged : procedure(activity: PANativeActivity; hasFocus: cint); cdecl;
|
||||
(**
|
||||
* The drawing window for this native activity has been created. You
|
||||
* can use the given native window object to start drawing.
|
||||
*)
|
||||
onNativeWindowCreated : procedure(activity: PANativeActivity; window: PANativeWindow); cdecl;
|
||||
(**
|
||||
* The drawing window for this native activity has been resized. You should
|
||||
* retrieve the new size from the window and ensure that your rendering in
|
||||
* it now matches.
|
||||
*)
|
||||
onNativeWindowResized : procedure(activity: PANativeActivity; window: PANativeWindow); cdecl;
|
||||
(**
|
||||
* The drawing window for this native activity needs to be redrawn. To avoid
|
||||
* transient artifacts during screen changes (such resizing after rotation),
|
||||
* applications should not return from this function until they have finished
|
||||
* drawing their window in its current state.
|
||||
*)
|
||||
onNativeWindowRedrawNeeded : procedure(activity: PANativeActivity; window: PANativeWindow); cdecl;
|
||||
(**
|
||||
* The drawing window for this native activity is going to be destroyed.
|
||||
* You MUST ensure that you do not touch the window object after returning
|
||||
* from this function: in the common case of drawing to the window from
|
||||
* another thread, that means the implementation of this callback must
|
||||
* properly synchronize with the other thread to stop its drawing before
|
||||
* returning from here.
|
||||
*)
|
||||
onNativeWindowDestroyed : procedure(activity: PANativeActivity; window: PANativeWindow); cdecl;
|
||||
(**
|
||||
* The input queue for this native activity's window has been created.
|
||||
* You can use the given input queue to start retrieving input events.
|
||||
*)
|
||||
onInputQueueCreated : procedure(activity: PANativeActivity; queue: PAInputQueue); cdecl;
|
||||
(**
|
||||
* The input queue for this native activity's window is being destroyed.
|
||||
* You should no longer try to reference this object upon returning from this
|
||||
* function.
|
||||
*)
|
||||
onInputQueueDestroyed : procedure(activity: PANativeActivity; queue: PAInputQueue); cdecl;
|
||||
(**
|
||||
* The rectangle in the window in which content should be placed has changed.
|
||||
*)
|
||||
onContentRectChanged : procedure(activity: PANativeActivity; rect: PARect); cdecl;
|
||||
(**
|
||||
* The current device AConfiguration has changed. The new configuration can
|
||||
* be retrieved from assetManager.
|
||||
*)
|
||||
onConfigurationChanged : procedure(activity: PANativeActivity); cdecl;
|
||||
(**
|
||||
* The system is running low on memory. Use this callback to release
|
||||
* resources you do not need, to help the system avoid killing more
|
||||
* important processes.
|
||||
*)
|
||||
onLowMemory : procedure(activity: PANativeActivity); cdecl;
|
||||
end;
|
||||
|
||||
|
||||
{*
|
||||
* This is the function that must be in the native code to instantiate the
|
||||
* application's native activity. It is called with the activity instance (see
|
||||
* above); if the code is being instantiated from a previously saved instance,
|
||||
* the savedState will be non-NULL and point to the saved data. You must make
|
||||
* any copy of this data you need -- it will be released after you return from
|
||||
* this function.
|
||||
}
|
||||
ANativeActivity_createFunc = procedure(activity: PANativeActivity; savedState: pointer; savedStateSize: SizeInt); cdecl;
|
||||
|
||||
{*
|
||||
* The name of the function that NativeInstance looks for when launching its
|
||||
* native code. This is the default function that is used, you can specify
|
||||
* "android.app.func_name" string meta-data in your manifest to use a different
|
||||
* function.
|
||||
}
|
||||
var
|
||||
ANativeActivity_onCreate : ANativeActivity_createFunc; external;
|
||||
|
||||
(**
|
||||
* Finish the given activity. Its finish() method will be called, causing it
|
||||
* to be stopped and destroyed. Note that this method can be called from
|
||||
* *any* thread; it will send a message to the main thread of the process
|
||||
* where the Java finish call will take place.
|
||||
*)
|
||||
procedure ANativeActivity_finish(activity: PANativeActivity); cdecl; external;
|
||||
|
||||
(**
|
||||
* Change the window format of the given activity. Calls getWindow().setFormat()
|
||||
* of the given activity. Note that this method can be called from
|
||||
* *any* thread; it will send a message to the main thread of the process
|
||||
* where the Java finish call will take place.
|
||||
*)
|
||||
procedure ANativeActivity_setWindowFormat(activity: PANativeActivity; format: cint32); cdecl; external;
|
||||
|
||||
(**
|
||||
* Change the window flags of the given activity. Calls getWindow().setFlags()
|
||||
* of the given activity. Note that this method can be called from
|
||||
* *any* thread; it will send a message to the main thread of the process
|
||||
* where the Java finish call will take place. See window.h for flag constants.
|
||||
*)
|
||||
procedure ANativeActivity_setWindowFlags(activity: PANativeActivity; addFlags, removeFlags: cuint32); cdecl; external;
|
||||
|
||||
(**
|
||||
* Flags for ANativeActivity_showSoftInput; see the Java InputMethodManager
|
||||
* API for documentation.
|
||||
*)
|
||||
const
|
||||
ANATIVEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT = $0001;
|
||||
ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED = $0002;
|
||||
|
||||
(**
|
||||
* Show the IME while in the given activity. Calls InputMethodManager.showSoftInput()
|
||||
* for the given activity. Note that this method can be called from
|
||||
* *any* thread; it will send a message to the main thread of the process
|
||||
* where the Java finish call will take place.
|
||||
*)
|
||||
procedure ANativeActivity_showSoftInput(activity: PANativeActivity; flags: cuint32); cdecl; external;
|
||||
|
||||
(**
|
||||
* Flags for ANativeActivity_hideSoftInput; see the Java InputMethodManager
|
||||
* API for documentation.
|
||||
*)
|
||||
const
|
||||
ANATIVEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY = $0001;
|
||||
ANATIVEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS = $0002;
|
||||
|
||||
(**
|
||||
* Hide the IME while in the given activity. Calls InputMethodManager.hideSoftInput()
|
||||
* for the given activity. Note that this method can be called from
|
||||
* *any* thread; it will send a message to the main thread of the process
|
||||
* where the Java finish call will take place.
|
||||
*)
|
||||
procedure ANativeActivity_hideSoftInput(activity: PANativeActivity; flags: cuint32); cdecl; external;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
108
bindings/android-ndk/native_window.pas
Normal file
108
bindings/android-ndk/native_window.pas
Normal file
@ -0,0 +1,108 @@
|
||||
(*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*)
|
||||
|
||||
unit native_window;
|
||||
|
||||
interface
|
||||
|
||||
uses ctypes,rect;
|
||||
|
||||
(*
|
||||
* Pixel formats that a window can use.
|
||||
*)
|
||||
const
|
||||
WINDOW_FORMAT_RGBA_8888 = 1;
|
||||
WINDOW_FORMAT_RGBX_8888 = 2;
|
||||
WINDOW_FORMAT_RGB_565 = 4;
|
||||
|
||||
type
|
||||
PANativeWindow = ^ANativeWindow;
|
||||
ANativeWindow = record end;
|
||||
|
||||
PANativeWindow_Buffer = ^ANativeWindow_Buffer;
|
||||
ANativeWindow_Buffer = packed record
|
||||
// The number of pixels that are show horizontally.
|
||||
width : cint32;
|
||||
// The number of pixels that are shown vertically.
|
||||
height : cint32;
|
||||
// The number of *pixels* that a line in the buffer takes in
|
||||
// memory. This may be >= width.
|
||||
stride : cint32;
|
||||
// The format of the buffer. One of WINDOW_FORMAT_*
|
||||
format : cint32;
|
||||
// The actual bits.
|
||||
bits : Pointer;
|
||||
// Do not touch.
|
||||
reserved : array [0..5] of cuint32;
|
||||
end;
|
||||
|
||||
(**
|
||||
* Acquire a reference on the given ANativeWindow object. This prevents the object
|
||||
* from being deleted until the reference is removed.
|
||||
*)
|
||||
procedure ANativeWindow_acquire(window: PANativeWindow); cdecl; external;
|
||||
|
||||
(**
|
||||
* Remove a reference that was previously acquired with ANativeWindow_acquire().
|
||||
*)
|
||||
procedure ANativeWindow_release(window: PANativeWindow); cdecl; external;
|
||||
|
||||
(*
|
||||
* Return the current width in pixels of the window surface. Returns a
|
||||
* negative value on error.
|
||||
*)
|
||||
function ANativeWindow_getWidth(window: PANativeWindow): cint32; cdecl; external;
|
||||
|
||||
(*
|
||||
* Return the current height in pixels of the window surface. Returns a
|
||||
* negative value on error.
|
||||
*)
|
||||
function ANativeWindow_getHeight(window: PANativeWindow): cint32; cdecl; external;
|
||||
|
||||
(*
|
||||
* Return the current pixel format of the window surface. Returns a
|
||||
* negative value on error.
|
||||
*)
|
||||
function ANativeWindow_getFormat(window: PANativeWindow): cint32; cdecl; external;
|
||||
|
||||
(*
|
||||
* Change the format and size of the window buffers.
|
||||
*
|
||||
* The width and height control the number of pixels in the buffers, not the
|
||||
* dimensions of the window on screen. If these are different than the
|
||||
* window's physical size, then it buffer will be scaled to match that size
|
||||
* when compositing it to the screen.
|
||||
*
|
||||
* For all of these parameters, if 0 is supplied then the window's base
|
||||
* value will come back in force.
|
||||
*)
|
||||
function ANativeWindow_setBuffersGeometry(window: PANativeWindow; width, height, format: cint32): cint32; cdecl; external;
|
||||
|
||||
(**
|
||||
* Lock the window's next drawing surface for writing.
|
||||
*)
|
||||
function ANativeWindow_lock(window: PANativeWindow; outBuffer: PANativeWindow_Buffer; inOutDirtyBounds: PARect): cint32; cdecl; external;
|
||||
|
||||
(**
|
||||
* Unlock the window's drawing surface after previously locking it,
|
||||
* posting the new buffer to the display.
|
||||
*)
|
||||
function ANativeWindow_unlockAndPost(window: PANativeWindow): cint32; cdecl; external;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
35
bindings/android-ndk/rect.pas
Normal file
35
bindings/android-ndk/rect.pas
Normal file
@ -0,0 +1,35 @@
|
||||
{*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*}
|
||||
|
||||
unit rect;
|
||||
|
||||
interface
|
||||
|
||||
uses ctypes;
|
||||
|
||||
type
|
||||
PARect = ^ARect;
|
||||
ARect = packed record
|
||||
left : cint32;
|
||||
top : cint32;
|
||||
right : cint32;
|
||||
bottom : cint32;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user