2 * Copyright (c) 2003-2009 jMonkeyEngine
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 package com.jme.input.action;
36 * <code>InputActionEvent</code> defines an event that generates the
37 * processing of a given InputAction. This event contains information about the
38 * triggers that caused the event to take places as well as the list of names of
39 * the other Actions that were to be processed at the same time.
42 * @version $Id: InputActionEvent.java,v 1.10 2006/11/25 11:45:19 irrisor Exp $
44 public class InputActionEvent {
46 //the time of the event.
50 * instantiates a default InputActionEvent object. The keys, eventList and
51 * time are set to null or 0.
54 public InputActionEvent() {
58 * returns the time the event occured.
60 * @return Returns the time.
62 public float getTime() {
67 * sets the time the event occured.
72 public void setTime(float time) {
78 * Usually triggerName is set to a button/axis name or command.
80 * @return current value of field triggerName
82 public String getTriggerName() {
83 return this.triggerName;
87 * @see #getTriggerName
89 private String triggerName;
92 * @param value new value
94 public void setTriggerName( final String value ) {
95 this.triggerName = value;
99 * @return some character data associated with the event / button name, '\0' if not applicable.
100 * <br>example: typed keyboard character
102 public char getTriggerCharacter() {
103 return this.triggerCharacter;
107 * @see #getTriggerCharacter
109 private char triggerCharacter;
112 * @see #getTriggerCharacter
114 * @param value new value
116 public void setTriggerCharacter( final char value ) {
117 this.triggerCharacter = value;
122 * name of the device that triggered this event, null if not applicable
124 * @return current value of field axisName
126 public String getTriggerDevice() {
127 return this.triggerDevice;
131 * @see #getTriggerDevice()
133 private String triggerDevice;
136 * @see #getTriggerDevice()
138 * @param value new value
140 public void setTriggerDevice( final String value ) {
141 this.triggerDevice = value;
145 * @return index of the device part that caused the event, -1 if not applicable
146 * <br>example: mouse button index, joystick axis index
148 public int getTriggerIndex() {
149 return this.triggerIndex;
153 * @see #getTriggerIndex
155 private int triggerIndex;
158 * @see #getTriggerIndex
160 * @param value new value
162 public void setTriggerIndex( final int value ) {
163 this.triggerIndex = value;
168 * @return new position of the device part that caused the event, default 0, range [-1;1]
169 * <br>example: joystick axis position
171 public float getTriggerPosition() {
172 return this.triggerPosition;
176 * @see #getTriggerPosition
178 private float triggerPosition;
181 * @see #getTriggerPosition
183 * @param value new value
185 public void setTriggerPosition( final float value ) {
186 this.triggerPosition = value;
191 * @return position delta of the device part that caused the event, default 0, range [-1;1]
192 * <br>example: joystick axis delta
194 public float getTriggerDelta() {
195 return this.triggerDelta;
199 * @see #getTriggerDelta
201 private float triggerDelta;
204 * @see #getTriggerDelta
206 * @param value new value
208 public void setTriggerDelta( final float value ) {
209 this.triggerDelta = value;
214 * @return true if a button was pressed, false if released, default: false
215 * <br>example: true if joystick button is pressed, false if joystick button is released
217 public boolean getTriggerPressed() {
218 return this.triggerPressed;
222 * @see #getTriggerPressed
224 private boolean triggerPressed;
227 * @see #getTriggerPressed
229 * @param value new value
231 public void setTriggerPressed( final boolean value ) {
232 this.triggerPressed = value;
237 * @return true if the trigger that caused the event allows repeats
238 * @see com.jme.input.InputHandler#addAction(InputActionInterface,String,int,int,boolean)
240 public boolean getTriggerAllowsRepeats() {
241 return this.triggerAllowsRepeats;
245 * @see #getTriggerAllowsRepeats()
247 private boolean triggerAllowsRepeats;
250 * @see #getTriggerAllowsRepeats()
252 * @param value new value
254 public void setTriggerAllowsRepeats( final boolean value ) {
255 this.triggerAllowsRepeats = value;
259 * @return some data data associated with the event, null if not applicable.
261 public Object getTriggerData() {
262 return this.triggerData;
266 * @see #getTriggerData
268 private Object triggerData;
271 * @see #getTriggerData
273 * @param value new value
275 public void setTriggerData( final Object value ) {
276 this.triggerData = value;