From f15e1679393f96c668831dcb0809287fee5f92c5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Sat, 3 Jan 2015 13:04:46 -0500 Subject: [PATCH] contrib/friendz: manage zoom at the application level MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- contrib/friendz/src/friendz_android.nit | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/contrib/friendz/src/friendz_android.nit b/contrib/friendz/src/friendz_android.nit index 46eee7e..13a139e 100644 --- a/contrib/friendz/src/friendz_android.nit +++ b/contrib/friendz/src/friendz_android.nit @@ -15,14 +15,23 @@ import mnit_android import android::landscape redef class App + # Zoom applied for the device display from the game logic coordinates + var zoom = 1.0 + redef fun window_created do super - var w = screen_width - display.set_viewport(0,0,w,w*display.height/display.width) + + var h = screen_height + display.set_viewport(0,0,h*display.width/display.height,h) + + zoom = display.height.to_f / h.to_f end end redef class AndroidPointerEvent redef fun is_motion do return not just_went_down + + redef fun x do return super / app.zoom + redef fun y do return super / app.zoom end -- 1.7.9.5