note description: "[ A window. You need a renderer (see: GAME_WINDOW_RENDERED) or a window surface (see: GAME_WINDOW_SURFACED) to put thing on the window. ]" author: "Louis Marchand" date: "Fri, 27 Feb 2015 14:42:17 +0000" revision: "1.0" todo: "HighDPI" deferred class interface GAME_WINDOW feature -- Access brightness: REAL_32 assign set_brightness -- The Gamma correction where 0.0 is completely dark and 1.0 is normal. require window_not_closed: exists ensure window_brightness_not_changed: brightness = old brightness center_horizontally -- Change x so that Current became centered in the screen require window_not_closed: exists center_horizontally_on_display (a_display: GAME_DISPLAY) -- Change x so that Current became centered in the screen a_display require window_not_closed: exists center_horizontally_on_display_index (a_index: INTEGER_32) -- Change x so that Current became centered in the screen number a_index require window_not_closed: exists index_valid: a_index >= 0 and a_index < Game_library.displays_count center_on_display (a_display: GAME_DISPLAY) -- Change position so that Current became centered in the screen a_display require window_not_closed: exists center_on_display_index (a_index: INTEGER_32) -- Change position so that Current became centered in the screen number a_index require window_not_closed: exists index_valid: a_index >= 0 and a_index < Game_library.displays_count center_position -- Change position so that Current became centered on the screen require window_not_closed: exists center_vertically -- Change y so that Current became centered in the screen require window_not_closed: exists center_vertically_on_display (a_display: GAME_DISPLAY) -- Change y so that Current became centered in the screen a_display require window_not_closed: exists center_vertically_on_display_index (a_index: INTEGER_32) -- Change y so that Current became centered in the screen number a_index require window_not_closed: exists index_valid: a_index >= 0 and a_index < Game_library.displays_count clear_events -- Remove all events. -- (from GAME_WINDOW_EVENTS) ensure -- from GAME_EVENTS running_unchanged: is_events_running = old is_events_running clipboard_text: READABLE_STRING_GENERAL assign set_clipboard_text -- The text contained by the system clipboard require has_text: has_clipboard_text close -- Close Current (you cannot open it again). require window_not_closed: exists close_request_actions: ACTION_SEQUENCE [NATURAL_32] -- When the Window manager request that Current be closed. -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS window_events_enabled: events_controller.is_window_event_enable display: GAME_DISPLAY -- display containing the center of the window. require window_not_closed: exists display_index: INTEGER_32 -- Index of the display containing the center of the window. require window_not_closed: exists ensure window_display_index_valid: not has_error implies Result >= 0 display_mode: GAME_DISPLAY_MODE assign set_display_mode -- The display mode of Current in fullscreen mode require window_not_closed: exists events_controller: GAME_EVENTS_CONTROLLER -- The main event manager exists: BOOLEAN -- Is Current has been closed expose_actions: ACTION_SEQUENCE [NATURAL_32] -- When Current is exposed and should be redraw. -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS window_events_enabled: events_controller.is_window_event_enable Game_library: GAME_LIBRARY_CONTROLLER -- The main controller of the game library -- (from GAME_LIBRARY_SHARED) gamma_correction: TUPLE [red: ARRAYED_LIST [NATURAL_16]; green: ARRAYED_LIST [NATURAL_16]; blue: ARRAYED_LIST [NATURAL_16]] -- The gamma encoding of Current require window_not_closed: exists generating_type: TYPE [detachable GAME_WINDOW] -- Type of current object -- (type of which it is a direct instance) -- (from ANY) ensure -- from ANY generating_type_not_void: Result /= Void generator: STRING_8 -- Name of current object's generating class -- (base class of the type of which it is a direct instance) -- (from ANY) ensure -- from ANY generator_not_void: Result /= Void generator_not_empty: not Result.is_empty grab_input -- Force every input in Current require window_not_closed: exists ensure is_grabbed: is_input_grabbed has_border: BOOLEAN -- Is Current has border decoration require window_not_closed: exists has_clipboard_text: BOOLEAN -- True if the system clipboard has some text has_error: BOOLEAN -- Is the library has generate an error -- (from GAME_ERROR_MANAGER) has_input_focus: BOOLEAN -- Is Current having the focus for keyboard input require window_not_closed: exists has_mouse_focus: BOOLEAN -- Is Current having the focus of the mouse require window_not_closed: exists has_text_input: BOOLEAN -- Is Current in text input mode (see: start_text_input) height: INTEGER_32 assign set_height -- The vertical length of Current require window_not_closed: exists hide -- Remove the visibility of Current require window_not_closed: exists hide_actions: ACTION_SEQUENCE [NATURAL_32] -- When Current is hide. -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS window_events_enabled: events_controller.is_window_event_enable id: NATURAL_32 -- The internal identifier of the Window (For logging purpose) require -- from GAME_WINDOW_EVENTS True require else window_not_closed: exists is_fake_fullscreen: BOOLEAN assign set_is_fake_fullscreen -- Is Current in fullscreen mode require window_not_closed: exists is_foreign: BOOLEAN -- Is Current not created by the present library require window_not_closed: exists is_fullscreen: BOOLEAN assign set_is_fullscreen -- Is Current in fullscreen mode require window_not_closed: exists is_hidden: BOOLEAN assign set_is_hidden -- Is Current in invisible require window_not_closed: exists is_input_grabbed: BOOLEAN assign set_is_input_grabbed -- Is Current grabbing all input require window_not_closed: exists is_maximized: BOOLEAN assign set_is_maximized -- Is Current in maximized mode (to fill the screen) require window_not_closed: exists is_minimized: BOOLEAN assign set_is_minimized -- Is Current in iconized representation require window_not_closed: exists is_opengl_compatible: BOOLEAN -- Is Current can be used in an OpenGL context require window_not_closed: exists is_resizable: BOOLEAN -- Can Current be resized by the user require window_not_closed: exists is_events_running: BOOLEAN assign set_is_running -- Is Current active -- (from GAME_EVENTS) is_visible: BOOLEAN -- Is Current in can be seen in the screen (not hidden) require window_not_closed: exists key_pressed_actions: ACTION_SEQUENCE [NATURAL_32, GAME_KEY_EVENT] -- When a key (represented by key_state) has been pressed. -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS key_released_events_enabled: events_controller.is_key_pressed_event_enable key_released_actions: ACTION_SEQUENCE [NATURAL_32, GAME_KEY_EVENT] -- When a key (represented by key_state) has been released. -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS key_released_events_enabled: events_controller.is_key_released_event_enable keyboard_focus_gain_actions: ACTION_SEQUENCE [NATURAL_32] -- When Current has gain keyboard focus. -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS window_events_enabled: events_controller.is_window_event_enable keyboard_focus_lost_actions: ACTION_SEQUENCE [NATURAL_32] -- When Current has lost keyboard focus. -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS window_events_enabled: events_controller.is_window_event_enable last_error: READABLE_STRING_GENERAL -- The last error generate by the library -- (from GAME_SDL_ANY) maximize -- Change the dimension of Current to fill the screen require window_not_closed: exists maximize_actions: ACTION_SEQUENCE [NATURAL_32] -- When Current has been maximized. -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS window_events_enabled: events_controller.is_window_event_enable maximum_size: TUPLE [width: INTEGER_32; height: INTEGER_32] -- The maximum dimension that Current can take require window_not_closed: exists minimize -- Put Current in an iconic representation require window_not_closed: exists minimize_actions: ACTION_SEQUENCE [NATURAL_32] -- When Current has been minimized. -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS window_events_enabled: events_controller.is_window_event_enable minimum_size: TUPLE [width: INTEGER_32; height: INTEGER_32] -- The minimum dimension that Current can take require window_not_closed: exists mouse_button_pressed_actions: ACTION_SEQUENCE [NATURAL_32, GAME_MOUSE_BUTTON_PRESS_EVENT, NATURAL_8] -- When a mouse represented by mouse_state has been pressed for the nb_clicks times -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS mouse_button_pressed_events_enabled: events_controller.is_mouse_button_pressed_event_enable mouse_button_released_actions: ACTION_SEQUENCE [NATURAL_32, GAME_MOUSE_BUTTON_RELEASE_EVENT, NATURAL_8] -- When a mouse represented by mouse_state has been released for the nb_clicks times -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS mouse_button_released_events_enabled: events_controller.is_mouse_button_released_event_enable mouse_enter_actions: ACTION_SEQUENCE [NATURAL_32] -- When Current has gained mouse focus. -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS window_events_enabled: events_controller.is_window_event_enable mouse_leave_actions: ACTION_SEQUENCE [NATURAL_32] -- When Current has lost mouse focus. -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS window_events_enabled: events_controller.is_window_event_enable mouse_motion_actions: ACTION_SEQUENCE [NATURAL_32, GAME_MOUSE_MOTION_EVENT, INTEGER_32, INTEGER_32] -- When a mouse represented by mouse_state has been moved in Current. -- The difference between the old position and the new (delta_x,delta_y) -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS mouse_motion_events_enabled: events_controller.is_mouse_motion_event_enable mouse_wheel_move_actions: ACTION_SEQUENCE [NATURAL_32, GAME_MOUSE_EVENT, INTEGER_32, INTEGER_32] -- When the wheel of a mouse represented by mouse_state has been moved. -- The difference between the old wheel position and the new one is (delta_x,delta_y) -- When delta_x is positive, the wheel has been move up, and when negative, it has been moved down -- When delta_y is positive, the wheel has been move right, and when negative, it has been moved left -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS mouse_wheel_move_events_enabled: events_controller.is_mouse_wheel_event_enable move_actions: ACTION_SEQUENCE [NATURAL_32, INTEGER_32, INTEGER_32] -- When Current has been moved to (x,y). -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS window_events_enabled: events_controller.is_window_event_enable move_mouse_to_position (a_x, a_y: INTEGER_32) -- Place the mouse at position (a_x,a_y) into Current require windows_not_closed: exists pixel_format: GAME_PIXEL_FORMAT_READABLE -- The internal format of the pixel representation in memory. require window_not_closed: exists position: TUPLE [x: INTEGER_32; y: INTEGER_32] -- The coordinate (x,y) of the position of Current in the screen. require window_not_closed: exists put_border -- Put border decoration to Current require window_not_closed: exists raise -- Put Current to the front require window_not_closed: exists release_input -- Release the input previously forced into Current require window_not_closed: exists ensure is_not_grabbed: not is_input_grabbed remove_border -- Remove border decoration to Current require window_not_closed: exists resize_actions: ACTION_SEQUENCE [NATURAL_32, INTEGER_32, INTEGER_32] -- When Current has been resized by the user (external to the game library) -- to widthxheight. Always precceded by a size_change_actions events. -- Note: This event is not trigger by the GAME_WINDOW.set_size or GAME_WINDOW.set_full_screen -- Routines -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS window_events_enabled: events_controller.is_window_event_enable restore -- Get the original dimension of Current (previously change with maximize or minimize) require window_not_closed: exists restore_actions: ACTION_SEQUENCE [NATURAL_32] -- When Current has been restored to normal size and position. -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS window_events_enabled: events_controller.is_window_event_enable run_events -- Put Current active. -- (from GAME_WINDOW_EVENTS) require -- from GAME_EVENTS run_not_already_running: not is_events_running ensure -- from GAME_EVENTS is_running: is_events_running set_brightness (a_brightness: REAL_32) -- Set the brightness (gamma correction) to a_brightness for Current where 0.0 is completely dark and 1.0 is normal. -- Set has_error when an error occured. require window_not_closed: exists window_set_brightness_valid: a_brightness >= 0.0 and a_brightness <= 1.to_real ensure window_set_brightness_changed: brightness = a_brightness set_clipboard_text (a_text: READABLE_STRING_GENERAL) -- Put a_text into the system clipboard set_display_mode (a_display_mode: GAME_DISPLAY_MODE) -- Assign display_mode with the value of a_display_mode require window_not_closed: exists set_fake_fullscreen -- Activate the "fake" fullscreen mode (setting a not bordered maximized window) require window_not_closed: exists set_fullscreen -- Activate the "true" fullscreen mode (changing resolution if necessary) require window_not_closed: exists set_gamma_correction (a_red, a_green, a_blue: ARRAYED_LIST [NATURAL_16]) -- Assign the gamma_correction values using a_red, a_green, a_blue. require window_not_closed: exists red_arrays_count_valid: a_red.count = 256 green_arrays_count_valid: a_green.count = 256 blue_arrays_count_valid: a_blue.count = 256 ensure is_assign: attached gamma_correction as la_gamma_correction and then (la_gamma_correction.red ~ a_red and la_gamma_correction.green ~ a_green and la_gamma_correction.blue ~ a_blue) set_height (a_height: INTEGER_32) -- Assign height with the value of a_height require window_not_closed: exists ensure is_assign: height = a_height width_not_changed: width = old width set_icon (a_surface: GAME_SURFACE) -- Place the icon represented by a_surface as Current icon (in the decoration) require windows_not_closed: exists surface_exists: a_surface.is_open set_is_fake_fullscreen (a_value: BOOLEAN) -- Assign to is_fake_fullscreen the value of a_value ensure is_assign: is_fake_fullscreen ~ a_value set_is_fullscreen (a_value: BOOLEAN) -- Assign to is_fullscreen the value of a_value ensure is_assign: is_fullscreen ~ a_value set_is_hidden (a_value: BOOLEAN) -- Assign to is_hidden the value of a_value ensure is_assign: is_hidden ~ a_value set_is_input_grabbed (a_value: BOOLEAN) -- Assign to is_input_grabbed the value of a_value ensure is_assign: is_input_grabbed ~ a_value set_is_maximized (a_value: BOOLEAN) -- Assign to is_maximized the value of a_value ensure is_assign: is_maximized ~ a_value set_is_minimized (a_value: BOOLEAN) -- Assign to is_minimized the value of a_value ensure is_assign: is_minimized ~ a_value set_is_running (a_value: BOOLEAN) -- Assign to is_running the value of a_value -- (from GAME_EVENTS) ensure -- from GAME_EVENTS is_assign: is_events_running ~ a_value set_maximum_size (a_width, a_height: INTEGER_32) -- Assign the values of maximum_size with the values a_width, a_height require window_not_closed: exists set_minimum_size (a_width, a_height: INTEGER_32) -- Assign the values of minimum_size with the values a_width, a_height require window_not_closed: exists set_position (a_x, a_y: INTEGER_32) -- Assign position with the values a_x and a_y require window_not_closed: exists set_size (a_width, a_height: INTEGER_32) -- Assign the values of size with the values a_width, a_height require window_not_closed: exists ensure is_assign: attached size as la_size and then (la_size.width ~ a_width and la_size.height ~ a_height) set_title (a_title: READABLE_STRING_GENERAL) -- Assign title using the value of a_title require window_not_closed: exists set_width (a_width: INTEGER_32) -- Assign width with the value of a_width require window_not_closed: exists ensure is_assign: width = a_width height_not_changed: height = old height set_windowed -- Desactivate any fullscreen mode require window_not_closed: exists set_x (a_x: INTEGER_32) -- assign x with the value of a_x require window_not_closed: exists ensure is_assign: x = a_x set_y (a_y: INTEGER_32) -- assign y with the value of a_y require window_not_closed: exists ensure is_assign: y = a_y show -- Active the visibility of Current (previously removed by hide) show_actions: ACTION_SEQUENCE [NATURAL_32] -- When Current is show. -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS window_events_enabled: events_controller.is_window_event_enable size: TUPLE [width: INTEGER_32; height: INTEGER_32] -- The present dimension of Current require window_not_closed: exists size_change_actions: ACTION_SEQUENCE [NATURAL_32] -- When Current has been resized. -- Note: Trigger when a user resize the window (external to the game library) or when a -- call to the GAME_WINDOW.set_size or GAME_WINDOW.set_full_screen routines has -- been use. -- (from GAME_WINDOW_EVENTS) require -- from GAME_WINDOW_EVENTS window_events_enabled: events_controller.is_window_event_enable start_text_input -- Begin to read text in Current start_text_input_in_rectangle (a_x, a_y, a_width, a_height: INTEGER_32) -- Begin to read text in Current displaying updated in the -- rectangle starting at position (a_x, a_y) of dimention a_width X a_height. -- Note: The library will not automatically draw the text in the rectangle. -- The coordinate and dimention will be use to show the OS candidate list (if there is one). -- See: http://wiki.libsdl.org/Tutorials/TextInput#CandidateList stop_events -- Put Current innactive. -- (from GAME_WINDOW_EVENTS) require -- from GAME_EVENTS stop_is_running: is_events_running ensure -- from GAME_EVENTS is_stopped: not is_events_running stop_text_input -- Finish the reading of text in Current text_editing_actions: ACTION_SEQUENCE [NATURAL_32, STRING_32, INTEGER_32, INTEGER_32] -- When a text has been edited in Current. -- (from GAME_WINDOW_EVENTS) text_input_actions: ACTION_SEQUENCE [NATURAL_32, STRING_32] -- When a new text has been entered in Current. -- (from GAME_WINDOW_EVENTS) title: READABLE_STRING_GENERAL assign set_title -- The text to write in the title bar of Current (part of the decoration) require window_not_closed: exists update -- Print the visual buffer modification to the screen require window_not_closed: exists width: INTEGER_32 assign set_width -- The horizontal length of Current require window_not_closed: exists window_manager: GAME_WINDOW_MANAGER -- The window manager managing Current. require window_not_closed: exists x: INTEGER_32 assign set_x -- The horizontal coordinate of the position of Current require window_not_closed: exists y: INTEGER_32 assign set_y -- The vertical coordinate of the position of Current require window_not_closed: exists 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) 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) 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) 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)) frozen is_deep_equal alias "≡≡≡" (other: GAME_WINDOW): BOOLEAN -- Are Current and other attached to isomorphic object structures? -- (from ANY) require -- from ANY other_not_void: other /= Void 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) is_equal (other: GAME_WINDOW): BOOLEAN -- Is other attached to an object considered -- equal to current object? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY symmetric: Result implies other ~ Current consistent: standard_is_equal (other) implies Result 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) 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)) frozen standard_is_equal alias "≜" (other: GAME_WINDOW): 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 ensure -- from ANY same_type: Result implies same_type (other) symmetric: Result implies other.standard_is_equal (Current) feature -- Status report 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 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 ensure -- from ANY definition: Result = (conforms_to (other) and other.conforms_to (Current)) feature -- Duplication copy (other: GAME_WINDOW) -- 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) ensure -- from ANY is_equal: Current ~ other frozen deep_copy (other: GAME_WINDOW) -- Effect equivalent to that of: -- copy (other . deep_twin) -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY deep_equal: deep_equal (Current, other) frozen deep_twin: GAME_WINDOW -- New object structure recursively duplicated from Current. -- (from ANY) ensure -- from ANY deep_twin_not_void: Result /= Void deep_equal: deep_equal (Current, Result) frozen standard_copy (other: GAME_WINDOW) -- 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) ensure -- from ANY is_standard_equal: standard_is_equal (other) frozen standard_twin: GAME_WINDOW -- New object field-by-field identical to other. -- Always uses default copying semantics. -- (from ANY) ensure -- from ANY standard_twin_not_void: Result /= Void equal: standard_equal (Result, Current) frozen twin: GAME_WINDOW -- New object equal to Current -- twin calls copy; to change copying/twinning semantics, redefine copy. -- (from ANY) ensure -- from ANY twin_not_void: Result /= Void is_equal: Result ~ Current feature -- Basic operations frozen default: detachable GAME_WINDOW -- Default value of object's type -- (from ANY) frozen default_pointer: POINTER -- Default value of type POINTER -- (Avoid the need to write p.default for -- some p of type POINTER.) -- (from ANY) ensure -- from ANY instance_free: class default_rescue -- Process exception for routines with no Rescue clause. -- (Default: do nothing.) -- (from ANY) frozen do_nothing -- Execute a null action. -- (from ANY) ensure -- from ANY instance_free: class feature -- Implementation dispose -- Close feature -- Output Io: STD_FILES -- Handle to standard file setup -- (from ANY) ensure -- from ANY instance_free: class io_not_void: Result /= Void out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY out_not_void: Result /= Void print (o: detachable ANY) -- Write terse external representation of o -- on standard output. -- (from ANY) ensure -- from ANY instance_free: class frozen tagged_out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY tagged_out_not_void: Result /= Void feature -- Platform Operating_environment: OPERATING_ENVIRONMENT -- Objects available from the operating system -- (from ANY) ensure -- from ANY instance_free: class operating_environment_not_void: Result /= Void invariant -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) end -- class GAME_WINDOW
Generated by ISE EiffelStudio