From 8372caf2f501a770a76d9993a5927531932ddb32 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Tue, 15 Dec 2015 17:34:47 -0500 Subject: [PATCH] contrib/asteronits: intro Android version with vibration MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- contrib/asteronits/Makefile | 4 ++-- contrib/asteronits/src/android.nit | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 contrib/asteronits/src/android.nit diff --git a/contrib/asteronits/Makefile b/contrib/asteronits/Makefile index c0db1ed..08b689c 100644 --- a/contrib/asteronits/Makefile +++ b/contrib/asteronits/Makefile @@ -26,10 +26,10 @@ check: bin/asteronits android: bin/asteronits.apk bin/asteronits.apk: $(shell ${NITLS} -M src/asteronits.nit android) ${NITC} res/drawable-hdpi/icon.png pre-build - ${NITC} src/touch_ui.nit -m android -o $@ + ${NITC} src/android.nit -m android -o $@ android-release: $(shell ${NITLS} -M src/asteronits.nit android) ${NITC} res/drawable-hdpi/icon.png pre-build - ${NITC} src/touch_ui.nit -m android -o bin/asteronits.apk --release + ${NITC} src/android.nit -m android -o bin/asteronits.apk --release res/drawable-hdpi/icon.png: art/icon.svg make -C ../inkscape_tools/ diff --git a/contrib/asteronits/src/android.nit b/contrib/asteronits/src/android.nit new file mode 100644 index 0000000..4042f6d --- /dev/null +++ b/contrib/asteronits/src/android.nit @@ -0,0 +1,35 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# 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. + +import ::android::platform +import ::android::vibration + +import asteronits +import touch_ui + +redef class Ship + redef fun hit + do + super + app.vibrator.vibrate 20 + end +end + +redef class Asteroid + redef fun destroy + do + super + app.vibrator.vibrate 10 + end +end -- 1.7.9.5