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
18 module android_app
is android_manifest_activity
"""
19 android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
20 android:configChanges="orientation|keyboardHidden"
25 import mnit
::opengles1
26 intrude import ::android
::input_events
31 extern EGLDisplay mnit_display;
32 extern EGLSurface mnit_surface;
33 extern EGLContext mnit_context;
34 extern EGLConfig mnit_config;
35 extern int32_t mnit_width;
36 extern int32_t mnit_height;
40 redef type D
: Opengles1Display
44 display
= new Opengles1Display
49 redef fun full_frame
do if not paused
then super
51 redef fun generate_input
do poll_looper
0
53 redef fun native_input_key
(event
)
58 redef fun native_input_motion
(event
)
60 var ie
= new AndroidMotionEvent(event
)
61 var handled
= input
(ie
)
64 for pe
in ie
.pointers
do