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 GAME_WINDOW inherit GAME_LIBRARY_SHARED DISPOSABLE GAME_WINDOW_EVENTS rename make as make_events, stop as stop_events, run as run_events, is_running as is_events_running, clear as clear_events end feature {NONE} -- Initialisation make (a_title: READABLE_STRING_GENERAL; a_display: detachable GAME_DISPLAY; a_is_x_centered, a_is_y_centered, a_is_x_undefined, a_is_y_undefined: BOOLEAN; a_x, a_y, a_width, a_height: INTEGER_32; a_flags: NATURAL_32) -- Initialization of a a_widthxa_height Current at position -- (a_x,a_y) using a_title as window caption, and -- using a_flags as internal attributes flags. If a_is_x_centered -- or a_is_y_centered are set, the position will be centered on -- a_display. If a_is_x_undefined or a_is_y_undefined are -- set, the position does not matter, but will be place on a_display -- If a_display is Void, the first found display will be used. require game_screen_video_enabled: Game_library.is_video_enable centered_or_undefine_x: a_is_x_centered implies not a_is_x_undefined centered_or_undefine_y: a_is_y_centered implies not a_is_y_undefined width_valid: a_width > 0 height_valid: a_height > 0 local l_utf_converter: UTF_CONVERTER l_title_utf_8: C_STRING l_x, l_y: INTEGER_32 do create l_utf_converter create l_title_utf_8.make (l_utf_converter.string_32_to_utf_8_string_8 (a_title.to_string_32)) clear_error item := {GAME_SDL_EXTERNAL}.sdl_createwindow (l_title_utf_8.item, position_coordinate_or_flags (a_x, a_is_x_centered, a_is_x_undefined, a_display), position_coordinate_or_flags (a_y, a_is_y_centered, a_is_y_undefined, a_display), a_width, a_height, a_flags) manage_error_pointer (item, "Could not create the window.") make_events; Game_library.internal_windows.extend (Current) ensure make_window_is_open: not has_error implies exists end position_coordinate_or_flags (a_coordinate: INTEGER_32; a_is_centered, a_is_undefined: BOOLEAN; a_display: detachable GAME_DISPLAY): INTEGER_32 -- If a_is_centered or a_is_undefined is set, return the corresponding -- position flags (managing also a_display if not Void). If they are -- both False, return a_coordinate require centered_or_undefine: a_is_centered implies not a_is_undefined do if a_is_centered then if attached a_display then Result := {GAME_SDL_EXTERNAL}.sdl_windowpos_centered_display (a_display.index) else Result := {GAME_SDL_EXTERNAL}.sdl_windowpos_centered end elseif a_is_undefined then if attached a_display then Result := {GAME_SDL_EXTERNAL}.sdl_windowpos_undefined_display (a_display.index) else Result := {GAME_SDL_EXTERNAL}.sdl_windowpos_undefined end else Result := a_coordinate end end feature -- Access update -- Print the visual buffer modification to the screen require window_not_closed: exists deferred end has_clipboard_text: BOOLEAN -- True if the system clipboard has some text do Result := {GAME_SDL_EXTERNAL}.sdl_hasclipboardtext end clipboard_text: READABLE_STRING_GENERAL assign set_clipboard_text -- The text contained by the system clipboard require has_text: has_clipboard_text local l_converter: UTF_CONVERTER l_c_pointer: POINTER l_c_string: C_STRING do clear_error l_c_pointer := {GAME_SDL_EXTERNAL}.sdl_getclipboardtext if not l_c_pointer.is_default_pointer then create l_c_string.make_shared_from_pointer (l_c_pointer) Result := l_converter.utf_8_string_8_to_string_32 (l_c_string.string) {GAME_SDL_EXTERNAL}.sdl_free (l_c_pointer) else manage_error_pointer (l_c_pointer, "Cannot fetch clipboard text.") Result := "" end end set_clipboard_text (a_text: READABLE_STRING_GENERAL) -- Put a_text into the system clipboard local l_converter: UTF_CONVERTER l_error: INTEGER_32 l_c_string: C_STRING do clear_error create l_c_string.make (l_converter.string_32_to_utf_8_string_8 (a_text.to_string_32)) l_error := {GAME_SDL_EXTERNAL}.sdl_setclipboardtext (l_c_string.item) manage_error_code (l_error, "Cannot put text into the system clipboard.") end 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 do Result := {GAME_SDL_EXTERNAL}.sdl_getwindowbrightness (item) ensure window_brightness_not_changed: brightness = old brightness end 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 local l_error: INTEGER_32 do clear_error has_error := False l_error := {GAME_SDL_EXTERNAL}.sdl_setwindowbrightness (item, a_brightness) manage_error_code (l_error, "An error occured when setting the brightness of the window.") ensure window_set_brightness_changed: brightness = a_brightness end display_index: INTEGER_32 -- Index of the display containing the center of the window. require window_not_closed: exists do clear_error has_error := False Result := {GAME_SDL_EXTERNAL}.sdl_getwindowdisplayindex (item) manage_error_code (Result, "An error occured when getting the display index.") ensure window_display_index_valid: not has_error implies Result >= 0 end display: GAME_DISPLAY -- display containing the center of the window. require window_not_closed: exists local l_index: INTEGER_32 do l_index := display_index if l_index >= 0 then create Result.make (l_index) else create Result.make (0) end end close -- Close Current (you cannot open it again). require window_not_closed: exists do clear_events {GAME_SDL_EXTERNAL}.sdl_destroywindow (item) item := create {POINTER}.default_create; Game_library.internal_windows.prune_all (Current) end exists: BOOLEAN -- Is Current has been closed do Result := not item.is_default_pointer end pixel_format: GAME_PIXEL_FORMAT_READABLE -- The internal format of the pixel representation in memory. require window_not_closed: exists do create Result.make_from_flags ({GAME_SDL_EXTERNAL}.sdl_getwindowpixelformat (item)) end window_manager: GAME_WINDOW_MANAGER -- The window manager managing Current. require window_not_closed: exists local l_wm_info: POINTER l_valid: BOOLEAN do l_wm_info := l_wm_info.memory_calloc (1, {GAME_SDL_EXTERNAL}.c_sizeof_sdl_sys_wm_info) {GAME_SDL_EXTERNAL}.sdl_version_compile ({GAME_SDL_EXTERNAL}.get_sys_wm_struct_version (l_wm_info)) clear_error l_valid := {GAME_SDL_EXTERNAL}.sdl_getwindowwminfo (item, l_wm_info) manage_error_boolean (l_valid, "An error occured when getting the window manager informations.") create Result.own_from_pointer (l_wm_info) end id: NATURAL_32 -- The internal identifier of the Window (For logging purpose) require else window_not_closed: exists do Result := {GAME_SDL_EXTERNAL}.sdl_getwindowid (item) end hide -- Remove the visibility of Current require window_not_closed: exists do {GAME_SDL_EXTERNAL}.sdl_hidewindow (item) end show -- Active the visibility of Current (previously removed by hide) do {GAME_SDL_EXTERNAL}.sdl_showwindow (item) end maximize -- Change the dimension of Current to fill the screen require window_not_closed: exists do {GAME_SDL_EXTERNAL}.sdl_maximizewindow (item) end minimize -- Put Current in an iconic representation require window_not_closed: exists do {GAME_SDL_EXTERNAL}.sdl_minimizewindow (item) end restore -- Get the original dimension of Current (previously change with maximize or minimize) require window_not_closed: exists do {GAME_SDL_EXTERNAL}.sdl_restorewindow (item) end raise -- Put Current to the front require window_not_closed: exists do {GAME_SDL_EXTERNAL}.sdl_raisewindow (item) end put_border -- Put border decoration to Current require window_not_closed: exists do {GAME_SDL_EXTERNAL}.sdl_setwindowbordered (item, True) end remove_border -- Remove border decoration to Current require window_not_closed: exists do {GAME_SDL_EXTERNAL}.sdl_setwindowbordered (item, False) end display_mode: GAME_DISPLAY_MODE assign set_display_mode -- The display mode of Current in fullscreen mode require window_not_closed: exists local l_error: INTEGER_32 do create Result.make (1, 1) l_error := {GAME_SDL_EXTERNAL}.sdl_getwindowdisplaymode (item, Result.item) manage_error_code (l_error, "Cannot retreive the display mode of a window.") end set_display_mode (a_display_mode: GAME_DISPLAY_MODE) -- Assign display_mode with the value of a_display_mode require window_not_closed: exists local l_error: INTEGER_32 do l_error := {GAME_SDL_EXTERNAL}.sdl_setwindowdisplaymode (item, a_display_mode.item) manage_error_code (l_error, "Cannot assign a display mode to a window.") end set_fullscreen -- Activate the "true" fullscreen mode (changing resolution if necessary) require window_not_closed: exists local l_error: INTEGER_32 do l_error := {GAME_SDL_EXTERNAL}.sdl_setwindowfullscreen (item, {GAME_SDL_EXTERNAL}.sdl_window_fullscreen) manage_error_code (l_error, "Cannot set window to full screen (true)") end set_fake_fullscreen -- Activate the "fake" fullscreen mode (setting a not bordered maximized window) require window_not_closed: exists local l_error: INTEGER_32 do l_error := {GAME_SDL_EXTERNAL}.sdl_setwindowfullscreen (item, {GAME_SDL_EXTERNAL}.sdl_window_fullscreen_desktop) manage_error_code (l_error, "Cannot set window to full screen (fake)") end set_windowed -- Desactivate any fullscreen mode require window_not_closed: exists local l_error: INTEGER_32 do l_error := {GAME_SDL_EXTERNAL}.sdl_setwindowfullscreen (item, 0) manage_error_code (l_error, "Cannot set window to not fullscreen") end is_fullscreen: BOOLEAN assign set_is_fullscreen -- Is Current in fullscreen mode require window_not_closed: exists do Result := {GAME_SDL_EXTERNAL}.sdl_getwindowflags (item).bit_and ({GAME_SDL_EXTERNAL}.sdl_window_fullscreen) /= 0 end set_is_fullscreen (a_value: BOOLEAN) -- Assign to is_fullscreen the value of a_value do if a_value then set_fullscreen else set_windowed end ensure is_assign: is_fullscreen ~ a_value end is_fake_fullscreen: BOOLEAN assign set_is_fake_fullscreen -- Is Current in fullscreen mode require window_not_closed: exists do Result := {GAME_SDL_EXTERNAL}.sdl_getwindowflags (item).bit_and ({GAME_SDL_EXTERNAL}.sdl_window_fullscreen_desktop) /= 0 end set_is_fake_fullscreen (a_value: BOOLEAN) -- Assign to is_fake_fullscreen the value of a_value do if a_value then set_fake_fullscreen else set_windowed end ensure is_assign: is_fake_fullscreen ~ a_value end is_opengl_compatible: BOOLEAN -- Is Current can be used in an OpenGL context require window_not_closed: exists do Result := {GAME_SDL_EXTERNAL}.sdl_getwindowflags (item).bit_and ({GAME_SDL_EXTERNAL}.sdl_window_opengl) /= 0 end is_visible: BOOLEAN -- Is Current in can be seen in the screen (not hidden) require window_not_closed: exists do Result := {GAME_SDL_EXTERNAL}.sdl_getwindowflags (item).bit_and ({GAME_SDL_EXTERNAL}.sdl_window_shown) /= 0 end is_hidden: BOOLEAN assign set_is_hidden -- Is Current in invisible require window_not_closed: exists do Result := {GAME_SDL_EXTERNAL}.sdl_getwindowflags (item).bit_and ({GAME_SDL_EXTERNAL}.sdl_window_hidden) /= 0 end set_is_hidden (a_value: BOOLEAN) -- Assign to is_hidden the value of a_value do if a_value then hide else show end ensure is_assign: is_hidden ~ a_value end has_border: BOOLEAN -- Is Current has border decoration require window_not_closed: exists do Result := {GAME_SDL_EXTERNAL}.sdl_getwindowflags (item).bit_and ({GAME_SDL_EXTERNAL}.sdl_window_borderless) = 0 end is_resizable: BOOLEAN -- Can Current be resized by the user require window_not_closed: exists do Result := {GAME_SDL_EXTERNAL}.sdl_getwindowflags (item).bit_and ({GAME_SDL_EXTERNAL}.sdl_window_resizable) /= 0 end is_minimized: BOOLEAN assign set_is_minimized -- Is Current in iconized representation require window_not_closed: exists do Result := {GAME_SDL_EXTERNAL}.sdl_getwindowflags (item).bit_and ({GAME_SDL_EXTERNAL}.sdl_window_minimized) /= 0 end set_is_minimized (a_value: BOOLEAN) -- Assign to is_minimized the value of a_value do if a_value then minimize else restore end ensure is_assign: is_minimized ~ a_value end is_maximized: BOOLEAN assign set_is_maximized -- Is Current in maximized mode (to fill the screen) require window_not_closed: exists do Result := {GAME_SDL_EXTERNAL}.sdl_getwindowflags (item).bit_and ({GAME_SDL_EXTERNAL}.sdl_window_maximized) /= 0 end set_is_maximized (a_value: BOOLEAN) -- Assign to is_maximized the value of a_value do if a_value then maximize else restore end ensure is_assign: is_maximized ~ a_value end has_input_focus: BOOLEAN -- Is Current having the focus for keyboard input require window_not_closed: exists do Result := {GAME_SDL_EXTERNAL}.sdl_getwindowflags (item).bit_and ({GAME_SDL_EXTERNAL}.sdl_window_input_focus) /= 0 end has_mouse_focus: BOOLEAN -- Is Current having the focus of the mouse require window_not_closed: exists do Result := {GAME_SDL_EXTERNAL}.sdl_getwindowflags (item).bit_and ({GAME_SDL_EXTERNAL}.sdl_window_mouse_focus) /= 0 end is_foreign: BOOLEAN -- Is Current not created by the present library require window_not_closed: exists do Result := {GAME_SDL_EXTERNAL}.sdl_getwindowflags (item).bit_and ({GAME_SDL_EXTERNAL}.sdl_window_foreign) /= 0 end 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 local l_red, l_green, l_blue: ARRAY [NATURAL_16] l_error: INTEGER_32 do create l_red.make_filled ({NATURAL_16} 0, 1, 256) create l_green.make_filled ({NATURAL_16} 0, 1, 256) create l_blue.make_filled ({NATURAL_16} 0, 1, 256) l_error := {GAME_SDL_EXTERNAL}.sdl_getwindowgammaramp (item, $l_red.to_pointer, $l_green.to_pointer, $l_blue.to_pointer) manage_error_code (l_error, "Cannot get gamma correction values.") Result := [create {ARRAYED_LIST [NATURAL_16]}.make_from_array (l_red), create {ARRAYED_LIST [NATURAL_16]}.make_from_array (l_green), create {ARRAYED_LIST [NATURAL_16]}.make_from_array (l_blue)] end 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 local l_red, l_green, l_blue: ARRAY [NATURAL_16] l_error: INTEGER_32 do l_red := a_red.to_array l_green := a_green.to_array l_blue := a_blue.to_array l_error := {GAME_SDL_EXTERNAL}.sdl_setwindowgammaramp (item, $l_red.to_pointer, $l_green.to_pointer, $l_blue.to_pointer) manage_error_code (l_error, "Cannot set gamma correction values.") 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) end is_input_grabbed: BOOLEAN assign set_is_input_grabbed -- Is Current grabbing all input require window_not_closed: exists do Result := {GAME_SDL_EXTERNAL}.sdl_getwindowgrab (item) end set_is_input_grabbed (a_value: BOOLEAN) -- Assign to is_input_grabbed the value of a_value do if a_value then grab_input else release_input end ensure is_assign: is_input_grabbed ~ a_value end grab_input -- Force every input in Current require window_not_closed: exists do {GAME_SDL_EXTERNAL}.sdl_setwindowgrab (item, True) ensure is_grabbed: is_input_grabbed end release_input -- Release the input previously forced into Current require window_not_closed: exists do {GAME_SDL_EXTERNAL}.sdl_setwindowgrab (item, False) ensure is_not_grabbed: not is_input_grabbed end maximum_size: TUPLE [width: INTEGER_32; height: INTEGER_32] -- The maximum dimension that Current can take require window_not_closed: exists local l_width, l_height: INTEGER_32 do {GAME_SDL_EXTERNAL}.sdl_getwindowmaximumsize (item, $l_width.to_pointer, $l_height.to_pointer) Result := [l_width, l_height] end 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 do {GAME_SDL_EXTERNAL}.sdl_setwindowmaximumsize (item, a_width, a_height) end minimum_size: TUPLE [width: INTEGER_32; height: INTEGER_32] -- The minimum dimension that Current can take require window_not_closed: exists local l_width, l_height: INTEGER_32 do {GAME_SDL_EXTERNAL}.sdl_getwindowminimumsize (item, $l_width.to_pointer, $l_height.to_pointer) Result := [l_width, l_height] end 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 do {GAME_SDL_EXTERNAL}.sdl_setwindowminimumsize (item, a_width, a_height) end size: TUPLE [width: INTEGER_32; height: INTEGER_32] -- The present dimension of Current require window_not_closed: exists local l_width, l_height: INTEGER_32 do {GAME_SDL_EXTERNAL}.sdl_getwindowsize (item, $l_width.to_pointer, $l_height.to_pointer) Result := [l_width, l_height] end 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 do {GAME_SDL_EXTERNAL}.sdl_setwindowsize (item, a_width, a_height) ensure is_assign: attached size as la_size and then (la_size.width ~ a_width and la_size.height ~ a_height) end height: INTEGER_32 assign set_height -- The vertical length of Current require window_not_closed: exists do Result := size.height end set_height (a_height: INTEGER_32) -- Assign height with the value of a_height require window_not_closed: exists do set_size (width, a_height) ensure is_assign: height = a_height width_not_changed: width = old width end width: INTEGER_32 assign set_width -- The horizontal length of Current require window_not_closed: exists do Result := size.width end set_width (a_width: INTEGER_32) -- Assign width with the value of a_width require window_not_closed: exists do set_size (a_width, height) ensure is_assign: width = a_width height_not_changed: height = old height end 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 local l_x, l_y: INTEGER_32 do {GAME_SDL_EXTERNAL}.sdl_getwindowposition (item, $l_x.to_pointer, $l_y.to_pointer) Result := [l_x, l_y] end set_position (a_x, a_y: INTEGER_32) -- Assign position with the values a_x and a_y require window_not_closed: exists do {GAME_SDL_EXTERNAL}.sdl_setwindowposition (item, a_x, a_y) end x: INTEGER_32 assign set_x -- The horizontal coordinate of the position of Current require window_not_closed: exists do Result := position.x end set_x (a_x: INTEGER_32) -- assign x with the value of a_x require window_not_closed: exists do set_position (a_x, y) ensure is_assign: x = a_x end center_horizontally -- Change x so that Current became centered in the screen require window_not_closed: exists do set_x ({GAME_SDL_EXTERNAL}.sdl_windowpos_centered) end 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 do set_x ({GAME_SDL_EXTERNAL}.sdl_windowpos_centered_display (a_index)) end 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 do center_horizontally_on_display_index (a_display.index) end y: INTEGER_32 assign set_y -- The vertical coordinate of the position of Current require window_not_closed: exists do Result := position.x end set_y (a_y: INTEGER_32) -- assign y with the value of a_y require window_not_closed: exists do set_position (x, a_y) ensure is_assign: y = a_y end center_vertically -- Change y so that Current became centered in the screen require window_not_closed: exists do set_y ({GAME_SDL_EXTERNAL}.sdl_windowpos_centered) end 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 do set_y ({GAME_SDL_EXTERNAL}.sdl_windowpos_centered_display (a_index)) end 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 do center_vertically_on_display_index (a_display.index) end center_position -- Change position so that Current became centered on the screen require window_not_closed: exists do set_position ({GAME_SDL_EXTERNAL}.sdl_windowpos_centered, {GAME_SDL_EXTERNAL}.sdl_windowpos_centered) end 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 do set_position ({GAME_SDL_EXTERNAL}.sdl_windowpos_centered_display (a_index), {GAME_SDL_EXTERNAL}.sdl_windowpos_centered_display (a_index)) end center_on_display (a_display: GAME_DISPLAY) -- Change position so that Current became centered in the screen a_display require window_not_closed: exists do center_on_display_index (a_display.index) end 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 local l_text_c: C_STRING do create l_text_c.make_by_pointer ({GAME_SDL_EXTERNAL}.sdl_getwindowtitle (item)) Result := {UTF_CONVERTER}.utf_8_string_8_to_string_32 (l_text_c.string) end set_title (a_title: READABLE_STRING_GENERAL) -- Assign title using the value of a_title require window_not_closed: exists local l_utf_converter: UTF_CONVERTER l_text_m_ptr: MANAGED_POINTER l_count: INTEGER_32 do create l_utf_converter l_count := l_utf_converter.utf_8_bytes_count (a_title, 1, a_title.count) + 1 create l_text_m_ptr.make (l_count); l_utf_converter.string_32_into_utf_8_0_pointer (a_title.as_string_32, l_text_m_ptr, 0, Void) check pointer_not_null: not l_text_m_ptr.item.is_default_pointer end {GAME_SDL_EXTERNAL}.sdl_setwindowtitle (item, l_text_m_ptr.item) end 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 do {GAME_SDL_EXTERNAL}.sdl_warpmouseinwindow (item, a_x, a_y) end 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 do {GAME_SDL_EXTERNAL}.sdl_setwindowicon (item, a_surface.item) end start_text_input -- Begin to read text in Current do {GAME_SDL_EXTERNAL}.sdl_starttextinput end 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 local l_rectangle: POINTER do l_rectangle := l_rectangle.memory_calloc (1, {GAME_SDL_EXTERNAL}.c_sizeof_sdl_rect) {GAME_SDL_EXTERNAL}.set_rect_struct_x (l_rectangle, a_x) {GAME_SDL_EXTERNAL}.set_rect_struct_y (l_rectangle, a_y) {GAME_SDL_EXTERNAL}.set_rect_struct_w (l_rectangle, a_width) {GAME_SDL_EXTERNAL}.set_rect_struct_h (l_rectangle, a_height) {GAME_SDL_EXTERNAL}.sdl_settextinputrect (l_rectangle) start_text_input; l_rectangle.memory_free end stop_text_input -- Finish the reading of text in Current do {GAME_SDL_EXTERNAL}.sdl_stoptextinput end has_text_input: BOOLEAN -- Is Current in text input mode (see: start_text_input) do Result := {GAME_SDL_EXTERNAL}.sdl_istextinputactive end events_controller: GAME_EVENTS_CONTROLLER -- The main event manager do Result := Game_library.events_controller end feature {GAME_RENDERER} item: POINTER -- The internal C pointer to the internal representation of Current feature -- Implementation dispose -- Close do if exists then close end end end -- class GAME_WINDOW
Generated by ISE EiffelStudio