indexing description: "[ Joystick button event ]" date: "$Date$" revision: "$Revision$" class EM_JOYSTICK_BUTTON_EVENT inherit EM_EVENT redefine out, make, type end create make feature {NONE} -- Initialization make (a_pointer: POINTER) is -- Create a joystick button event. do Precursor (a_pointer) create sdl_joystick_button_event_struct.make_shared (a_pointer) end feature -- Queries is_key_up: BOOLEAN is -- Is it a key up event? do result := (type = Em_joystick_button_up_event) end is_key_down: BOOLEAN is -- Is it a key down event? do result := (type = Em_joystick_button_down_event) end type: INTEGER is -- Event type value -- (`em_key_down_event' or `em_key_up_event') do result := sdl_joystick_button_event_struct.type end is_device: INTEGER is -- From which joystick device did this event come? do result := sdl_joystick_button_event_struct.which end is_button: INTEGER is -- From which button did this event come? do result := sdl_joystick_button_event_struct.button end feature -- Output out: STRING is -- Textual representation do result := "EM_JOYSTICK_BUTTON_EVENT" if is_key_down then result := result + " button down" elseif is_key_up then result := result + " button up" end result := result + " (Button #" + is_button.out + ")" end feature {NONE} -- Implementation sdl_joystick_button_event_struct: SDL_JOY_BUTTON_EVENT_STRUCT -- Wrapped struct containing informatiuon about the joystick event. invariant sdl_joystick_button_event_struct_not_void: sdl_joystick_button_event_struct /= Void end