note description: "[ Controler for the event. It is important to call poll_event or wait_event regularly if you want events to be launch. ]" author: "Louis Marchand" date: "Sat, 28 Mar 2015 03:44:41 +0000" revision: "2.0" class GAME_EVENTS_CONTROLLER create {GAME_LIBRARY_CONTROLLER} default_create feature {NONE} -- Initialization default_create -- Initialization of Current do make initialize_actions create clear_actions create joy_device_founded_actions create joy_device_removed_actions end initialize_actions -- Create any *_actions attributes do create iteration_actions create quit_signal_actions create dollar_gesture_actions create window_event_actions create key_pressed_actions create key_released_actions create text_editing_actions create text_input_actions create mouse_motion_actions create mouse_button_pressed_actions create mouse_button_released_actions create mouse_wheel_move_actions create joy_axis_motion_actions create joy_ball_motion_actions create joy_hat_motion_actions create joy_button_released_actions create joy_button_pressed_actions create finger_motion_actions create finger_released_actions create finger_touched_actions create fingers_gesture_actions create dollar_record_actions create file_dropped_actions end feature -- Initialization make -- Initialize current with given structure_size. -- (from MEMORY_STRUCTURE) local null: POINTER do internal_item := null create managed_pointer.make (structure_size) shared := False ensure -- from MEMORY_STRUCTURE not_shared: not shared end make_by_pointer (a_ptr: POINTER) -- Initialize current with a_ptr. -- (from MEMORY_STRUCTURE) require -- from MEMORY_STRUCTURE a_ptr_not_null: a_ptr /= default_pointer do internal_item := a_ptr managed_pointer := Void shared := True ensure -- from MEMORY_STRUCTURE shared: shared end feature -- Access C_memory: INTEGER_32 = 2 -- Code for the C memory managed -- by the garbage collector -- (from MEM_CONST) clear -- Remove every event in the system do clear_actions.call initialize_actions end disable_dollar_gesture_event -- Ignore the dollar_gesture_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_dollargesture, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_dollar_gesture_event_enable end disable_dollar_record_event -- Ignore the dollar_record_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_dollarrecord, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_dollar_record_event_enable end disable_every_joy_events -- Ignore every joystick events. -- Enabled by default local l_error: INTEGER_32 do clear_error l_error := {GAME_SDL_EXTERNAL}.sdl_joystickeventstate ({GAME_SDL_EXTERNAL}.sdl_disable) manage_error_code (l_error, "Error while disabling joystick events.") ensure is_events_disabled: not (is_joy_axis_motion_event_enable or is_joy_ball_motion_event_enable or is_joy_hat_motion_event_enable or is_joy_button_pressed_event_enable or is_joy_button_released_event_enable or is_joy_device_founded_event_enable or is_joy_device_removed_event_enable) end disable_file_dropped_event -- Ignore the file_dropped_actions event. -- Disable by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_dropfile, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_file_dropped_event_enable end disable_finger_motion_event -- Ignore the finger_motion_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_fingermotion, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_finger_motion_event_enable end disable_finger_released_event -- Ignore the finger_released_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_fingerup, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_finger_released_event_enable end disable_finger_touched_event -- Ignore the finger_touched_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_fingerdown, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_finger_touched_event_enable end disable_fingers_gesture_event -- Ignore the fingers_gesture_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_multigesture, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_fingers_gesture_event_enable end disable_joy_axis_motion_event -- Ignore the joy_axis_motion_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joyaxismotion, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_joy_axis_motion_event_enable end disable_joy_ball_motion_event -- Ignore the joy_ball_motion_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joyballmotion, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_joy_ball_motion_event_enable end disable_joy_button_pressed_event -- Ignore the joy_button_pressed_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joybuttondown, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_joy_button_pressed_event_enable end disable_joy_button_released_event -- Ignore the joy_button_released_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joybuttonup, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_joy_button_released_event_enable end disable_joy_device_founded_event -- Ignore the joy_device_founded_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joydeviceadded, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_joy_device_founded_event_enable end disable_joy_device_removed_event -- Ignore the joy_device_removed_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joydeviceremoved, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_joy_device_removed_event_enable end disable_joy_hat_motion_event -- Ignore the joy_hat_motion_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joyhatmotion, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_joy_hat_motion_event_enable end disable_key_pressed_event -- Ignore the key_pressed_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_keydown, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_key_pressed_event_enable end disable_key_released_event -- Ignore the key_released_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_keyup, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_key_released_event_enable end disable_mouse_button_pressed_event -- Ignore the mouse_button_pressed_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_mousebuttondown, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_mouse_button_pressed_event_enable end disable_mouse_button_released_event -- Ignore the mouse_button_released_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_mousebuttonup, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_mouse_button_released_event_enable end disable_mouse_motion_event -- Ignore the mouse_motion_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_mousemotion, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_mouse_motion_event_enable end disable_mouse_wheel_event -- Ignore the mouse_wheel_move_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_mousewheel, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_mouse_wheel_event_enable end disable_quit_signal_event -- Ignore the quit_signal_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_quit, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_quit_signal_event_enable end disable_window_event -- Ignore the window_event_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_windowevent, {GAME_SDL_EXTERNAL}.sdl_disable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_disable end ensure is_event_disabled: not is_window_event_enable end dollar_gesture_actions: ACTION_SEQUENCE [NATURAL_32, INTEGER_64, INTEGER_64, NATURAL_32, REAL_32, REAL_32, REAL_32] -- When a $1 gesture has been recognize on the touch device touch_id. -- The gesture is uniquely identified by gesture_id. I use fingers_count fingers -- and is centered at (x,y) where x and y are normalized (between 0 and 1). -- The error indicate the difference between the current gesture and the template. dollar_record_actions: ACTION_SEQUENCE [NATURAL_32, INTEGER_64, INTEGER_64] -- When a $1 gesture has been recorded on the touch device touch_id. -- The gesture is uniquely identified by gesture_id. Eiffel_memory: INTEGER_32 = 1 -- Code for the Eiffel memory managed -- by the garbage collector -- (from MEM_CONST) enable_dollar_gesture_event -- Process the dollar_gesture_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_dollargesture, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_dollar_gesture_event_enable end enable_dollar_record_event -- Process the dollar_record_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_dollarrecord, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_dollar_record_event_enable end enable_every_joy_events -- Enable every joystick events. -- Enabled by default local l_error: INTEGER_32 do clear_error l_error := {GAME_SDL_EXTERNAL}.sdl_joystickeventstate ({GAME_SDL_EXTERNAL}.sdl_enable) manage_error_code (l_error, "Error while enabling joystick events.") ensure is_events_enabled: is_joy_axis_motion_event_enable and is_joy_ball_motion_event_enable and is_joy_hat_motion_event_enable and is_joy_button_pressed_event_enable and is_joy_button_released_event_enable and is_joy_device_founded_event_enable and is_joy_device_removed_event_enable end enable_file_dropped_event -- Process the file_dropped_actions event. -- Disable by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_dropfile, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_file_dropped_event_enable end enable_finger_motion_event -- Process the finger_motion_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_fingermotion, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_finger_motion_event_enable end enable_finger_released_event -- Process the finger_released_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_fingerup, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_finger_released_event_enable end enable_finger_touched_event -- Process the finger_touched_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_fingerdown, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_finger_touched_event_enable end enable_fingers_gesture_event -- Process the fingers_gesture_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_multigesture, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_fingers_gesture_event_enable end enable_joy_axis_motion_event -- Process the joy_axis_motion_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joyaxismotion, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_joy_axis_motion_event_enable end enable_joy_ball_motion_event -- Process the joy_ball_motion_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joyballmotion, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_joy_ball_motion_event_enable end enable_joy_button_pressed_event -- Process the joy_button_pressed_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joybuttondown, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_joy_button_pressed_event_enable end enable_joy_button_released_event -- Process the joy_button_released_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joybuttonup, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_joy_button_released_event_enable end enable_joy_device_founded_event -- Process the joy_device_founded_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joydeviceadded, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_joy_device_founded_event_enable end enable_joy_device_removed_event -- Process the joy_device_removed_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joydeviceremoved, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_joy_device_removed_event_enable end enable_joy_hat_motion_event -- Process the joy_hat_motion_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joyhatmotion, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_joy_hat_motion_event_enable end enable_key_pressed_event -- Process the key_pressed_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_keydown, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_key_pressed_event_enable end enable_key_released_event -- Process the key_released_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_keyup, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_key_released_event_enable end enable_mouse_button_pressed_event -- Process the mouse_button_pressed_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_mousebuttondown, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_mouse_button_pressed_event_enable end enable_mouse_button_released_event -- Process the mouse_button_released_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_mousebuttonup, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_mouse_button_released_event_enable end enable_mouse_motion_event -- Process the mouse_motion_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_mousemotion, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_mouse_motion_event_enable end enable_mouse_wheel_event -- Process the mouse_wheel_move_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_mousewheel, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_mouse_wheel_event_enable end enable_quit_signal_event -- Process the quit_signal_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_quit, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_quit_signal_event_enable end enable_window_event -- Process the window_event_actions event. -- Enabled by default local l_error: NATURAL_8 do l_error := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_windowevent, {GAME_SDL_EXTERNAL}.sdl_enable) check l_error.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end ensure is_event_enabled: is_window_event_enable end file_dropped_actions: ACTION_SEQUENCE [NATURAL_32, READABLE_STRING_GENERAL] -- The file pointed by filename has been dropped on a window of the game. -- This event is disabled by default. use GAME_EVENTS_CONTROLLER.enable_file_dropped_event -- to activate it. finger_motion_actions: ACTION_SEQUENCE [NATURAL_32, INTEGER_64, INTEGER_64, REAL_32, REAL_32, REAL_32, REAL_32, REAL_32] -- When a finger identified by finger_id in the touch device identified by -- touch_id has been moved to (x,y) with a certain pressure. The -- x_relative and y_relative indicate the move relative to the last -- call of the finger_motion_actions event. -- Note that x, y, x_relative, y_relative and pressure are normalize -- between 0 and 1. finger_released_actions: ACTION_SEQUENCE [NATURAL_32, INTEGER_64, INTEGER_64, REAL_32, REAL_32, REAL_32, REAL_32, REAL_32] -- When a finger identified by finger_id in the touch device identified by -- touch_id has been released at (x,y) with a certain pressure. The -- x_relative and y_relative indicate the move relative to the last -- call of the finger_motion_actions event. -- Note that x, y, x_relative, y_relative and pressure are normalize -- between 0 and 1. finger_touched_actions: ACTION_SEQUENCE [NATURAL_32, INTEGER_64, INTEGER_64, REAL_32, REAL_32, REAL_32, REAL_32, REAL_32] -- When a finger identified by finger_id in the touch device identified by -- touch_id has been pressed at (x,y) with a certain pressure. The -- x_relative and y_relative indicate the move relative to the last -- call of the finger_motion_actions event. -- Note that x, y, x_relative, y_relative and pressure are normalize -- between 0 and 1. fingers_gesture_actions: ACTION_SEQUENCE [NATURAL_32, INTEGER_64, NATURAL_16, REAL_32, REAL_32, REAL_32, REAL_32] -- When a gesture has been made on the touch device identified by touch_id. -- The gesture has a certain fingers_count, is centered at (center_x, center_y). -- The fingers used a rotation of theta degree and have a distance of pinch. Full_collector: INTEGER_32 = 0 -- Statistics for full collections -- (from MEM_CONST) game_library: detachable GAME_LIBRARY_CONTROLLER -- The library controller used by Current generating_type: TYPE [detachable GAME_EVENTS_CONTROLLER] -- Type of current object -- (type of which it is a direct instance) -- (from ANY) external "built_in" ensure -- from ANY generating_type_not_void: Result /= Void end generator: STRING_8 -- Name of current object's generating class -- (base class of the type of which it is a direct instance) -- (from ANY) external "built_in" ensure -- from ANY generator_not_void: Result /= Void generator_not_empty: not Result.is_empty end has_error: BOOLEAN -- Is the library has generate an error -- (from GAME_ERROR_MANAGER) Incremental_collector: INTEGER_32 = 1 -- Statistics for incremental collections -- (from MEM_CONST) is_any_joy_event_enable: BOOLEAN assign set_is_any_joy_event_enable -- Is there any joystick event that is enable -- Enabled by default local l_query: INTEGER_32 do clear_error l_query := {GAME_SDL_EXTERNAL}.sdl_joystickeventstate ({GAME_SDL_EXTERNAL}.sdl_query) manage_error_code (l_query, "Error while querying joystick events activation.") Result := l_query = 1 end is_dollar_gesture_event_enable: BOOLEAN assign set_is_dollar_gesture_event_enable -- Is the dollar_gesture_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_dollargesture, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_dollar_record_event_enable: BOOLEAN assign set_is_dollar_record_event_enable -- Is the dollar_record_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_dollarrecord, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_file_dropped_event_enable: BOOLEAN assign set_is_file_dropped_event_enable -- Is the file_dropped_actions event has to be process. -- Disable by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_dropfile, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_finger_motion_event_enable: BOOLEAN assign set_is_finger_motion_event_enable -- Is the finger_motion_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_fingermotion, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_finger_released_event_enable: BOOLEAN assign set_is_finger_released_event_enable -- Is the finger_released_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_fingerup, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_finger_touched_event_enable: BOOLEAN assign set_is_finger_touched_event_enable -- Is the finger_touched_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_fingerdown, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_fingers_gesture_event_enable: BOOLEAN assign set_is_fingers_gesture_event_enable -- Is the fingers_gesture_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_multigesture, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_joy_axis_motion_event_enable: BOOLEAN assign set_is_joy_axis_motion_event_enable -- Is the joy_axis_motion_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joyaxismotion, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_joy_ball_motion_event_enable: BOOLEAN assign set_is_joy_ball_motion_event_enable -- Is the joy_ball_motion_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joyballmotion, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_joy_button_pressed_event_enable: BOOLEAN assign set_is_joy_button_pressed_event_enable -- Is the joy_button_pressed_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joybuttondown, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_joy_button_released_event_enable: BOOLEAN assign set_is_joy_button_released_event_enable -- Is the joy_button_released_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joybuttonup, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_joy_device_founded_event_enable: BOOLEAN assign set_is_joy_device_founded_event_enable -- Is the joy_device_founded_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joydeviceadded, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_joy_device_removed_event_enable: BOOLEAN assign set_is_joy_device_removed_event_enable -- Is the joy_device_removed_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joydeviceremoved, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_joy_hat_motion_event_enable: BOOLEAN assign set_is_joy_hat_motion_event_enable -- Is the joy_hat_motion_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_joyhatmotion, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_key_pressed_event_enable: BOOLEAN assign set_is_key_pressed_event_enable -- Is the key_pressed_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_keydown, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_key_released_event_enable: BOOLEAN assign set_is_key_released_event_enable -- Is the key_released_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_keyup, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_mouse_button_pressed_event_enable: BOOLEAN assign set_is_mouse_button_pressed_event_enable -- Is the mouse_button_pressed_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_mousebuttondown, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_mouse_button_released_event_enable: BOOLEAN assign set_is_mouse_button_released_event_enable -- Is the mouse_button_released_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_mousebuttonup, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_mouse_motion_event_enable: BOOLEAN assign set_is_mouse_motion_event_enable -- Is the mouse_motion_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_mousemotion, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_mouse_wheel_event_enable: BOOLEAN assign set_is_mouse_wheel_event_enable -- Is the mouse_wheel_move_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_mousewheel, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_quit_signal_event_enable: BOOLEAN assign set_is_quit_signal_event_enable -- Is the quit_signal_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_quit, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_text_editing_event_enable: BOOLEAN -- Is the text_editing_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_textediting, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_text_input_event_enable: BOOLEAN -- Is the text_input_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_textinput, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end is_window_event_enable: BOOLEAN assign set_is_window_event_enable -- Is the window_event_actions event has to be process. -- Enabled by default local l_query: NATURAL_8 do l_query := {GAME_SDL_EXTERNAL}.sdl_eventstate ({GAME_SDL_EXTERNAL}.sdl_windowevent, {GAME_SDL_EXTERNAL}.sdl_query) Result := l_query.to_integer_32 = {GAME_SDL_EXTERNAL}.sdl_enable end item: POINTER -- Access to memory area. -- (from MEMORY_STRUCTURE) local m: like managed_pointer do if shared then Result := internal_item else m := managed_pointer if m /= Void then Result := m.item end end end iteration_actions: ACTION_SEQUENCE [NATURAL_32] -- Called at each game loop joy_axis_motion_actions: ACTION_SEQUENCE [NATURAL_32, INTEGER_32, NATURAL_8, INTEGER_16] -- When the axis identified by axis_id of the joystick identified by joystick_id has -- been moved to a certain value. joy_ball_motion_actions: ACTION_SEQUENCE [NATURAL_32, INTEGER_32, NATURAL_8, INTEGER_16, INTEGER_16] -- When the ball identified by ball_id of the joystick identified by joystick_id has -- been moved. The x_relative and y_relative indicate the move relative to the last -- call of the joy_ball_motion_actions event. joy_button_pressed_actions: ACTION_SEQUENCE [NATURAL_32, INTEGER_32, NATURAL_8] -- When the button identified by button_id of the joystick identified by joystick_id has -- been pressed. joy_button_released_actions: ACTION_SEQUENCE [NATURAL_32, INTEGER_32, NATURAL_8] -- When the button identified by button_id of the joystick identified by joystick_id has -- been released. joy_device_founded_actions: ACTION_SEQUENCE [NATURAL_32, INTEGER_32] -- When a new joystick device identified by joystick_id has been founded. joy_device_removed_actions: ACTION_SEQUENCE [NATURAL_32, INTEGER_32] -- When a new joystick device identified by joystick_id has been removed. joy_hat_motion_actions: ACTION_SEQUENCE [NATURAL_32, INTEGER_32, NATURAL_8, NATURAL_8] -- When the hat identified by hat_id of the joystick identified by joystick_id has -- been moved to a certain value. The value can be one of the following: -- SDL_HAT_LEFTUP -- SDL_HAT_UP -- SDL_HAT_RIGHTUP -- SDL_HAT_LEFT -- SDL_HAT_CENTERED -- SDL_HAT_RIGHT -- SDL_HAT_LEFTDOWN -- SDL_HAT_DOWN -- SDL_HAT_RIGHTDOWN key_pressed_actions: ACTION_SEQUENCE [NATURAL_32, NATURAL_32, NATURAL_8, INTEGER_32, INTEGER_32, NATURAL_16] -- When a user presses a button on a keyboard. The current focused window -- is identified by window_id. repeat is non zero if the event is a key repeat. -- The key pressed has the physical code scancode, the virtual code keycode and -- has the current modifier (CTRL, SHIFT, ALT, etc.) in effect. key_released_actions: ACTION_SEQUENCE [NATURAL_32, NATURAL_32, NATURAL_8, INTEGER_32, INTEGER_32, NATURAL_16] -- When a user releases a button on a keyboard. The current focused window -- is identified by window_id. repeat is non zero if the event is a key repeat. -- The key released has the physical code scancode, the virtual code keycode and -- has the current modifier (CTRL, SHIFT, ALT, etc.) in effect. last_error: READABLE_STRING_GENERAL -- The last error generate by the library -- (from GAME_SDL_ANY) local l_string: C_STRING do if is_manual_error then Result := Precursor {GAME_ERROR_MANAGER} else create l_string.make_by_pointer ({GAME_SDL_EXTERNAL}.sdl_geterror) Result := l_string.string end end mouse_button_pressed_actions: ACTION_SEQUENCE [NATURAL_32, NATURAL_32, NATURAL_32, NATURAL_8, NATURAL_8, INTEGER_32, INTEGER_32] -- When a button of the mouse identified by mouse_id at coordinate (x,y) in the window -- identified by window_id has been pressed. The clicks show how much successive clicks -- has been made (1 for simple click, 2 for double click, etc.). The button say what -- mouse button has been pressed. The value can be: -- SDL_BUTTON_LEFT: Left button -- SDL_BUTTON_MIDDLE: Middle button -- SDL_BUTTON_RIGHT: Right button -- SDL_BUTTON_X1: First optionnal button -- SDL_BUTTON_X2: Second optionnal button -- Note: mouse_id may be SDL_TOUCH_MOUSEID mouse_button_released_actions: ACTION_SEQUENCE [NATURAL_32, NATURAL_32, NATURAL_32, NATURAL_8, NATURAL_8, INTEGER_32, INTEGER_32] -- When a button of the mouse identified by mouse_id at coordinate (x,y) in the window -- identified by window_id has been released. The clicks show how much successive clicks -- has been made (1 for simple click, 2 for double click, etc.). The button say what -- mouse button has been released. The value can be: -- SDL_BUTTON_LEFT: Left button -- SDL_BUTTON_MIDDLE: Middle button -- SDL_BUTTON_RIGHT: Right button -- SDL_BUTTON_X1: First optionnal button -- SDL_BUTTON_X2: Second optionnal button -- Note: mouse_id may be SDL_TOUCH_MOUSEID mouse_motion_actions: ACTION_SEQUENCE [NATURAL_32, NATURAL_32, NATURAL_32, NATURAL_32, INTEGER_32, INTEGER_32, INTEGER_32, INTEGER_32] -- When the mouse identified by mouse_id has been moved to the coordinate (x,y) -- in the window identified by window_id. The mouse has been move of x_relative -- position on the x axis and y_relative position on the y axis since the last call -- of the mouse_motion_actions event. The state of the mouse indicate which buttons is -- currently pressed. It is check with the following mask: -- SDL_BUTTON_LMASK: Left button -- SDL_BUTTON_MMASK: Middle button -- SDL_BUTTON_RMASK: Right button -- SDL_BUTTON_X1MASK: First optionnal button -- SDL_BUTTON_X2MASK: Second optionnal button -- Note: mouse_id may be SDL_TOUCH_MOUSEID mouse_wheel_move_actions: ACTION_SEQUENCE [NATURAL_32, NATURAL_32, NATURAL_32, INTEGER_32, INTEGER_32] -- When the wheel of the mouse identified by mouse_id in the window identified by -- window_id has been moved. A positive x indicate a move to the right and a negative -- x indicate a move to the left. A positive y indicate a move up and a -- negative x indicate a move down. poll_event -- Execute an event validation. If no event is pending, do nothing. require attached game_library as la_game_library and then la_game_library.is_events_enable local l_is_event: INTEGER_32 do if not iteration_actions.is_empty then if attached game_library as la_game_library then iteration_actions.call ([la_game_library.time_since_create]) else iteration_actions.call ([(0).as_natural_32]) end end from l_is_event := {GAME_SDL_EXTERNAL}.sdl_pollevent (item) until l_is_event = 0 loop decode_event l_is_event := {GAME_SDL_EXTERNAL}.sdl_pollevent (item) end end quit_signal_actions: ACTION_SEQUENCE [NATURAL_32] -- When the application receive a quit signal. set_is_any_joy_event_enable (a_value: BOOLEAN) -- Assign to is_any_joy_event_enable the value of a_value do if a_value then enable_every_joy_events else disable_every_joy_events end ensure is_assign: is_any_joy_event_enable ~ a_value end set_is_dollar_gesture_event_enable (a_value: BOOLEAN) -- Assign to is_dollar_gesture_event_enable the value of a_value do if a_value then enable_dollar_gesture_event else disable_dollar_gesture_event end ensure is_assign: is_dollar_gesture_event_enable ~ a_value end set_is_dollar_record_event_enable (a_value: BOOLEAN) -- Assign to is_dollar_record_event_enable the value of a_value do if a_value then enable_dollar_record_event else disable_dollar_record_event end ensure is_assign: is_dollar_record_event_enable ~ a_value end set_is_file_dropped_event_enable (a_value: BOOLEAN) -- Assign to is_file_dropped_event_enable the value of a_value do if a_value then enable_file_dropped_event else disable_file_dropped_event end ensure is_assign: is_file_dropped_event_enable ~ a_value end set_is_finger_motion_event_enable (a_value: BOOLEAN) -- Assign to is_finger_motion_event_enable the value of a_value do if a_value then enable_finger_motion_event else disable_finger_motion_event end ensure is_assign: is_finger_motion_event_enable ~ a_value end set_is_finger_released_event_enable (a_value: BOOLEAN) -- Assign to is_finger_released_event_enable the value of a_value do if a_value then enable_finger_released_event else disable_finger_released_event end ensure is_assign: is_finger_released_event_enable ~ a_value end set_is_finger_touched_event_enable (a_value: BOOLEAN) -- Assign to is_finger_touched_event_enable the value of a_value do if a_value then enable_finger_touched_event else disable_finger_touched_event end ensure is_assign: is_finger_touched_event_enable ~ a_value end set_is_fingers_gesture_event_enable (a_value: BOOLEAN) -- Assign to is_fingers_gesture_event_enable the value of a_value do if a_value then enable_fingers_gesture_event else disable_fingers_gesture_event end ensure is_assign: is_fingers_gesture_event_enable ~ a_value end set_is_joy_axis_motion_event_enable (a_value: BOOLEAN) -- Assign to is_joy_axis_motion_event_enable the value of a_value do if a_value then enable_joy_axis_motion_event else disable_joy_axis_motion_event end ensure is_assign: is_joy_axis_motion_event_enable ~ a_value end set_is_joy_ball_motion_event_enable (a_value: BOOLEAN) -- Assign to is_joy_ball_motion_event_enable the value of a_value do if a_value then enable_joy_ball_motion_event else disable_joy_ball_motion_event end ensure is_assign: is_joy_ball_motion_event_enable ~ a_value end set_is_joy_button_pressed_event_enable (a_value: BOOLEAN) -- Assign to is_joy_button_pressed_event_enable the value of a_value do if a_value then enable_joy_button_pressed_event else disable_joy_button_pressed_event end ensure is_assign: is_joy_button_pressed_event_enable ~ a_value end set_is_joy_button_released_event_enable (a_value: BOOLEAN) -- Assign to is_joy_button_released_event_enable the value of a_value do if a_value then enable_joy_button_released_event else disable_joy_button_released_event end ensure is_assign: is_joy_button_released_event_enable ~ a_value end set_is_joy_device_founded_event_enable (a_value: BOOLEAN) -- Assign to is_joy_device_founded_event_enable the value of a_value do if a_value then enable_joy_device_founded_event else disable_joy_device_founded_event end ensure is_assign: is_joy_device_founded_event_enable ~ a_value end set_is_joy_device_removed_event_enable (a_value: BOOLEAN) -- Assign to is_joy_device_removed_event_enable the value of a_value do if a_value then enable_joy_device_removed_event else disable_joy_device_removed_event end ensure is_assign: is_joy_device_removed_event_enable ~ a_value end set_is_joy_hat_motion_event_enable (a_value: BOOLEAN) -- Assign to is_joy_hat_motion_event_enable the value of a_value do if a_value then enable_joy_hat_motion_event else disable_joy_hat_motion_event end ensure is_assign: is_joy_hat_motion_event_enable ~ a_value end set_is_key_pressed_event_enable (a_value: BOOLEAN) -- Assign to is_key_pressed_event_enable the value of a_value do if a_value then enable_key_pressed_event else disable_key_pressed_event end ensure is_assign: is_key_pressed_event_enable ~ a_value end set_is_key_released_event_enable (a_value: BOOLEAN) -- Assign to is_key_released_event_enable the value of a_value do if a_value then enable_key_released_event else disable_key_released_event end ensure is_assign: is_key_released_event_enable ~ a_value end set_is_mouse_button_pressed_event_enable (a_value: BOOLEAN) -- Assign to is_mouse_button_pressed_event_enable the value of a_value do if a_value then enable_mouse_button_pressed_event else disable_mouse_button_pressed_event end ensure is_assign: is_mouse_button_pressed_event_enable ~ a_value end set_is_mouse_button_released_event_enable (a_value: BOOLEAN) -- Assign to is_mouse_button_released_event_enable the value of a_value do if a_value then enable_mouse_button_released_event else disable_mouse_button_released_event end ensure is_assign: is_mouse_button_released_event_enable ~ a_value end set_is_mouse_motion_event_enable (a_value: BOOLEAN) -- Assign to is_text_input_event_enable the value of a_value do if a_value then enable_mouse_motion_event else disable_mouse_motion_event end ensure is_assign: is_mouse_motion_event_enable ~ a_value end set_is_mouse_wheel_event_enable (a_value: BOOLEAN) -- Assign to is_mouse_wheel_event_enable the value of a_value do if a_value then enable_mouse_wheel_event else disable_mouse_wheel_event end ensure is_assign: is_mouse_wheel_event_enable ~ a_value end set_is_quit_signal_event_enable (a_value: BOOLEAN) -- Assign to is_quit_signal_event_enable the value of a_value do if a_value then enable_quit_signal_event else disable_quit_signal_event end ensure is_assign: is_quit_signal_event_enable ~ a_value end set_is_window_event_enable (a_value: BOOLEAN) -- Assign to is_window_event_enable the value of a_value do if a_value then enable_window_event else disable_window_event end ensure is_assign: is_window_event_enable ~ a_value end shared: BOOLEAN -- Is current memory area shared with others? -- (from MEMORY_STRUCTURE) text_editing_actions: ACTION_SEQUENCE [NATURAL_32, NATURAL_32, STRING_32, INTEGER_32, INTEGER_32] -- When a text has been edited in the window identified by window_id. -- The text must be edited from the start character for lenght characters. text_input_actions: ACTION_SEQUENCE [NATURAL_32, NATURAL_32, STRING_32] -- When a text has been input in the window identified by window_id. Total_memory: INTEGER_32 = 0 -- Code for all the memory managed -- by the garbage collector -- (from MEM_CONST) window_event_actions: ACTION_SEQUENCE [NATURAL_32, NATURAL_32, NATURAL_8, INTEGER_32, INTEGER_32] -- When the window identified by window_id is changing state. event_type may take the following value: -- SDL_WINDOWEVENT_SHOWN: The window has been shown -- SDL_WINDOWEVENT_HIDDEN: The window has been hidden -- SDL_WINDOWEVENT_EXPOSED: The window has been exposed and should be redraw -- SDL_WINDOWEVENT_MOVED: window has been moved to coordinate (data1,data2) -- SDL_WINDOWEVENT_RESIZED: window has been resized to dimension data1xdata2 -- this event is always preceded by SDL_WINDOWEVENT_SIZE_CHANGED -- SDL_WINDOWEVENT_SIZE_CHANGED: window size has changed -- SDL_WINDOWEVENT_MINIMIZED: window has been minimized -- SDL_WINDOWEVENT_MAXIMIZED: window has been maximized -- SDL_WINDOWEVENT_RESTORED: window has been restored to normal size and position -- SDL_WINDOWEVENT_ENTER: window has gained mouse focus -- SDL_WINDOWEVENT_LEAVE: window has lost mouse focus -- SDL_WINDOWEVENT_FOCUS_GAINED: window has gained keyboard focus -- SDL_WINDOWEVENT_FOCUS_LOST: window has lost keyboard focus -- SDL_WINDOWEVENT_CLOSE: the window manager requests that the window be closed feature -- Measurement gc_statistics (collector_type: INTEGER_32): GC_INFO -- Garbage collection information for collector_type. -- (from MEMORY) require -- from MEMORY type_ok: collector_type = Full_collector or collector_type = Incremental_collector do create Result.make (collector_type) ensure -- from MEMORY instance_free: class end memory_statistics (memory_type: INTEGER_32): MEM_INFO -- Memory usage information for memory_type -- (from MEMORY) require -- from MEMORY type_ok: memory_type = Total_memory or memory_type = Eiffel_memory or memory_type = C_memory do create Result.make (memory_type) ensure -- from MEMORY instance_free: class end feature -- Comparison frozen deep_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void -- or attached to isomorphic object structures? -- (from ANY) do if a = Void then Result := b = Void else Result := b /= Void and then a.is_deep_equal (b) end ensure -- from ANY instance_free: class shallow_implies_deep: standard_equal (a, b) implies Result both_or_none_void: (a = Void) implies (Result = (b = Void)) same_type: (Result and (a /= Void)) implies (b /= Void and then a.same_type (b)) symmetric: Result implies deep_equal (b, a) end frozen equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached -- to objects considered equal? -- (from ANY) do if a = Void then Result := b = Void else Result := b /= Void and then a.is_equal (b) end ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.is_equal (b)) end frozen is_deep_equal alias "≡≡≡" (other: GAME_EVENTS_CONTROLLER): BOOLEAN -- Are Current and other attached to isomorphic object structures? -- (from ANY) require -- from ANY other_not_void: other /= Void external "built_in" ensure -- from ANY shallow_implies_deep: standard_is_equal (other) implies Result same_type: Result implies same_type (other) symmetric: Result implies other.is_deep_equal (Current) end is_equal (other: GAME_EVENTS_CONTROLLER): BOOLEAN -- Is other attached to an object considered -- equal to current object? -- (from ANY) require -- from ANY other_not_void: other /= Void external "built_in" ensure -- from ANY symmetric: Result implies other ~ Current consistent: standard_is_equal (other) implies Result end frozen standard_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached to -- field-by-field identical objects of the same type? -- Always uses default object comparison criterion. -- (from ANY) do if a = Void then Result := b = Void else Result := b /= Void and then a.standard_is_equal (b) end ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.standard_is_equal (b)) end frozen standard_is_equal alias "≜" (other: GAME_EVENTS_CONTROLLER): BOOLEAN -- Is other attached to an object of the same type -- as current object, and field-by-field identical to it? -- (from ANY) require -- from ANY other_not_void: other /= Void external "built_in" ensure -- from ANY same_type: Result implies same_type (other) symmetric: Result implies other.standard_is_equal (Current) end feature -- Status report chunk_size: INTEGER_32 -- Minimal size of a memory chunk. The run-time always -- allocates a multiple of this size. -- If the environment variable EIF_MEMORY_CHUNK -- is defined, it is set to the closest reasonable -- value from it. -- (from MEMORY) external "C use %"eif_memory.h%"" alias "eif_get_chunk_size" ensure -- from MEMORY instance_free: class end coalesce_period: INTEGER_32 -- Period of full coalesce (in number of collections) -- If the environment variable EIF_FULL_COALESCE_PERIOD -- is defined, it is set to the closest reasonable -- value from it. -- If null, no full coalescing is launched. -- (from MEMORY) external "C use %"eif_memory.h%"" alias "eif_coalesce_period" ensure -- from MEMORY instance_free: class end collecting: BOOLEAN -- Is garbage collection enabled? -- (from MEMORY) external "C use %"eif_memory.h%"" alias "eif_gc_ison" ensure -- from MEMORY instance_free: class end collection_period: INTEGER_32 -- Period of full collection. -- If the environment variable EIF_FULL_COLLECTION_PERIOD -- is defined, it is set to the closest reasonable -- value from it. -- If null, no full collection is launched. -- (from MEMORY) external "C use %"eif_memory.h%"" alias "eif_mem_pget" ensure -- from MEMORY instance_free: class end conforms_to (other: ANY): BOOLEAN -- Does type of current object conform to type -- of other (as per Eiffel: The Language, chapter 13)? -- (from ANY) require -- from ANY other_not_void: other /= Void external "built_in" end exists: BOOLEAN -- Is allocated memory still allocated? -- (from MEMORY_STRUCTURE) do Result := item /= default_pointer end generation_object_limit: INTEGER_32 -- Maximum size of object in generational scavenge zone. -- If the environment variable EIF_GS_LIMIT -- is defined, it is set to the closest reasonable -- value from it. -- (from MEMORY) external "C use %"eif_memory.h%"" alias "eif_generation_object_limit" ensure -- from MEMORY instance_free: class end largest_coalesced_block: INTEGER_32 -- Size of largest coalesced block since last call to -- largest_coalesced; 0 if none. -- (from MEMORY) external "C use %"eif_memory.h%"" alias "eif_mem_largest" ensure -- from MEMORY instance_free: class end max_mem: INTEGER_32 -- Maximum amount of bytes the run-time can allocate. -- (from MEMORY) external "C use %"eif_memory.h%"" alias "eif_get_max_mem" ensure -- from MEMORY instance_free: class end memory_count_map: HASH_TABLE [INTEGER_32, INTEGER_32] -- Number of instances per dynamic type present in system. -- Same as memory_map except that no references on the objects themselves -- is kept. -- (from MEMORY) local i, nb, dtype: INTEGER_32 l_spec: SPECIAL [ANY] l_item: ANY do l_spec := find_all_instances (Special_any_dynamic_type) create Result.make (100) from i := 0 nb := l_spec.count until i >= nb loop l_item := l_spec.item (i) if l_item /= Void then dtype := l_item.generating_type.type_id; Result.search (dtype) if Result.found then Result.force (Result.found_item + 1, dtype) else Result.put (1, dtype) end end i := i + 1 end ensure -- from MEMORY instance_free: class end memory_map: HASH_TABLE [ARRAYED_LIST [ANY], INTEGER_32] -- Retrieves all object in system as a table indexed by dynamic type -- where elements are all instances of a given data type. -- (from MEMORY) local i, nb, dtype: INTEGER_32 l_spec: SPECIAL [ANY] l_item: ANY l_list: detachable ARRAYED_LIST [ANY] l_memory_count_map: HASH_TABLE [INTEGER_32, INTEGER_32] do l_spec := find_all_instances (Special_any_dynamic_type) create l_memory_count_map.make (100) from i := 0 nb := l_spec.count until i >= nb loop l_item := l_spec.item (i) if l_item /= Void then dtype := l_item.generating_type.type_id; l_memory_count_map.force (l_memory_count_map.item (dtype) + 1, dtype) end i := i + 1 end create Result.make (100) from i := 0 nb := l_spec.count until i >= nb loop l_item := l_spec.item (i) if l_item /= Void then dtype := l_item.generating_type.type_id; Result.search (dtype) if Result.found and then attached Result.found_item as l_found_item then l_list := l_found_item else create l_list.make (l_memory_count_map.item (dtype)); Result.put (l_list, dtype) end; l_list.extend (l_item) end i := i + 1 end ensure -- from MEMORY instance_free: class end memory_threshold: INTEGER_32 -- Minimum amount of bytes to be allocated before -- starting an automatic garbage collection. -- (from MEMORY) external "C use %"eif_memory.h%"" alias "eif_mem_tget" ensure -- from MEMORY instance_free: class end objects_instance_of (an_object: ANY): SPECIAL [ANY] -- Objects that have same dynamic type as an_object. -- (from MEMORY) do Result := objects_instance_of_type (an_object.generating_type.type_id) ensure -- from MEMORY instance_free: class end objects_instance_of_type (a_type_id: INTEGER_32): SPECIAL [ANY] -- Objects that have same dynamic type as an_object. -- (from MEMORY) do Result := find_instance_of (a_type_id, Special_any_dynamic_type) ensure -- from MEMORY instance_free: class end referers (an_object: ANY): SPECIAL [ANY] -- Objects that refer to an_object. -- (from MEMORY) do Result := find_referers (an_object, Special_any_dynamic_type) ensure -- from MEMORY instance_free: class end same_type (other: ANY): BOOLEAN -- Is type of current object identical to type of other? -- (from ANY) require -- from ANY other_not_void: other /= Void external "built_in" ensure -- from ANY definition: Result = (conforms_to (other) and other.conforms_to (Current)) end scavenge_zone_size: INTEGER_32 -- Size of generational scavenge zone. -- If the environment variable EIF_MEMORY_SCAVENGE -- is defined, it is set to the closest reasonable -- value from it. -- (from MEMORY) external "C use %"eif_memory.h%"" alias "eif_scavenge_zone_size" ensure -- from MEMORY instance_free: class end tenure: INTEGER_32 -- Maximum age of object before being considered -- as old (old objects are not scanned during -- partial collection). -- If the environment variable EIF_TENURE_MAX -- is defined, it is set to the closest reasonable -- value from it. -- (from MEMORY) external "C use %"eif_memory.h%"" alias "eif_tenure" ensure -- from MEMORY instance_free: class end feature {NONE} -- Status report is_in_final_collect: BOOLEAN -- Is GC currently performing final collection -- after execution of current program? -- Safe to use in dispose. -- (from DISPOSABLE) external "C inline use %"eif_memory.h%"" alias "return eif_is_in_final_collect;" end feature -- Status setting allocate_compact -- Enter memory mode: will try to compact memory -- before requesting more from the operating system. -- (from MEMORY) external "C use %"eif_memory.h%"" alias "eif_mem_slow" ensure -- from MEMORY instance_free: class end allocate_fast -- Enter speed mode: will optimize speed of memory -- allocation rather than memory usage. -- (from MEMORY) external "C use %"eif_memory.h%"" alias "eif_mem_speed" ensure -- from MEMORY instance_free: class end allocate_tiny -- Enter tiny mode: will enter memory mode -- after having freed as much memory as possible. -- (from MEMORY) external "C use %"eif_memory.h%"" alias "eif_mem_tiny" ensure -- from MEMORY instance_free: class end collection_off -- Disable garbage collection. -- (from MEMORY) external "C use %"eif_memory.h%"" alias "eif_gc_stop" ensure -- from MEMORY instance_free: class end collection_on -- Enable garbage collection. -- (from MEMORY) external "C use %"eif_memory.h%"" alias "eif_gc_run" ensure -- from MEMORY instance_free: class end disable_time_accounting -- Disable GC time accounting (default). -- (from MEMORY) do gc_monitoring (False) ensure -- from MEMORY instance_free: class end enable_time_accounting -- Enable GC time accouting, accessible in gc_statistics. -- (from MEMORY) do gc_monitoring (True) ensure -- from MEMORY instance_free: class end execute_without_collection (a_action: PROCEDURE) -- Execute a_action with the garbage collector disabled. -- If a_action modifies the status of collecting, we restore -- it no matter what at the end. -- (from MEMORY) require -- from MEMORY a_action_not_void: a_action /= Void local l_is_collecting: like collecting retried: BOOLEAN do if not retried then l_is_collecting := collecting if l_is_collecting then collection_off; a_action.call (Void) collection_on else a_action.call (Void) collection_off end else if l_is_collecting then collection_on else collection_off end end ensure -- from MEMORY instance_free: class collection_status_preserved: collecting = old collecting rescue retried := True retry end set_coalesce_period (value: INTEGER_32) -- Set coalesce_period. Every value collection, -- the Garbage Collector will coalesce -- the whole memory. -- (from MEMORY) require -- from MEMORY positive_value: value >= 0 external "C use %"eif_memory.h%"" alias "eif_set_coalesce_period" ensure -- from MEMORY instance_free: class end set_collection_period (value: INTEGER_32) -- Set collection_period. Every value collection, -- the Garbage collector will perform a collection -- on the whole memory (full collection), otherwise -- a simple partial collection is done. -- (from MEMORY) require -- from MEMORY positive_value: value >= 0 external "C use %"eif_memory.h%"" alias "eif_mem_pset" ensure -- from MEMORY instance_free: class end set_max_mem (value: INTEGER_32) -- Set the maximum amount of memory the run-time can allocate. -- (from MEMORY) require -- from MEMORY positive_value: value > 0 external "C use %"eif_memory.h%"" alias "eif_set_max_mem" ensure -- from MEMORY instance_free: class end set_memory_threshold (value: INTEGER_32) -- Set a new memory_threshold in bytes. Whenever the memory -- allocated for Eiffel reaches this value, an automatic -- collection is performed. -- (from MEMORY) require -- from MEMORY positive_value: value > 0 external "C use %"eif_memory.h%"" alias "eif_mem_tset" ensure -- from MEMORY instance_free: class end feature -- Removal collect -- Force a partial collection cycle if garbage -- collection is enabled; do nothing otherwise. -- (from MEMORY) external "C use %"eif_memory.h%"" ensure -- from MEMORY instance_free: class end dispose -- Action to be executed just before garbage collection -- reclaims an object. -- Default version does nothing; redefine in descendants -- to perform specific dispose actions. Those actions -- should only take care of freeing external resources; -- they should not perform remote calls on other objects -- since these may also be dead and reclaimed. -- (from MEMORY) do end free (object: ANY) -- Free object, by-passing garbage collection. -- Erratic behavior will result if the object is still -- referenced. -- (from MEMORY) external "built_in static" ensure -- from MEMORY instance_free: class end full_coalesce -- Coalesce the whole memory: merge adjacent free -- blocks to reduce fragmentation. Useful, when -- a lot of memory is allocated with garbage collector off. -- (from MEMORY) external "C use %"eif_memory.h%"" alias "eif_mem_coalesc" ensure -- from MEMORY instance_free: class end full_collect -- Force a full collection cycle if garbage -- collection is enabled; do nothing otherwise. -- (from MEMORY) external "C use %"eif_memory.h%"" alias "plsc" ensure -- from MEMORY instance_free: class end feature -- Duplication frozen clone (other: detachable ANY): like other obsolete "Use `twin' instead. [2017-05-31]" -- Void if other is void; otherwise new object -- equal to other -- -- For non-void other, clone calls copy; -- to change copying/cloning semantics, redefine copy. -- (from ANY) do if other /= Void then Result := other.twin end ensure -- from ANY instance_free: class equal: Result ~ other end copy (other: GAME_EVENTS_CONTROLLER) -- Update current object using fields of object attached -- to other, so as to yield equal objects. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) external "built_in" ensure -- from ANY is_equal: Current ~ other end frozen deep_clone (other: detachable ANY): like other obsolete "Use `deep_twin' instead. [2017-05-31]" -- Void if other is void: otherwise, new object structure -- recursively duplicated from the one attached to other -- (from ANY) do if other /= Void then Result := other.deep_twin end ensure -- from ANY instance_free: class deep_equal: deep_equal (other, Result) end frozen deep_copy (other: GAME_EVENTS_CONTROLLER) -- Effect equivalent to that of: -- copy (other . deep_twin) -- (from ANY) require -- from ANY other_not_void: other /= Void do copy (other.deep_twin) ensure -- from ANY deep_equal: deep_equal (Current, other) end frozen deep_twin: GAME_EVENTS_CONTROLLER -- New object structure recursively duplicated from Current. -- (from ANY) external "built_in" ensure -- from ANY deep_twin_not_void: Result /= Void deep_equal: deep_equal (Current, Result) end frozen standard_clone (other: detachable ANY): like other obsolete "Use `standard_twin' instead. [2017-05-31]" -- Void if other is void; otherwise new object -- field-by-field identical to other. -- Always uses default copying semantics. -- (from ANY) do if other /= Void then Result := other.standard_twin end ensure -- from ANY instance_free: class equal: standard_equal (Result, other) end frozen standard_copy (other: GAME_EVENTS_CONTROLLER) -- Copy every field of other onto corresponding field -- of current object. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) external "built_in" ensure -- from ANY is_standard_equal: standard_is_equal (other) end frozen standard_twin: GAME_EVENTS_CONTROLLER -- New object field-by-field identical to other. -- Always uses default copying semantics. -- (from ANY) external "built_in" ensure -- from ANY standard_twin_not_void: Result /= Void equal: standard_equal (Result, Current) end frozen twin: GAME_EVENTS_CONTROLLER -- New object equal to Current -- twin calls copy; to change copying/twinning semantics, redefine copy. -- (from ANY) external "built_in" ensure -- from ANY twin_not_void: Result /= Void is_equal: Result ~ Current end feature -- Basic operations frozen as_attached: attached GAME_EVENTS_CONTROLLER obsolete "Remove calls to this feature. [2017-05-31]" -- Attached version of Current. -- (Can be used during transitional period to convert -- non-void-safe classes to void-safe ones.) -- (from ANY) do Result := Current end frozen default: detachable GAME_EVENTS_CONTROLLER -- Default value of object's type -- (from ANY) do end frozen default_pointer: POINTER -- Default value of type POINTER -- (Avoid the need to write p.default for -- some p of type POINTER.) -- (from ANY) do ensure -- from ANY instance_free: class end default_rescue -- Process exception for routines with no Rescue clause. -- (Default: do nothing.) -- (from ANY) do end frozen do_nothing -- Execute a null action. -- (from ANY) do ensure -- from ANY instance_free: class end feature {GAME_SDL_ANY} -- Implementation clear_actions: ACTION_SEQUENCE -- Trigger before clear is execute. feature {GAME_LIBRARY_CONTROLLER} -- Implementation set_game_library (a_game_library: GAME_LIBRARY_CONTROLLER) -- Assign game_library with the provided a_game_library do game_library := a_game_library end feature {NONE} -- Implementation clear_error -- Remove error pending in Current -- (from GAME_SDL_ANY) require -- from GAME_ERROR_MANAGER True do {GAME_SDL_EXTERNAL}.sdl_clearerror Precursor {GAME_ERROR_MANAGER} is_manual_error := False ensure -- from GAME_ERROR_MANAGER no_error: not has_error ensure then -- from GAME_SDL_ANY no_error: not is_manual_error end decode_event -- Analyse the event and launch the appropriate action. -- For optimisation purpose, this routine is quite long. local l_event_type: NATURAL_32 do l_event_type := {GAME_SDL_EXTERNAL}.get_event_struct_type (item) if l_event_type = {GAME_SDL_EXTERNAL}.sdl_quit then if not quit_signal_actions.is_empty then quit_signal_actions.call ({GAME_SDL_EXTERNAL}.get_quit_event_struct_timestamp (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_windowevent then if not window_event_actions.is_empty then window_event_actions.call ({GAME_SDL_EXTERNAL}.get_window_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_window_event_struct_window_id (item), {GAME_SDL_EXTERNAL}.get_window_event_struct_event (item), {GAME_SDL_EXTERNAL}.get_window_event_struct_data1 (item), {GAME_SDL_EXTERNAL}.get_window_event_struct_data2 (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_keydown then if not key_pressed_actions.is_empty then key_pressed_actions.call ({GAME_SDL_EXTERNAL}.get_keyboard_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_keyboard_event_struct_window_id (item), {GAME_SDL_EXTERNAL}.get_keyboard_event_struct_repeat (item), {GAME_SDL_EXTERNAL}.get_key_sym_struct_scancode ({GAME_SDL_EXTERNAL}.get_keyboard_event_struct_keysym_pointer (item)), {GAME_SDL_EXTERNAL}.get_key_sym_struct_sym ({GAME_SDL_EXTERNAL}.get_keyboard_event_struct_keysym_pointer (item)), {GAME_SDL_EXTERNAL}.get_key_sym_struct_mod ({GAME_SDL_EXTERNAL}.get_keyboard_event_struct_keysym_pointer (item))) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_keyup then if not key_released_actions.is_empty then key_released_actions.call ({GAME_SDL_EXTERNAL}.get_keyboard_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_keyboard_event_struct_window_id (item), {GAME_SDL_EXTERNAL}.get_keyboard_event_struct_repeat (item), {GAME_SDL_EXTERNAL}.get_key_sym_struct_scancode ({GAME_SDL_EXTERNAL}.get_keyboard_event_struct_keysym_pointer (item)), {GAME_SDL_EXTERNAL}.get_key_sym_struct_sym ({GAME_SDL_EXTERNAL}.get_keyboard_event_struct_keysym_pointer (item)), {GAME_SDL_EXTERNAL}.get_key_sym_struct_mod ({GAME_SDL_EXTERNAL}.get_keyboard_event_struct_keysym_pointer (item))) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_textediting then if not text_editing_actions.is_empty then text_editing_actions.call ({GAME_SDL_EXTERNAL}.get_text_editing_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_text_editing_event_struct_window_id (item), pointer_utf8_to_string_32 ({GAME_SDL_EXTERNAL}.get_text_editing_event_struct_text (item)), {GAME_SDL_EXTERNAL}.get_text_editing_event_struct_start (item), {GAME_SDL_EXTERNAL}.get_text_editing_event_struct_length (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_textinput then if not text_input_actions.is_empty then text_input_actions.call ({GAME_SDL_EXTERNAL}.get_text_editing_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_text_editing_event_struct_window_id (item), pointer_utf8_to_string_32 ({GAME_SDL_EXTERNAL}.get_text_editing_event_struct_text (item))) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_mousemotion then if not mouse_motion_actions.is_empty then mouse_motion_actions.call ({GAME_SDL_EXTERNAL}.get_mouse_motion_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_mouse_motion_event_struct_window_id (item), {GAME_SDL_EXTERNAL}.get_mouse_motion_event_struct_which (item), {GAME_SDL_EXTERNAL}.get_mouse_motion_event_struct_state (item), {GAME_SDL_EXTERNAL}.get_mouse_motion_event_struct_x (item), {GAME_SDL_EXTERNAL}.get_mouse_motion_event_struct_y (item), {GAME_SDL_EXTERNAL}.get_mouse_motion_event_struct_xrel (item), {GAME_SDL_EXTERNAL}.get_mouse_motion_event_struct_yrel (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_mousebuttondown then if not mouse_button_pressed_actions.is_empty then mouse_button_pressed_actions.call ({GAME_SDL_EXTERNAL}.get_mouse_button_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_mouse_button_event_struct_window_id (item), {GAME_SDL_EXTERNAL}.get_mouse_button_event_struct_which (item), {GAME_SDL_EXTERNAL}.get_mouse_button_event_struct_button (item), {GAME_SDL_EXTERNAL}.get_mouse_button_event_struct_clicks (item), {GAME_SDL_EXTERNAL}.get_mouse_button_event_struct_x (item), {GAME_SDL_EXTERNAL}.get_mouse_button_event_struct_y (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_mousebuttonup then if not mouse_button_released_actions.is_empty then mouse_button_released_actions.call ({GAME_SDL_EXTERNAL}.get_mouse_button_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_mouse_button_event_struct_window_id (item), {GAME_SDL_EXTERNAL}.get_mouse_button_event_struct_which (item), {GAME_SDL_EXTERNAL}.get_mouse_button_event_struct_button (item), {GAME_SDL_EXTERNAL}.get_mouse_button_event_struct_clicks (item), {GAME_SDL_EXTERNAL}.get_mouse_button_event_struct_x (item), {GAME_SDL_EXTERNAL}.get_mouse_button_event_struct_y (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_mousewheel then if not mouse_wheel_move_actions.is_empty then mouse_wheel_move_actions.call ({GAME_SDL_EXTERNAL}.get_mouse_wheel_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_mouse_wheel_event_struct_window_id (item), {GAME_SDL_EXTERNAL}.get_mouse_wheel_event_struct_which (item), {GAME_SDL_EXTERNAL}.get_mouse_wheel_event_struct_x (item), {GAME_SDL_EXTERNAL}.get_mouse_wheel_event_struct_y (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_joyaxismotion then if not joy_axis_motion_actions.is_empty then joy_axis_motion_actions.call ({GAME_SDL_EXTERNAL}.get_joy_axis_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_joy_axis_event_struct_which (item), {GAME_SDL_EXTERNAL}.get_joy_axis_event_struct_axis (item), {GAME_SDL_EXTERNAL}.get_joy_axis_event_struct_value (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_joyballmotion then if not joy_ball_motion_actions.is_empty then joy_ball_motion_actions.call ({GAME_SDL_EXTERNAL}.get_joy_ball_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_joy_ball_event_struct_which (item), {GAME_SDL_EXTERNAL}.get_joy_ball_event_struct_ball (item), {GAME_SDL_EXTERNAL}.get_joy_ball_event_struct_xrel (item), {GAME_SDL_EXTERNAL}.get_joy_ball_event_struct_yrel (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_joyhatmotion then if not joy_hat_motion_actions.is_empty then joy_hat_motion_actions.call ({GAME_SDL_EXTERNAL}.get_joy_hat_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_joy_hat_event_struct_which (item), {GAME_SDL_EXTERNAL}.get_joy_hat_event_struct_hat (item), {GAME_SDL_EXTERNAL}.get_joy_hat_event_struct_value (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_joybuttondown then if not joy_button_pressed_actions.is_empty then joy_button_pressed_actions.call ({GAME_SDL_EXTERNAL}.get_joy_button_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_joy_button_event_struct_which (item), {GAME_SDL_EXTERNAL}.get_joy_button_event_struct_button (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_joybuttonup then if not joy_button_released_actions.is_empty then joy_button_released_actions.call ({GAME_SDL_EXTERNAL}.get_joy_button_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_joy_button_event_struct_which (item), {GAME_SDL_EXTERNAL}.get_joy_button_event_struct_button (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_joydeviceadded then if not joy_device_founded_actions.is_empty then joy_device_founded_actions.call ({GAME_SDL_EXTERNAL}.get_joy_device_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_joy_device_event_struct_which (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_joydeviceremoved then if not joy_device_removed_actions.is_empty then joy_device_removed_actions.call ({GAME_SDL_EXTERNAL}.get_joy_device_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_joy_device_event_struct_which (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_multigesture then if not fingers_gesture_actions.is_empty then fingers_gesture_actions.call ({GAME_SDL_EXTERNAL}.get_multi_gesture_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_multi_gesture_event_struct_touch_id (item), {GAME_SDL_EXTERNAL}.get_multi_gesture_event_struct_num_fingers (item), {GAME_SDL_EXTERNAL}.get_multi_gesture_event_struct_x (item), {GAME_SDL_EXTERNAL}.get_multi_gesture_event_struct_y (item), {GAME_SDL_EXTERNAL}.get_multi_gesture_event_struct_dtheta (item), {GAME_SDL_EXTERNAL}.get_multi_gesture_event_struct_ddist (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_fingermotion then if not finger_motion_actions.is_empty then finger_motion_actions.call ({GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_touch_id (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_finger_id (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_x (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_y (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_dx (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_dy (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_pressure (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_fingerup then if not finger_released_actions.is_empty then finger_released_actions.call ({GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_touch_id (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_finger_id (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_x (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_y (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_dx (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_dy (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_pressure (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_fingerdown then if not finger_touched_actions.is_empty then finger_touched_actions.call ({GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_touch_id (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_finger_id (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_x (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_y (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_dx (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_dy (item), {GAME_SDL_EXTERNAL}.get_touch_finger_event_struct_pressure (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_dollargesture then if not dollar_gesture_actions.is_empty then dollar_gesture_actions.call ({GAME_SDL_EXTERNAL}.get_dollar_gesture_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_dollar_gesture_event_struct_touch_id (item), {GAME_SDL_EXTERNAL}.get_dollar_gesture_event_struct_gesture_id (item), {GAME_SDL_EXTERNAL}.get_dollar_gesture_event_struct_num_fingers (item), {GAME_SDL_EXTERNAL}.get_dollar_gesture_event_struct_x (item), {GAME_SDL_EXTERNAL}.get_dollar_gesture_event_struct_y (item), {GAME_SDL_EXTERNAL}.get_dollar_gesture_event_struct_error (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_dollarrecord then if not dollar_record_actions.is_empty then dollar_record_actions.call ({GAME_SDL_EXTERNAL}.get_dollar_gesture_event_struct_timestamp (item), {GAME_SDL_EXTERNAL}.get_dollar_gesture_event_struct_touch_id (item), {GAME_SDL_EXTERNAL}.get_dollar_gesture_event_struct_gesture_id (item)) end elseif l_event_type = {GAME_SDL_EXTERNAL}.sdl_dropfile then manage_drop_file end end disable_print_on_error -- Desactive the print_on_error functionnality. -- (from GAME_ERROR_MANAGER) do Print_on_error_internal.put (False) end enable_print_on_error -- Active the print_on_error functionnality. -- (from GAME_ERROR_MANAGER) do Print_on_error_internal.put (True) end find_all_instances (result_type: INTEGER_32): SPECIAL [ANY] -- (from MEMORY) external "C signature (EIF_INTEGER): EIF_REFERENCE use %"eif_traverse.h%"" ensure -- from MEMORY instance_free: class end find_instance_of (dtype, result_type: INTEGER_32): SPECIAL [ANY] -- (from MEMORY) external "C signature (EIF_INTEGER, EIF_INTEGER): EIF_REFERENCE use %"eif_traverse.h%"" ensure -- from MEMORY instance_free: class end find_referers (target: ANY; result_type: INTEGER_32): SPECIAL [ANY] -- (from MEMORY) external "built_in static" ensure -- from MEMORY instance_free: class end gc_monitoring (flag: BOOLEAN) -- Set up GC monitoring according to flag -- (from MEMORY) external "C use %"eif_memory.h%"" alias "eif_gc_mon" ensure -- from MEMORY instance_free: class end internal_item: POINTER -- Pointer holding value when shared. -- (from MEMORY_STRUCTURE) is_manual_error: BOOLEAN -- Is the current pending error is a manual error (using manual_error as message) -- (from GAME_SDL_ANY) manage_drop_file -- Event that happen when a file is drag and dropped on the application local l_string: STRING_8 l_string_pointer: POINTER do l_string_pointer := {GAME_SDL_EXTERNAL}.get_drop_event_struct_file (item) if not file_dropped_actions.is_empty then create l_string.make_from_c (l_string_pointer); file_dropped_actions.call ([{GAME_SDL_EXTERNAL}.get_drop_event_struct_timestamp (item), create {STRING_8}.make_from_string (l_string)]) end {GAME_SDL_EXTERNAL}.sdl_free (l_string_pointer) end manage_error_boolean (a_boolean: BOOLEAN; a_message: READABLE_STRING_GENERAL) -- Create an error if a_boolean is false. -- If there is an error, append a_message to the error message -- on the SDL2 library -- (from GAME_SDL_ANY) do if not a_boolean then if Print_on_error_internal.item then Io.Error.put_string (a_message.to_string_8 + "%N"); Io.Error.put_string (last_error.to_string_8 + "%N") end has_error := True end ensure -- from GAME_SDL_ANY not a_boolean implies has_error end manage_error_code (a_error_code: INTEGER_32; a_message: READABLE_STRING_GENERAL) -- If needed create an error depending of the error code a_code. -- If there is an error, append a_message to the error message -- on the SDL2 library -- (from GAME_SDL_ANY) do if a_error_code < 0 then if Print_on_error_internal.item then Io.Error.put_string (a_message.to_string_8 + "%N"); Io.Error.put_string (last_error.to_string_8 + "%N") end has_error := True end end manage_error_pointer (a_pointer: POINTER; a_message: READABLE_STRING_GENERAL) -- Create an error if a_pointer is not valid. -- If there is an error, append a_message to the error message -- on the SDL2 library -- (from GAME_SDL_ANY) do if a_pointer.is_default_pointer then if Print_on_error_internal.item then Io.Error.put_string (a_message.to_string_8 + "%N"); Io.Error.put_string (last_error.to_string_8 + "%N") end has_error := True end ensure -- from GAME_SDL_ANY a_pointer.is_default_pointer implies has_error end managed_pointer: detachable MANAGED_POINTER -- Hold memory area in a managed way. -- (from MEMORY_STRUCTURE) manual_error: detachable READABLE_STRING_GENERAL -- The specific message for the last error -- (from GAME_ERROR_MANAGER) pointer_utf8_to_string_32 (l_utf8_pointer: POINTER): STRING_32 -- Generate a STRING_32 from the UTF8 C string pointed by l_utf8_pointer local l_to_covert: STRING_8 do create l_to_covert.make_from_c (l_utf8_pointer) Result := {UTF_CONVERTER}.utf_8_string_8_to_escaped_string_32 (l_to_covert) end print_on_error: BOOLEAN -- When an error occured, the library will print -- informations about the error on the error console -- output (default is True). -- (from GAME_ERROR_MANAGER) do Result := Print_on_error_internal.item end Print_on_error_internal: CELL [BOOLEAN] -- True when an error occured, -- The library will print it right away. -- (from GAME_ERROR_MANAGER) once ("PROCESS") create Result.put (True) end put_manual_error (a_general_message, a_specific_error: READABLE_STRING_GENERAL) -- Create an error using a_general_error for the debug information -- and a_specific_error for the lasting information -- (from GAME_SDL_ANY) do is_manual_error := True Precursor {GAME_ERROR_MANAGER} (a_general_message, a_specific_error) ensure -- from GAME_ERROR_MANAGER has_error end set_print_on_error (a_value: BOOLEAN) -- Assign to print_on_error the value of a_value -- (from GAME_ERROR_MANAGER) do if a_value then enable_print_on_error else disable_print_on_error end ensure -- from GAME_ERROR_MANAGER is_assign: print_on_error ~ a_value end Special_any_dynamic_type: INTEGER_32 -- Dynamic type ID of an instance of SPECIAL [ANY] -- (from MEMORY) once Result := ({SPECIAL [ANY]}).type_id ensure -- from MEMORY instance_free: class end feature -- Implementation structure_size: INTEGER_32 -- <Preucrsor> do Result := {GAME_SDL_EXTERNAL}.c_sizeof_sdl_event ensure -- from MEMORY_STRUCTURE is_class: class positive_result: Result > 0 end feature -- Output Io: STD_FILES -- Handle to standard file setup -- (from ANY) once create Result; Result.set_output_default ensure -- from ANY instance_free: class io_not_void: Result /= Void end out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) do Result := tagged_out ensure -- from ANY out_not_void: Result /= Void end print (o: detachable ANY) -- Write terse external representation of o -- on standard output. -- (from ANY) local s: READABLE_STRING_8 do if attached o then s := o.out if attached {READABLE_STRING_32} s as s32 then Io.put_string_32 (s32) elseif attached {READABLE_STRING_8} s as s8 then Io.put_string (s8) else Io.put_string_32 (s.as_string_32) end end ensure -- from ANY instance_free: class end frozen tagged_out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) external "built_in" ensure -- from ANY tagged_out_not_void: Result /= Void end feature -- Platform Operating_environment: OPERATING_ENVIRONMENT -- Objects available from the operating system -- (from ANY) once create Result ensure -- from ANY instance_free: class operating_environment_not_void: Result /= Void end feature {NONE} -- Retrieval frozen internal_correct_mismatch -- Called from runtime to perform a proper dynamic dispatch on correct_mismatch -- from MISMATCH_CORRECTOR. -- (from ANY) local l_msg: STRING_32 l_exc: EXCEPTIONS do if attached {MISMATCH_CORRECTOR} Current as l_corrector then l_corrector.correct_mismatch else create l_msg.make_from_string ("Mismatch: ".as_string_32) create l_exc; l_msg.append (generating_type.name_32); l_exc.raise_retrieval_exception (l_msg) end end invariant -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) -- from MEMORY_STRUCTURE managed_pointer_valid: not shared implies managed_pointer /= Void internal_item_valid: shared implies internal_item /= default_pointer end -- class GAME_EVENTS_CONTROLLER
Generated by ISE EiffelStudio