zenilib
0.5.3.0
|
#include <poll.h>
#include <pthread.h>
#include <sched.h>
#include <android/configuration.h>
#include <android/looper.h>
#include <android/native_activity.h>
Go to the source code of this file.
Classes | |
struct | android_app |
struct | android_poll_source |
Functions | |
void | android_app_post_exec_cmd (struct android_app *android_app, int8_t cmd) |
void | android_app_pre_exec_cmd (struct android_app *android_app, int8_t cmd) |
int8_t | android_app_read_cmd (struct android_app *android_app) |
void | android_main (struct android_app *app) |
void | app_dummy () |
anonymous enum |
Enumerator | |
---|---|
LOOPER_ID_MAIN |
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_INPUT |
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_USER |
Start of user-defined ALooper identifiers. |
Definition at line 187 of file android_native_app_glue.h.
anonymous enum |
Enumerator | |
---|---|
APP_CMD_INPUT_CHANGED |
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_INIT_WINDOW |
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_TERM_WINDOW |
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_WINDOW_RESIZED |
Command from main thread: the current ANativeWindow has been resized. Please redraw with its new size. |
APP_CMD_WINDOW_REDRAW_NEEDED |
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_CONTENT_RECT_CHANGED |
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_GAINED_FOCUS |
Command from main thread: the app's activity window has gained input focus. |
APP_CMD_LOST_FOCUS |
Command from main thread: the app's activity window has lost input focus. |
APP_CMD_CONFIG_CHANGED |
Command from main thread: the current device configuration has changed. |
APP_CMD_LOW_MEMORY |
Command from main thread: the system is running low on memory. Try to reduce your memory use. |
APP_CMD_START |
Command from main thread: the app's activity has been started. |
APP_CMD_RESUME |
Command from main thread: the app's activity has been resumed. |
APP_CMD_SAVE_STATE |
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_PAUSE |
Command from main thread: the app's activity has been paused. |
APP_CMD_STOP |
Command from main thread: the app's activity has been stopped. |
APP_CMD_DESTROY |
Command from main thread: the app's activity is being destroyed, and waiting for the app thread to clean up and exit before proceeding. |
Definition at line 212 of file android_native_app_glue.h.
void android_app_post_exec_cmd | ( | struct android_app * | android_app, |
int8_t | cmd | ||
) |
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.
void android_app_pre_exec_cmd | ( | struct android_app * | android_app, |
int8_t | cmd | ||
) |
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.
int8_t android_app_read_cmd | ( | struct android_app * | android_app | ) |
Call when ALooper_pollAll() returns LOOPER_ID_MAIN, reading the next app command message.
void android_main | ( | struct android_app * | state | ) |
This is the function that application code must implement, representing the main entry to the app.
This is the main entry point of a native application that is using android_native_app_glue. It runs in its own thread, with its own event loop for receiving input events and doing other things.
set g_ndk=1
Definition at line 352 of file main.cpp.
References app_dummy(), android_app::destroyRequested, engine_draw_frame(), engine_handle_cmd(), engine_handle_input(), engine_term_display(), g_ndk, Zeni::get_Core(), Zeni::Window::get_height(), Zeni::Window::get_width(), Zeni::get_Window(), android_app::looper, LOOPER_ID_USER, max, memset, min, NULL, android_app::onAppCmd, android_app::onInputEvent, android_poll_source::process, android_app::savedState, Zeni::Core::set_screen_saver(), and android_app::userData.
void app_dummy | ( | ) |
Dummy function you can call to ensure glue code isn't stripped.
Referenced by android_main().