sdljava.event

Class SDLMouseButtonEvent

public class SDLMouseButtonEvent extends SDLEvent

When a mouse button press or release is detected then number of the button pressed (from 1 to 255, with 1 usually being the left button and 2 the right) is placed into button, the position of the mouse when this event occured is stored in the x and the y fields. Like SDL_KeyboardEvent, information on whether the event was a press or a release event is stored in both the type and state fields, but this should be obvious.

Mouse wheel events are reported as buttons 4 (up) and 5 (down). Two events are generated i.e. you get a SDL_MOUSEBUTTONDOWN followed by a SDL_MOUSEBUTTONUP event.

Version: $Id: SDLMouseButtonEvent.java,v 1.12 2005/01/30 05:15:16 ivan_ganza Exp $

Author: Ivan Z. Ganza

Field Summary
SDL_MouseButtonEventswigMouseButtonEvent
Reference to the SWIG generated
Method Summary
intgetButton()
The mouse button index (SDL_BUTTON_LEFT, SDL_BUTTON_MIDDLE, SDL_BUTTON_RIGHT, SDL_BUTTON_WHEELUP, SDL_BUTTON_WHEELDOWN)
SDLPressedStategetState()
Get the state of the button
SDL_MouseButtonEventgetSwigMouseButtonEvent()
Gets the value of swigMouseButtonEvent
intgetType()
The type of the this event
intgetWhich()
Describe getWhich method here.
intgetX()
The X co-oridnate
intgetY()
The Y co-ordinate
voidsetSwigMouseButtonEvent(SDL_MouseButtonEvent argSwigMouseButtonEvent)
Sets the value of swigMouseButtonEvent
StringtoString()
StringtranslateButton(int button)
Get string represenation of button value

Field Detail

swigMouseButtonEvent

SDL_MouseButtonEvent swigMouseButtonEvent
Reference to the SWIG generated

Method Detail

getButton

public int getButton()
The mouse button index (SDL_BUTTON_LEFT, SDL_BUTTON_MIDDLE, SDL_BUTTON_RIGHT, SDL_BUTTON_WHEELUP, SDL_BUTTON_WHEELDOWN)

Returns: a short value

getState

public SDLPressedState getState()
Get the state of the button

Returns: the state of the button

getSwigMouseButtonEvent

public SDL_MouseButtonEvent getSwigMouseButtonEvent()
Gets the value of swigMouseButtonEvent

Returns: the value of swigMouseButtonEvent

getType

public int getType()
The type of the this event

Returns: The type of event

getWhich

public int getWhich()
Describe getWhich method here.

Returns: a short value

getX

public int getX()
The X co-oridnate

Returns: an int value

getY

public int getY()
The Y co-ordinate

Returns: an int value

setSwigMouseButtonEvent

public void setSwigMouseButtonEvent(SDL_MouseButtonEvent argSwigMouseButtonEvent)
Sets the value of swigMouseButtonEvent

Parameters: argSwigMouseButtonEvent Value to assign to this.swigMouseButtonEvent

toString

public String toString()

Returns: a String representation of myself

translateButton

public String translateButton(int button)
Get string represenation of button value

Parameters: button an int value

Returns: the string represenation of button value