indexing description: "[ Joystick ball event ]" date: "$Date$" revision: "$Revision$" class EM_JOYSTICK_BALL_EVENT inherit EM_EVENT redefine out, make, type end create make feature {NONE} -- Initialization make (a_pointer: POINTER) is -- Create a joystick ball event. do Precursor (a_pointer) create sdl_joystick_ball_event_struct.make_shared (a_pointer) end -- /* Joystick trackball motion event structure */ -- typedef struct SDL_JoyBallEvent { -- Uint8 type; /* SDL_JOYBALLMOTION */ -- Uint8 which; /* The joystick device index */ -- Uint8 ball; /* The joystick trackball index */ -- Sint16 xrel; /* The relative motion in the X direction */ -- Sint16 yrel; /* The relative motion in the Y direction */ -- } SDL_JoyBallEvent; feature -- Queries type: INTEGER is -- Event type value -- (`em_key_down_event' or `em_key_up_event') do result := em_joystick_ball_event end is_device: INTEGER is -- From which joystick device did this event come? do result := sdl_joystick_ball_event_struct.which end is_ball: INTEGER is -- From which ball did this event come? do result := sdl_joystick_ball_event_struct.ball end x_relative_motion: INTEGER is -- The relative motion in the X direction do result := sdl_joystick_ball_event_struct.xrel end y_relative_motion: INTEGER is -- The relative motion in the Y direction do result := sdl_joystick_ball_event_struct.yrel end feature -- Output out: STRING is -- Textual representation do result := "EM_JOYSTICK_BALL_EVENT moved by" + x_relative_motion.out + "/" + y_relative_motion.out + " (Ball #" + is_ball.out + ")" end feature {NONE} -- Implementation sdl_joystick_ball_event_struct: SDL_JOY_BALL_EVENT_STRUCT -- Wrapped struct containing informatiuon about the joystick event. invariant sdl_joystick_ball_event_struct_not_void: sdl_joystick_ball_event_struct /= Void end