1 # This file is part of NIT (http://www.nitlanguage.org).
3 # Copyright 2012-2014 Alexis Laferrière <alexis.laf@xymus.net>
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Impements the services of `mnit:app` using the API from the Android ndk
19 android_manifest_activity
"""
20 android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
21 android:configChanges="orientation|keyboardHidden"
22 android:screenOrientation="portrait""""
27 import mnit::opengles1
28 intrude import ::android::input_events
33 extern EGLDisplay mnit_display;
34 extern EGLSurface mnit_surface;
35 extern EGLContext mnit_context;
36 extern EGLConfig mnit_config;
37 extern int32_t mnit_width;
38 extern int32_t mnit_height;
39 extern float mnit_zoom;
41 //int mnit_orientation_changed;
46 redef type D: Opengles1Display
50 display = new Opengles1Display
55 redef fun full_frame do if not paused then super
57 redef fun generate_input do poll_looper 0
59 redef fun native_input_key(event)
64 redef fun native_input_motion(event)
66 var ie = new AndroidMotionEvent(event)
67 var handled = input(ie)
70 for pe in ie.pointers do