zenilib
0.5.3.0
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
android_native_app_glue.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2010 The Android Open Source Project
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*
16
*/
17
18
#ifndef _ANDROID_NATIVE_APP_GLUE_H
19
#define _ANDROID_NATIVE_APP_GLUE_H
20
21
#include <poll.h>
22
#include <pthread.h>
23
#include <sched.h>
24
25
#include <android/configuration.h>
26
#include <android/looper.h>
27
#include <android/native_activity.h>
28
29
#ifdef __cplusplus
30
extern
"C"
{
31
#endif
32
84
struct
android_app
;
85
90
struct
android_poll_source
{
91
// The identifier of this source. May be LOOPER_ID_MAIN or
92
// LOOPER_ID_INPUT.
93
int32_t
id
;
94
95
// The android_app this ident is associated with.
96
struct
android_app
*
app
;
97
98
// Function to call to perform the standard processing of data from
99
// this source.
100
void
(*
process
)(
struct
android_app
*
app
,
struct
android_poll_source
*
source
);
101
};
102
111
struct
android_app
{
112
// The application can place a pointer to its own state object
113
// here if it likes.
114
void
*
userData
;
115
116
// Fill this in with the function to process main app commands (APP_CMD_*)
117
void
(*
onAppCmd
)(
struct
android_app
* app,
int32_t
cmd);
118
119
// Fill this in with the function to process input events. At this point
120
// the event has already been pre-dispatched, and it will be finished upon
121
// return. Return 1 if you have handled the event, 0 for any default
122
// dispatching.
123
int32_t
(*
onInputEvent
)(
struct
android_app
* app, AInputEvent*
event
);
124
125
// The ANativeActivity object instance that this app is running in.
126
ANativeActivity*
activity
;
127
128
// The current configuration the app is running in.
129
AConfiguration*
config
;
130
131
// This is the last instance's saved state, as provided at creation time.
132
// It is NULL if there was no state. You can use this as you need; the
133
// memory will remain around until you call android_app_exec_cmd() for
134
// APP_CMD_RESUME, at which point it will be freed and savedState set to NULL.
135
// These variables should only be changed when processing a APP_CMD_SAVE_STATE,
136
// at which point they will be initialized to NULL and you can malloc your
137
// state and place the information here. In that case the memory will be
138
// freed for you later.
139
void
*
savedState
;
140
size_t
savedStateSize
;
141
142
// The ALooper associated with the app's thread.
143
ALooper*
looper
;
144
145
// When non-NULL, this is the input queue from which the app will
146
// receive user input events.
147
AInputQueue*
inputQueue
;
148
149
// When non-NULL, this is the window surface that the app can draw in.
150
ANativeWindow*
window
;
151
152
// Current content rectangle of the window; this is the area where the
153
// window's content should be placed to be seen by the user.
154
ARect
contentRect
;
155
156
// Current state of the app's activity. May be either APP_CMD_START,
157
// APP_CMD_RESUME, APP_CMD_PAUSE, or APP_CMD_STOP; see below.
158
int
activityState
;
159
160
// This is non-zero when the application's NativeActivity is being
161
// destroyed and waiting for the app thread to complete.
162
int
destroyRequested
;
163
164
// -------------------------------------------------
165
// Below are "private" implementation of the glue code.
166
167
pthread_mutex_t
mutex
;
168
pthread_cond_t
cond
;
169
170
int
msgread
;
171
int
msgwrite
;
172
173
pthread_t
thread
;
174
175
struct
android_poll_source
cmdPollSource
;
176
struct
android_poll_source
inputPollSource
;
177
178
int
running
;
179
int
stateSaved
;
180
int
destroyed
;
181
int
redrawNeeded
;
182
AInputQueue*
pendingInputQueue
;
183
ANativeWindow*
pendingWindow
;
184
ARect
pendingContentRect
;
185
};
186
187
enum
{
195
LOOPER_ID_MAIN
= 1,
196
204
LOOPER_ID_INPUT
= 2,
205
209
LOOPER_ID_USER
= 3,
210
};
211
212
enum
{
218
APP_CMD_INPUT_CHANGED
,
219
225
APP_CMD_INIT_WINDOW
,
226
233
APP_CMD_TERM_WINDOW
,
234
239
APP_CMD_WINDOW_RESIZED
,
240
246
APP_CMD_WINDOW_REDRAW_NEEDED
,
247
253
APP_CMD_CONTENT_RECT_CHANGED
,
254
259
APP_CMD_GAINED_FOCUS
,
260
265
APP_CMD_LOST_FOCUS
,
266
270
APP_CMD_CONFIG_CHANGED
,
271
276
APP_CMD_LOW_MEMORY
,
277
281
APP_CMD_START
,
282
286
APP_CMD_RESUME
,
287
295
APP_CMD_SAVE_STATE
,
296
300
APP_CMD_PAUSE
,
301
305
APP_CMD_STOP
,
306
311
APP_CMD_DESTROY
,
312
};
313
318
int8_t
android_app_read_cmd
(
struct
android_app
*
android_app
);
319
325
void
android_app_pre_exec_cmd
(
struct
android_app
*
android_app
,
int8_t
cmd);
326
332
void
android_app_post_exec_cmd
(
struct
android_app
*
android_app
,
int8_t
cmd);
333
337
void
app_dummy
();
338
343
extern
void
android_main
(
struct
android_app
*
app
);
344
345
#ifdef __cplusplus
346
}
347
#endif
348
349
#endif
/* _ANDROID_NATIVE_APP_GLUE_H */
APP_CMD_INPUT_CHANGED
Definition:
android_native_app_glue.h:218
LOOPER_ID_INPUT
Definition:
android_native_app_glue.h:204
android_app::contentRect
ARect contentRect
Definition:
android_native_app_glue.h:154
android_poll_source::app
struct android_app * app
Definition:
android_native_app_glue.h:96
void
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
Definition:
glew.h:1824
android_app::inputQueue
AInputQueue * inputQueue
Definition:
android_native_app_glue.h:147
android_app_pre_exec_cmd
void android_app_pre_exec_cmd(struct android_app *android_app, int8_t cmd)
LOOPER_ID_USER
Definition:
android_native_app_glue.h:209
APP_CMD_CONTENT_RECT_CHANGED
Definition:
android_native_app_glue.h:253
android_app::pendingWindow
ANativeWindow * pendingWindow
Definition:
android_native_app_glue.h:183
APP_CMD_LOST_FOCUS
Definition:
android_native_app_glue.h:265
android_app::savedStateSize
size_t savedStateSize
Definition:
android_native_app_glue.h:140
android_app::window
ANativeWindow * window
Definition:
android_native_app_glue.h:150
int32_t
long int32_t
Definition:
types.h:9
android_app::destroyRequested
int destroyRequested
Definition:
android_native_app_glue.h:162
android_app_read_cmd
int8_t android_app_read_cmd(struct android_app *android_app)
APP_CMD_DESTROY
Definition:
android_native_app_glue.h:311
APP_CMD_RESUME
Definition:
android_native_app_glue.h:286
android_app::onAppCmd
void(* onAppCmd)(struct android_app *app, int32_t cmd)
Definition:
android_native_app_glue.h:117
android_app::cond
pthread_cond_t cond
Definition:
android_native_app_glue.h:168
android_app::msgread
int msgread
Definition:
android_native_app_glue.h:170
android_app::savedState
void * savedState
Definition:
android_native_app_glue.h:139
android_app::userData
void * userData
Definition:
android_native_app_glue.h:114
APP_CMD_START
Definition:
android_native_app_glue.h:281
android_app
Definition:
android_native_app_glue.h:111
app_dummy
void app_dummy()
android_main
void android_main(struct android_app *state)
Definition:
main.cpp:352
android_app::activityState
int activityState
Definition:
android_native_app_glue.h:158
android_app::running
int running
Definition:
android_native_app_glue.h:178
android_app::inputPollSource
struct android_poll_source inputPollSource
Definition:
android_native_app_glue.h:176
APP_CMD_STOP
Definition:
android_native_app_glue.h:305
android_app::stateSaved
int stateSaved
Definition:
android_native_app_glue.h:179
android_app::destroyed
int destroyed
Definition:
android_native_app_glue.h:180
android_app::pendingInputQueue
AInputQueue * pendingInputQueue
Definition:
android_native_app_glue.h:182
android_poll_source::process
void(* process)(struct android_app *app, struct android_poll_source *source)
Definition:
android_native_app_glue.h:100
android_app::redrawNeeded
int redrawNeeded
Definition:
android_native_app_glue.h:181
APP_CMD_GAINED_FOCUS
Definition:
android_native_app_glue.h:259
LOOPER_ID_MAIN
Definition:
android_native_app_glue.h:195
int8_t
signed char int8_t
Definition:
SDL_config_windows.h:57
APP_CMD_SAVE_STATE
Definition:
android_native_app_glue.h:295
APP_CMD_CONFIG_CHANGED
Definition:
android_native_app_glue.h:270
android_app::mutex
pthread_mutex_t mutex
Definition:
android_native_app_glue.h:167
android_poll_source
Definition:
android_native_app_glue.h:90
APP_CMD_TERM_WINDOW
Definition:
android_native_app_glue.h:233
android_app::cmdPollSource
struct android_poll_source cmdPollSource
Definition:
android_native_app_glue.h:175
android_app::config
AConfiguration * config
Definition:
android_native_app_glue.h:129
android_app::thread
pthread_t thread
Definition:
android_native_app_glue.h:173
android_app::onInputEvent
int32_t(* onInputEvent)(struct android_app *app, AInputEvent *event)
Definition:
android_native_app_glue.h:123
APP_CMD_WINDOW_RESIZED
Definition:
android_native_app_glue.h:239
android_poll_source::id
int32_t id
Definition:
android_native_app_glue.h:93
android_app::activity
ANativeActivity * activity
Definition:
android_native_app_glue.h:126
android_app::msgwrite
int msgwrite
Definition:
android_native_app_glue.h:171
APP_CMD_INIT_WINDOW
Definition:
android_native_app_glue.h:225
APP_CMD_LOW_MEMORY
Definition:
android_native_app_glue.h:276
source
GLsizei GLsizei GLchar * source
Definition:
gl2ext.h:994
android_app_post_exec_cmd
void android_app_post_exec_cmd(struct android_app *android_app, int8_t cmd)
android_app::pendingContentRect
ARect pendingContentRect
Definition:
android_native_app_glue.h:184
android_app::looper
ALooper * looper
Definition:
android_native_app_glue.h:143
APP_CMD_WINDOW_REDRAW_NEEDED
Definition:
android_native_app_glue.h:246
event
cl_event event
Definition:
glew.h:3556
APP_CMD_PAUSE
Definition:
android_native_app_glue.h:300
zenilib
jni
external
zenilib
zeni_core
android_native_app_glue.h
Generated on Thu Oct 3 2013 19:56:44 for zenilib by
1.8.5