diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2018-03-02 16:07:23 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2018-03-02 16:07:23 +0000 |
| commit | f01eb0ec25d88451bb36c7ba070d60213b3cb8b3 (patch) | |
| tree | a2a40e8f73169f7a82befc9567dcc5980670fc87 /Android/jni | |
| parent | 5c2d98a5fcfdafe2e214a27a92876759cf0caea8 (diff) | |
Removing obsolete Android stuff
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12693 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'Android/jni')
| -rw-r--r-- | Android/jni/Android.mk | 208 | ||||
| -rw-r--r-- | Android/jni/Application.mk | 4 | ||||
| -rw-r--r-- | Android/jni/main.c | 307 |
3 files changed, 0 insertions, 519 deletions
diff --git a/Android/jni/Android.mk b/Android/jni/Android.mk deleted file mode 100644 index abe6c0daa..000000000 --- a/Android/jni/Android.mk +++ /dev/null @@ -1,208 +0,0 @@ -# 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. -# -TOP_PATH := $(call my-dir)/../.. - - -################# -## FLTK library -include $(CLEAR_VARS) -LOCAL_PATH += $(TOP_PATH)/Android -LOCAL_PATH += $(TOP_PATH) -LOCAL_MODULE := native-activity -LOCAL_C_INCLUDES := $(TOP_PATH) - -LOCAL_SRC_FILES := \ - test/unittests.cxx \ - src/flstring.c \ - src/scandir.c \ - src/numericsort.c \ - src/vsnprintf.c \ - src/xutf8/is_right2left.c \ - src/xutf8/is_spacing.c \ - src/xutf8/case.c \ - src/xutf8/utf8Input.c \ - src/xutf8/utf8Utils.c \ - src/xutf8/utf8Wrap.c \ - src/xutf8/keysym2Ucs.c \ - src/fl_utf.c \ - src/Fl.cxx \ - src/Fl_Adjuster.cxx \ - src/Fl_Bitmap.cxx \ - src/Fl_Browser.cxx \ - src/Fl_Browser_.cxx \ - src/Fl_Browser_load.cxx \ - src/Fl_Box.cxx \ - src/Fl_Button.cxx \ - src/Fl_Chart.cxx \ - src/Fl_Check_Browser.cxx \ - src/Fl_Check_Button.cxx \ - src/Fl_Choice.cxx \ - src/Fl_Clock.cxx \ - src/Fl_Color_Chooser.cxx \ - src/Fl_Copy_Surface.cxx \ - src/Fl_Counter.cxx \ - src/Fl_Device.cxx \ - src/Fl_Dial.cxx \ - src/Fl_Help_Dialog_Dox.cxx \ - src/Fl_Double_Window.cxx \ - src/Fl_File_Browser.cxx \ - src/Fl_File_Chooser.cxx \ - src/Fl_File_Chooser2.cxx \ - src/Fl_File_Icon.cxx \ - src/Fl_File_Input.cxx \ - src/Fl_Graphics_Driver.cxx \ - src/Fl_Group.cxx \ - src/Fl_Help_View.cxx \ - src/Fl_Image.cxx \ - src/Fl_Image_Surface.cxx \ - src/Fl_Input.cxx \ - src/Fl_Input_.cxx \ - src/Fl_Light_Button.cxx \ - src/Fl_Menu.cxx \ - src/Fl_Menu_.cxx \ - src/Fl_Menu_Bar.cxx \ - src/Fl_Menu_Button.cxx \ - src/Fl_Menu_Window.cxx \ - src/Fl_Menu_add.cxx \ - src/Fl_Menu_global.cxx \ - src/Fl_Multi_Label.cxx \ - src/Fl_Native_File_Chooser.cxx \ - src/Fl_Overlay_Window.cxx \ - src/Fl_Pack.cxx \ - src/Fl_Paged_Device.cxx \ - src/Fl_Pixmap.cxx \ - src/Fl_Positioner.cxx \ - src/Fl_Preferences.cxx \ - src/Fl_Printer.cxx \ - src/Fl_Progress.cxx \ - src/Fl_Repeat_Button.cxx \ - src/Fl_Return_Button.cxx \ - src/Fl_Roller.cxx \ - src/Fl_Round_Button.cxx \ - src/Fl_Screen_Driver.cxx \ - src/Fl_Scroll.cxx \ - src/Fl_Scrollbar.cxx \ - src/Fl_Shared_Image.cxx \ - src/Fl_Single_Window.cxx \ - src/Fl_Slider.cxx \ - src/Fl_Table.cxx \ - src/Fl_Table_Row.cxx \ - src/Fl_Tabs.cxx \ - src/Fl_Text_Buffer.cxx \ - src/Fl_Text_Display.cxx \ - src/Fl_Text_Editor.cxx \ - src/Fl_Tile.cxx \ - src/Fl_Tiled_Image.cxx \ - src/Fl_Tooltip.cxx \ - src/Fl_Tree.cxx \ - src/Fl_Tree_Item_Array.cxx \ - src/Fl_Tree_Item.cxx \ - src/Fl_Tree_Prefs.cxx \ - src/Fl_Valuator.cxx \ - src/Fl_Value_Input.cxx \ - src/Fl_Value_Output.cxx \ - src/Fl_Value_Slider.cxx \ - src/Fl_Widget.cxx \ - src/Fl_Widget_Surface.cxx \ - src/Fl_Window.cxx \ - src/Fl_Window_Driver.cxx \ - src/Fl_Window_fullscreen.cxx \ - src/Fl_Window_hotspot.cxx \ - src/Fl_Window_iconize.cxx \ - src/Fl_Wizard.cxx \ - src/Fl_XBM_Image.cxx \ - src/Fl_XPM_Image.cxx \ - src/Fl_abort.cxx \ - src/Fl_add_idle.cxx \ - src/Fl_arg.cxx \ - src/Fl_compose.cxx \ - src/Fl_display.cxx \ - src/Fl_get_key.cxx \ - src/Fl_get_system_colors.cxx \ - src/Fl_grab.cxx \ - src/Fl_lock.cxx \ - src/Fl_own_colormap.cxx \ - src/Fl_visual.cxx \ - src/filename_absolute.cxx \ - src/filename_expand.cxx \ - src/filename_ext.cxx \ - src/filename_isdir.cxx \ - src/filename_list.cxx \ - src/filename_match.cxx \ - src/filename_setext.cxx \ - src/fl_arc.cxx \ - src/fl_ask.cxx \ - src/fl_boxtype.cxx \ - src/fl_color.cxx \ - src/fl_cursor.cxx \ - src/fl_curve.cxx \ - src/fl_diamond_box.cxx \ - src/fl_dnd.cxx \ - src/fl_draw.cxx \ - src/fl_draw_pixmap.cxx \ - src/fl_engraved_label.cxx \ - src/fl_file_dir.cxx \ - src/fl_font.cxx \ - src/fl_gleam.cxx \ - src/fl_gtk.cxx \ - src/fl_labeltype.cxx \ - src/fl_line_style.cxx \ - src/fl_open_uri.cxx \ - src/fl_oval_box.cxx \ - src/fl_overlay.cxx \ - src/fl_overlay_visual.cxx \ - src/fl_plastic.cxx \ - src/fl_read_image.cxx \ - src/fl_rect.cxx \ - src/fl_round_box.cxx \ - src/fl_rounded_box.cxx \ - src/fl_set_font.cxx \ - src/fl_scroll_area.cxx \ - src/fl_shadow_box.cxx \ - src/fl_shortcut.cxx \ - src/fl_show_colormap.cxx \ - src/fl_symbols.cxx \ - src/fl_vertex.cxx \ - src/screen_xywh.cxx \ - src/fl_utf8.cxx \ - src/fl_encoding_latin1.cxx \ - src/fl_encoding_mac_roman.cxx \ - src/drivers/Pico/Fl_Pico_System_Driver.cxx \ - src/drivers/Pico/Fl_Pico_Screen_Driver.cxx \ - src/drivers/Pico/Fl_Pico_Window_Driver.cxx \ - src/drivers/Pico/Fl_Pico_Graphics_Driver.cxx \ - src/drivers/Pico/Fl_Pico_Copy_Surface.cxx \ - src/drivers/Pico/Fl_Pico_Image_Surface.cxx \ - src/drivers/PicoAndroid/Fl_PicoAndroid_System_Driver.cxx \ - src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx \ - src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx \ - src/drivers/PicoAndroid/Fl_PicoAndroid_Graphics_Driver.cxx \ - src/drivers/PicoAndroid/Fl_PicoAndroid_Copy_Surface.cxx \ - src/drivers/PicoAndroid/Fl_PicoAndroid_Image_Surface.cxx - -#Android/jni/main.c - - -LOCAL_CFLAGS := -DFL_PORTING -DANDROID -DFL_PICO_ANDROID -DFL_LIBRARY - -LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM -LOCAL_STATIC_LIBRARIES := android_native_app_glue - -include $(BUILD_SHARED_LIBRARY) - - - - -$(call import-module,android/native_app_glue) diff --git a/Android/jni/Application.mk b/Android/jni/Application.mk deleted file mode 100644 index 97857320f..000000000 --- a/Android/jni/Application.mk +++ /dev/null @@ -1,4 +0,0 @@ -#APP_ABI := armeabi armeabi-v7a mips x64 -#APP_ABI := all -APP_ABI := armeabi-v7a -APP_PLATFORM := android-10 diff --git a/Android/jni/main.c b/Android/jni/main.c deleted file mode 100644 index 2e1963568..000000000 --- a/Android/jni/main.c +++ /dev/null @@ -1,307 +0,0 @@ -/* - * 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. - * - */ - -//BEGIN_INCLUDE(all) -#include <jni.h> -#include <errno.h> - -#include <EGL/egl.h> -#include <GLES/gl.h> - -#include <android/sensor.h> -#include <android/log.h> -#include <android_native_app_glue.h> - -#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "native-activity", __VA_ARGS__)) -#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "native-activity", __VA_ARGS__)) - -/** - * Our saved state data. - */ -struct saved_state { - float angle; - int32_t x; - int32_t y; -}; - -/** - * Shared state for our app. - */ -struct engine { - struct android_app* app; - - ASensorManager* sensorManager; - const ASensor* accelerometerSensor; - ASensorEventQueue* sensorEventQueue; - - int animating; - EGLDisplay display; - EGLSurface surface; - EGLContext context; - int32_t width; - int32_t height; - struct saved_state state; -}; - -/** - * Initialize an EGL context for the current display. - */ -static int engine_init_display(struct engine* engine) { - // 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 - */ - const EGLint attribs[] = { - EGL_SURFACE_TYPE, EGL_WINDOW_BIT, - EGL_BLUE_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_RED_SIZE, 8, - EGL_NONE - }; - EGLint w, h, dummy, format; - EGLint numConfigs; - EGLConfig config; - EGLSurface surface; - EGLContext context; - - EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY); - - eglInitialize(display, 0, 0); - - /* 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, NULL); - context = eglCreateContext(display, config, NULL, NULL); - - if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) { - LOGW("Unable to eglMakeCurrent"); - return -1; - } - - 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); - - return 0; -} - -/** - * Just the current frame in the display. - */ -static void engine_draw_frame(struct engine* engine) { - if (engine->display == NULL) { - // No display. - return; - } - - // Just fill the screen with a color. - glClearColor(((float)engine->state.x)/engine->width, engine->state.angle, - ((float)engine->state.y)/engine->height, 1); - glClear(GL_COLOR_BUFFER_BIT); - - eglSwapBuffers(engine->display, engine->surface); -} - -/** - * Tear down the EGL context currently associated with the display. - */ -static void engine_term_display(struct engine* engine) { - if (engine->display != EGL_NO_DISPLAY) { - eglMakeCurrent(engine->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - if (engine->context != EGL_NO_CONTEXT) { - eglDestroyContext(engine->display, engine->context); - } - if (engine->surface != EGL_NO_SURFACE) { - eglDestroySurface(engine->display, engine->surface); - } - eglTerminate(engine->display); - } - engine->animating = 0; - engine->display = EGL_NO_DISPLAY; - engine->context = EGL_NO_CONTEXT; - engine->surface = EGL_NO_SURFACE; -} - -/** - * Process the next input event. - */ -static int32_t engine_handle_input(struct android_app* app, AInputEvent* event) { - struct engine* engine = (struct engine*)app->userData; - if (AInputEvent_getType(event) == AINPUT_EVENT_TYPE_MOTION) { - engine->animating = 1; - engine->state.x = AMotionEvent_getX(event, 0); - engine->state.y = AMotionEvent_getY(event, 0); - return 1; - } - return 0; -} - -/** - * Process the next main command. - */ -static void engine_handle_cmd(struct android_app* app, int32_t cmd) { - struct engine* engine = (struct engine*)app->userData; - switch (cmd) { - case APP_CMD_SAVE_STATE: - // The system has asked us to save our current state. Do so. - engine->app->savedState = malloc(sizeof(struct saved_state)); - *((struct saved_state*)engine->app->savedState) = engine->state; - engine->app->savedStateSize = sizeof(struct saved_state); - break; - case APP_CMD_INIT_WINDOW: - // The window is being shown, get it ready. - if (engine->app->window != NULL) { - engine_init_display(engine); - engine_draw_frame(engine); - } - break; - case APP_CMD_TERM_WINDOW: - // The window is being hidden or closed, clean it up. - engine_term_display(engine); - break; - case APP_CMD_GAINED_FOCUS: - // When our app gains focus, we start monitoring the accelerometer. - if (engine->accelerometerSensor != NULL) { - 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); - } - break; - case APP_CMD_LOST_FOCUS: - // When our app loses focus, we stop monitoring the accelerometer. - // This is to avoid consuming battery while not being used. - if (engine->accelerometerSensor != NULL) { - ASensorEventQueue_disableSensor(engine->sensorEventQueue, - engine->accelerometerSensor); - } - // Also stop animating. - engine->animating = 0; - engine_draw_frame(engine); - break; - } -} - -/** - * 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. - */ -void android_main(struct android_app* state) { - struct engine engine; - - // Make sure glue isn't stripped. - app_dummy(); - - memset(&engine, 0, sizeof(engine)); - state->userData = &engine; - state->onAppCmd = engine_handle_cmd; - state->onInputEvent = engine_handle_input; - engine.app = state; - - // Prepare to monitor accelerometer - engine.sensorManager = ASensorManager_getInstance(); - engine.accelerometerSensor = ASensorManager_getDefaultSensor(engine.sensorManager, - ASENSOR_TYPE_ACCELEROMETER); - engine.sensorEventQueue = ASensorManager_createEventQueue(engine.sensorManager, - state->looper, LOOPER_ID_USER, NULL, NULL); - - if (state->savedState != NULL) { - // We are starting with a previous saved state; restore from it. - engine.state = *(struct saved_state*)state->savedState; - } - - // loop waiting for stuff to do. - - while (1) { - // Read all pending events. - int ident; - int events; - struct android_poll_source* source; - - // 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. - while ((ident=ALooper_pollAll(engine.animating ? 0 : -1, NULL, &events, - (void**)&source)) >= 0) { - - // Process this event. - if (source != NULL) { - source->process(state, source); - } - - // If a sensor has data, process it now. - if (ident == LOOPER_ID_USER) { - if (engine.accelerometerSensor != NULL) { - ASensorEvent event; - while (ASensorEventQueue_getEvents(engine.sensorEventQueue, - &event, 1) > 0) { - LOGI("accelerometer: x=%f y=%f z=%f", - event.acceleration.x, event.acceleration.y, - event.acceleration.z); - } - } - } - - // Check if we are exiting. - if (state->destroyRequested != 0) { - engine_term_display(&engine); - return; - } - } - - if (engine.animating) { - // Done with events; draw next animation frame. - engine.state.angle += .01f; - if (engine.state.angle > 1) { - engine.state.angle = 0; - } - - // Drawing is throttled to the screen update rate, so there - // is no need to do timing here. - engine_draw_frame(&engine); - } - } -} -//END_INCLUDE(all) |
