diff -r f5050f1da672 -r 04becd199f91 javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/JoystickEventListener.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/JoystickEventListener.java Tue Apr 27 16:30:29 2010 +0300 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A listener interface to handle Joystick events +* +*/ + + +package com.nokia.mid.ui; + +/** + *

+ * A listener interface to learn when the state of a Joystick changes. + *

+ * This API is an optional feature in Nokia UI API, and depending on the device + * capabilities there may be implementations that do not support joystick + * events. The System.getProperty("com.nokia.mid.ui.joystick_event") will + * return "true" if this feature is available in the device. + *

+ * A device may support analogue joystick which detects 360 directions and + * force instead of standard 5 way key navigation. + * (Up, Down, Left, Right and Centre). + *

+ * The joystick sends events every time its position or force changes. + * This events are represented by x (horizontal) and y (vertical) vector + * components. In its original position (centre), the value for (x, y) + * are (0,0). As an example, suppose that the (-5,5) event was received. + * It means that the joystick is held in the left and up diagonal. + * Now, if the (-25,25) event is sent, it means that the Joystick is still + * in the same direction of (-5,5), however more force were applied. + *

+ * The maximum and minimum values of x and y are -127 and 127. + *

+ * If the MIDlet needs to receive joystick events, it must provide + * an implementation of this interface from a Canvas class or subclass thereof. + * The Canvas will still receive standard key / game key events too. + * The Joystick events are sent only if the Canvas is in visible state. + */ +public interface JoystickEventListener +{ + + /** + * Called when the Joystick sends an event. + *

+ * The events are relative to its original position (0,0) + * + * @param x the horizontal component. The value is negative if the + * joystick is moved to the left direction and positive if moved + * to right direction. + * @param y the vertical component. The value is negative if the joystick + * is moved to the down direction and positive if moved + * to up direction. + */ + void joystickEvent(int x, int y); +}