From: Alexis Laferrière Date: Tue, 15 Dec 2015 22:34:47 +0000 (-0500) Subject: contrib/asteronits: intro Android version with vibration X-Git-Tag: v0.8~32^2~1 X-Git-Url: http://nitlanguage.org contrib/asteronits: intro Android version with vibration Signed-off-by: Alexis Laferrière --- 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