zenilib: zenilib/jni/app/main.cpp File Reference

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
Functions | Variables
main.cpp File Reference
`#include <zenilib.h>`
`#include <jni.h>`
`#include <errno.h>`
`#include <GLES/gl.h>`
`#include <android/sensor.h>`
`#include <android_native_app_glue.h>`
`#include <android/window.h>`
`#include <cmath>`
`#include <utility>`

Go to the source code of this file.

## Functions

void | android_main (struct android_app *state)
static void | engine_draw_frame (struct engine *)
static void | engine_handle_cmd (struct android_app *app, int32_t cmd)
static int32_t | engine_handle_input (struct android_app *app, AInputEvent *event)
static int | engine_init_display (struct engine *engine)
static void | engine_term_display (struct engine *engine)

## Variables

class Bootstrap | g_bootstrap
bool | g_ndk = false

## Function Documentation

void android_main | ( | struct android_app * | state | ) |

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.

static void engine_draw_frame | ( | struct engine * |  | ) |

static

Just the current frame in the display.

Excerpt from Game::run(...)

Definition at line 195 of file main.cpp.

References Zeni::Video::begin_prerender(), Zeni::Video::begin_render(), Zeni::Video::end_render(), Zeni::get_Game(), Zeni::get_Video(), Zeni::Window::is_enabled(), Zeni::Game::prerender(), and Zeni::Game::render().

Referenced by android_main(), and engine_handle_cmd().

static void engine_handle_cmd | ( | struct android_app * | app,
|  | int32_t | cmd
| ) |  |

static

Process the next main command.

Definition at line 289 of file main.cpp.

References APP_CMD_GAINED_FOCUS, APP_CMD_INIT_WINDOW, APP_CMD_LOST_FOCUS, APP_CMD_SAVE_STATE, APP_CMD_TERM_WINDOW, engine_draw_frame(), engine_init_display(), engine_term_display(), malloc, NULL, Zeni::Window::set_enabled(), switch(), android_app::userData, and ZENI_LOGI().

Referenced by android_main().

static int32_t engine_handle_input | ( | struct android_app * | app,
|  | AInputEvent * | event
| ) |  |

static

Process the next input event.

Definition at line 247 of file main.cpp.

References Zeni::get_Core(), Zeni::get_Sound_Source_Pool(), Zeni::play_sound(), Zeni::Core::set_screen_saver(), Zeni::Sound_Source_Pool::update(), and ZENI_LOGI().

Referenced by android_main().

static int engine_init_display | ( | struct engine * | engine | ) |

static

Initialize an EGL context for the current display.

Definition at line 180 of file main.cpp.

References Zeni::get_Window(), GL_CULL_FACE, GL_DEPTH_TEST, GL_FASTEST, GL_PERSPECTIVE_CORRECTION_HINT, GL_SMOOTH, glDisable, glEnable, glHint, and glShadeModel.

Referenced by engine_handle_cmd().

static void engine_term_display | ( | struct engine * | engine | ) |

static

Tear down the EGL context currently associated with the display.

Definition at line 221 of file main.cpp.

References Zeni::Singleton< Game >::completely_destroy(), Zeni::Singleton< Net >::completely_destroy(), Zeni::Singleton< Timer_HQ >::completely_destroy(), Zeni::Singleton< Textures >::completely_destroy(), Zeni::Singleton< File_Ops >::completely_destroy(), Zeni::Singleton< Colors >::completely_destroy(), Zeni::Singleton< Timer >::completely_destroy(), Zeni::Singleton< Core >::completely_destroy(), Zeni::Singleton< Sounds >::completely_destroy(), Zeni::Singleton< Sound >::completely_destroy(), Zeni::Singleton< Resource >::completely_destroy(), Zeni::Singleton< Window >::completely_destroy(), Zeni::Singleton< Video >::completely_destroy(), Zeni::Singleton< Fonts >::completely_destroy(), Zeni::Singleton< Sound_Source_Pool >::destroy(), and Zeni::Window::set_enabled().

Referenced by android_main(), and engine_handle_cmd().

## Variable Documentation

class Bootstrap g_bootstrap

bool g_ndk = false

Definition at line 344 of file main.cpp.

Referenced by android_main().