indexing description: "Main class of puzzle game UC" author: "Team UC" date: "$Date$" revision: "$Revision$" class PUZZLE_START_WINDOW inherit EM_DRAWABLE_SCENE redefine initialize_scene, handle_key_down_event end UC_SHARED_ITEMS export {NONE} all undefine default_create end MEMORY -- need some additional memory management undefine default_create end SDLKEY_ENUM_EXTERNAL -- need the key codes export {NONE} all undefine default_create end feature {NONE} -- Initialization initialize_scene is -- Create the main application. local border : EM_POLYLINE -- this is the small frame to show the user where the puzzle should go pts_list : LINKED_LIST[EM_VECTOR_2D] -- array of points, needed to initialize the border free_width : INTEGER -- local variable to calculate the free space on left side do if not is_initialized then make_scene -- set the background background_color := uc_light_color -- prepare the puzzle -- we actually need a cutter cutter.make_from_image (image_file_name, number_of_parts) -- this tells the cutter to cut the image he finds at this path in about 50 parts cutter.last_puzzle.mix_up create puzzle.make_from_puzzle(cutter.last_puzzle) -- this gets the result of cutters work in our scene puzzle.set_x_y (10,10) active_space := puzzle image := cutter.last_image number_of_parts := puzzle.count image.set_x_y(width-puzzle.image_width-10,10) -- move the puzzle a bit away from the border main_container.extend (active_space) -- and finally put it into the container free_width := width - puzzle.image_width - 30 puzzle.set_parts_in_row (free_width// (puzzle.part_width.max(puzzle.part_height)+10)) -- create the workspace, but do not show it ! create workspace1.make_from_other(puzzle) workspace1.set_x_y(10,10) create workspace2.make workspace2.copy_parameter_from(puzzle) workspace2.set_x_y(10,10) -- prepare everything to hold the solution create to_field.make to_field.set_x_y(width-puzzle.image_width-10,10) -- create the container where the parts should go if correctly placed main_container.extend (to_field) -- and put it into the container -- draw the border to let the user know where he should place the result create pts_list.make pts_list.extend (create {EM_VECTOR_2D}.make (width-puzzle.image_width-10, 10)) pts_list.extend (create {EM_VECTOR_2D}.make (width-10,10)) pts_list.extend (create {EM_VECTOR_2D}.make (width-10,10+puzzle.image_height)) pts_list.extend (create {EM_VECTOR_2D}.make (width-puzzle.image_width-10,10+puzzle.image_height)) pts_list.extend (create {EM_VECTOR_2D}.make (width-puzzle.image_width-10, 10)) create border.make_from_list (pts_list) border.set_line_color (create {EM_COLOR}.make_black) main_container.extend (border) -- start sound -- player.set_event_loop (event_loop) player.play --if player.is_empty then create song_title_to_show.make (player.song_title_cut, uc_gui_elements_default_font) song_title_to_show.set_x_y (15, height - song_title_to_show.height - 5) main_container.extend (song_title_to_show) create song_title.make_from_string (player.song_title_cut) event_loop.update_event.subscribe (agent check_next_song) --event_loop.outside_event.subscribe (agent check_next_song) -- else -- create song_title_to_show.make (" ", uc_gui_elements_default_font) -- create song_title.make_empty -- end -- songs are shown song_show := True else if not pause_force then -- player.pause end player.play pause_force := False song_show := True end if is_initialized and not load then uninit_guis end init_player_gui create_buttons initialize_events if player.volume = 0 then mute.set_icon (nosound_icon) end if player.music_player.playlist.has ("sound/applaus") then --io.put_string("applaus here") player.stop player.reinit player.play end end uninit_guis is -- removes all the guis and checks many things do -- uninit events button_fs.button_clicked_event.subscribe (agent handle_ws_button (puzzle)) button_w1.button_clicked_event.subscribe (agent handle_ws_button (workspace1)) button_w2.button_clicked_event.subscribe (agent handle_ws_button (workspace2)) button_trash.button_clicked_event.subscribe (agent handle_trash_button) button_reset.button_clicked_event.subscribe (agent handle_reset_button) button_image.button_clicked_event.subscribe (agent handle_image_button) button_cheat.button_clicked_event.subscribe (agent handle_cheat) puzzle.mouse_button_down_on_item_event.subscribe (agent handle_mouse_button_down_on_item) event_loop.mouse_motion_event.subscribe (agent handle_mouse_motion) event_loop.update_event.subscribe (agent handle_finish) -- uninit buttons main_container.delete (button_fs) main_container.delete (button_w1) main_container.delete (button_w2) main_container.delete (button_reset) main_container.delete (button_cheat) main_container.delete (button_image) main_container.delete (button_trash) -- uninit player_gui main_container.delete (prev) main_container.delete (next) main_container.delete (stop) main_container.delete (play_pause) main_container.delete (mute) end initialize_events is -- initialize all events do button_fs.button_clicked_event.subscribe (agent handle_ws_button (puzzle) ) button_w1.button_clicked_event.subscribe (agent handle_ws_button ( workspace1 ) ) button_w2.button_clicked_event.subscribe (agent handle_ws_button ( workspace2 ) ) button_trash.button_clicked_event.subscribe (agent handle_trash_button) button_reset.button_clicked_event.subscribe (agent handle_reset_button) button_image.button_clicked_event.subscribe (agent handle_image_button) button_cheat.button_clicked_event.subscribe (agent handle_cheat) puzzle.mouse_button_down_on_item_event.subscribe (agent handle_mouse_button_down_on_item) event_loop.mouse_motion_event.subscribe (agent handle_mouse_motion) event_loop.update_event.subscribe (agent handle_finish) end create_buttons is -- create all the buttons local ws_icon : EM_BITMAP -- save locally the icons for the workspaces x_coord: INTEGER factor : DOUBLE -- temporary var to calc zoom factor do bitmap_factory.create_bitmap_from_image ("./image/workspace.png") bitmap_factory.create_zoomed_bitmap (bitmap_factory.last_bitmap, 0.3) ws_icon := bitmap_factory.last_bitmap create button_fs.make_with_icon(ws_icon ,event_loop) x_coord := 20 button_fs.set_name ("0") button_fs.set_x_y(x_coord,y_coord) main_container.extend(button_fs) button_fs.toggle_active create button_w1.make_with_icon(ws_icon ,event_loop) button_w1.set_name ("1") button_w1.set_x_y(100,y_coord) main_container.extend(button_w1) create button_w2.make_with_icon(ws_icon ,event_loop) button_w2.set_name ("2") button_w2.set_x_y(180,y_coord) main_container.extend(button_w2) bitmap_factory.create_bitmap_from_image ("./image/trash.png") factor := (ws_icon.height-2) / bitmap_factory.last_bitmap.height bitmap_factory.create_zoomed_bitmap (bitmap_factory.last_bitmap, factor) create button_trash.make_with_icon(bitmap_factory.last_bitmap ,event_loop) --button_trash.set_horizontal_margin ((button_w2.width - bitmap_factory.last_bitmap.width)//2) button_trash.set_width (button_fs.width) button_trash.set_x_y(260,y_coord) main_container.extend(button_trash) bitmap_factory.create_bitmap_from_image ("./image/reset.png") factor := (ws_icon.height-2) / bitmap_factory.last_bitmap.height bitmap_factory.create_zoomed_bitmap (bitmap_factory.last_bitmap, factor) create button_reset.make_with_icon(bitmap_factory.last_bitmap,event_loop) button_reset.set_x_y(340,y_coord) main_container.extend(button_reset) button_reset.set_width (button_fs.width) bitmap_factory.create_bitmap_from_image ("./image/cheat.png") factor := (ws_icon.height-2) / bitmap_factory.last_bitmap.height bitmap_factory.create_zoomed_bitmap (bitmap_factory.last_bitmap, factor) create button_cheat.make_with_icon(bitmap_factory.last_bitmap, event_loop) button_cheat.set_x_y(420, y_coord) main_container.extend (button_cheat) button_cheat.set_width (button_fs.width) bitmap_factory.create_bitmap_from_image ("./image/image.png") factor := (ws_icon.height-2) / bitmap_factory.last_bitmap.height bitmap_factory.create_zoomed_bitmap (bitmap_factory.last_bitmap, factor) create button_image.make_with_icon(bitmap_factory.last_bitmap, event_loop) button_image.set_x_y(500, y_coord) main_container.extend (button_image) button_image.set_width (button_fs.width) end feature {UC_SAVE_PUZZLE, UC_LOAD_PUZZLE} -- Status image_file_name: STRING -- Name of image we want to display image: EM_BITMAP -- the image that was used to cut the puzzle number_of_parts: INTEGER -- The number of parts feature {UC_SAVE_PUZZLE, UC_LOAD_PUZZLE} -- Workspaces, Puzzle usw puzzle : UC_FROM_SPACE -- this is the container for the puzzle parts at the left side of screen workspace1 : UC_WORKSPACE workspace2 : UC_WORKSPACE -- this are the container where the user can do what he wants to active_space : UC_WORKSPACE -- this is the container which is actually on top and active to_field: UC_TO_SPACE -- this is the container for the puzzle_parts which are placed correctly puzzle_part_view : UC_PUZZLE_PART_VIEW -- active item to move feature {NONE} -- Buttons for workspace control button_fs : BUTTON -- this is the button representating the from_space button_w1 : BUTTON button_w2 : BUTTON -- this are the buttons representating the workspaces button_trash : BUTTON -- button for deleting a part from a workspace button_reset: BUTTON -- button for resetting a workspace button_image : BUTTON -- button for showing the solution button_cheat : BUTTON -- button for cheating y_coord: INTEGER is -- y_coord for the menu gui once Result := height - mute.height - song_title_to_show.height - 5 end load: BOOLEAN -- load game? feature -- load function set_load is -- sets to load do load := True end feature {NONE} -- Agents handle_mouse_button_down_on_item (an_item: EM_DRAWABLE; a_mouse_button_event: EM_MOUSEBUTTON_EVENT) is -- This activates the part the user clicked on do puzzle_part_view ?= an_item -- find out wheter the user has clicked a puzzle_part_view -- and if it is in the active container if puzzle_part_view /= void and then active_space.has(puzzle_part_view) then -- if so do the action if a_mouse_button_event.is_left_button then -- left button means moving active_space.hide (puzzle_part_view) -- hide the part in the start_space puzzle_part_view.set_x_y(puzzle_part_view.x+puzzle.x, puzzle_part_view.y+puzzle.y) -- do the coordinate transformation main_container.extend(puzzle_part_view) -- put it in the main container so it can move over the whole screen elseif a_mouse_button_event.is_right_button then -- right button means rotate puzzle_part_view.rotate puzzle_part_view := void end end end handle_mouse_motion (a_motion_event: EM_MOUSEMOTION_EVENT) is -- this moves the part around on the screen -- if button is released: -- if it is at correct position, it gets locked -- if part is moved to other position in workspace, the workspace gets rearranged -- otherwise it jumps back to where it came from local new_x, new_y: INTEGER do if puzzle_part_view /= Void and then not puzzle_part_view.locked then if a_motion_event.button_state_left then -- Move center of `active_item' to mouse position. new_x := a_motion_event.proportional_position.x.floor new_x := new_x - puzzle_part_view.width // 2 new_y := a_motion_event.proportional_position.y.floor new_y := new_y - puzzle_part_view.height // 2 puzzle_part_view.set_x_y (new_x, new_y) else if puzzle_part_view.correct(to_field.x, to_field.y) then -- part is correctly placed, so lock it puzzle_part_view.lock -- put it into to_field to_field.extend(puzzle_part_view) -- remove it from the from_space main_container.delete(puzzle_part_view) active_space.cond_delete(puzzle_part_view) elseif active_space.sortable(puzzle_part_view) then -- part is in the range of active_space so put it there active_space.delete(puzzle_part_view) active_space.extend_sorted (puzzle_part_view) main_container.delete (puzzle_part_view) else -- part is not correctly placed, snap back -- IMPORTANT perhaps handler of button_mouse_over deletes part in meantime! active_space.unhide main_container.delete(puzzle_part_view) end -- in any case, forget this part puzzle_part_view := Void end end end feature {NONE} -- Agents for workspace control handle_ws_button (to : UC_WORKSPACE) is -- handle event when a workspace button is clicked require to_not_void: to /= void as_not_void: active_space /= void local old_pos : INTEGER do if puzzle_part_view /= void then if to /= puzzle and to /= active_space and not to.has(puzzle_part_view) then -- we have a part active, so move it to new workspace -- if the new workspace is not the from_space and the part is not yet there to.extend(puzzle_part_view) active_space.cond_delete(puzzle_part_view) main_container.delete(puzzle_part_view) puzzle_part_view := void end else -- there was no part active, so change active workspace active_space.mouse_button_down_on_item_event.suspend_subscription --suspend suscripitons, on esdl suscriptions were removed toggle_buttons -- remove all agents that where subscribed on that element old_pos := main_container.index -- save internal cursor main_container.start -- move internal cursor to start main_container.search_forth (active_space) -- search for actual element main_container.replace_at(to) -- replace the element found main_container.go_i_th (old_pos) -- restore internal cursor active_space := to -- save the new active space active_space.mouse_button_down_on_item_event.restore_subscription -- active_space.mouse_button_down_on_item_event.subscribe (agent handle_mouse_button_down_on_item) -- and register the agent toggle_buttons end end toggle_buttons is -- set buttons according to active_space do if active_space = puzzle then button_fs.toggle_active elseif active_space = workspace1 then button_w1.toggle_active elseif active_space = workspace2 then button_w2.toggle_active end end handle_trash_button is -- handle deleting a part from active workspace do if puzzle_part_view /= void then -- we have a part active, so delete it from active workspace active_space.cond_delete(puzzle_part_view) main_container.delete(puzzle_part_view) puzzle_part_view := void elseif active_space /= puzzle then active_space.wipe_out -- if actual space is not the from_space, just delete all parts there end end handle_reset_button is -- handle resetting active workspace do if active_space /= puzzle then active_space.set_list(puzzle) -- if actual space is not the from_space, just copy all parts there end end handle_image_button is -- handle showing solution do if puzzle_part_view = void then toggle_buttons -- deactivate the button indicating the workspace button_image.toggle_active -- highlight the image button main_container.extend(image) -- put image on scene event_loop.update_event.subscribe (agent handle_image_disappear(time.ticks+3000)) -- set up agent for removing the image event_loop.mouse_button_down_event.suspend_subscription event_loop.mouse_button_up_event.suspend_subscription -- stop any events reacting on mouse button down, so nothing is movable during that time collect -- use the time when the user cant do anything anyway to do some GC end end handle_image_disappear(a_time : INTEGER) is -- hide image at given point in time do if time.ticks >=a_time then main_container.delete (image) -- remove image event_loop.update_event.unsubscribe (agent handle_image_disappear (a_time)) -- unsubscribe agent button_image.toggle_active toggle_buttons -- toggle buttons event_loop.mouse_button_down_event.restore_subscription event_loop.mouse_button_up_event.restore_subscription -- and reactivate mouse events end end handle_finish is -- handle the fact, that puzzle is solved local finish : FINISH_SCREEN do if to_field.count = number_of_parts then event_loop.stop create finish.make_from_image (image) next_scene := finish end end handle_cheat is -- handle cheat request local ppv : UC_PUZZLE_PART_VIEW -- for casting... do ppv ?= puzzle.item(1) ppv.lock to_field.extend (ppv) puzzle.remove_first end feature {NONE} -- Agent for key handling handle_key_down_event (a_keyboard_event: EM_KEYBOARD_EVENT) is -- handle key down events -- ESC: go to menu -- q: quit application -- b: back to the previous song -- n: go to the next song -- m: mute / unmute -- c: cheat -- 0,1,2 switch workspaces -- d delete actual part if one clicked otherwise delete all parts from workspace -- r reset workspace -- i show image -- t show / remove title local --scancode: INTEGER --key: ESDL_KEY u: UC_INTERFACE i : INTEGER do --create key.make i := a_keyboard_event.key if i = sdlk_q then -- quit application quit elseif i = sdlk_s then -- stop sound player.stop if player.is_stopped then song_title_to_show.set_value ("") play_pause.set_icon (play_icon) else if song_show then song_title_to_show.set_value (song_title) end play_pause.set_icon (pause_icon) end elseif i = sdlk_escape then -- goto menu event_loop.stop create u u.set_last_scene (Current) next_scene := u if not player.is_paused then player.pause else pause_force := True end elseif i = sdlk_n then -- play next song if possible player.next play_pause.set_icon(pause_icon) elseif i = sdlk_b then -- play previous song if possible player.previous play_pause.set_icon(pause_icon) elseif i = sdlk_p then -- pause / resume player.pause if player.is_paused then song_title_to_show.set_value ("") play_pause.set_icon (play_icon) elseif player.is_stopped then player.play play_pause.set_icon (pause_icon) if song_show then song_title_to_show.set_value (song_title) end else if song_show then song_title_to_show.set_value (song_title) end play_pause.set_icon (pause_icon) end elseif i = sdlk_down then -- turn volume down player.turn_down elseif i = sdlk_up then -- turn volume up player.turn_up elseif i = sdlk_t then if song_show then disable_song_title_showing else if player.is_playing then enable_song_title_showing else song_show := True end end elseif i = sdlk_m then -- set mute player.mute if player.volume = 0 then mute.set_icon (nosound_icon) else mute.set_icon (sound_icon) end -- make buttons also accessible by keyboard elseif i= sdlk_0 then handle_ws_button(puzzle) elseif i= sdlk_1 then handle_ws_button(workspace1) elseif i= sdlk_2 then handle_ws_button(workspace2) elseif i= sdlk_c then handle_cheat elseif i= sdlk_d then handle_trash_button elseif i= sdlk_r then handle_reset_button elseif i= sdlk_i then handle_image_button end end feature {NONE} -- Agents for sound control toggle_stop is -- toggle `player' stop do player.stop if player.is_stopped then song_title_to_show.set_value ("") play_pause.set_icon (play_icon) else if song_show then song_title_to_show.set_value (song_title) end play_pause.set_icon (pause_icon) end end toggle_previous is -- toggle `player' previous do player.previous play_pause.set_icon (pause_icon) end toggle_next is -- toggle `player' next do player.next play_pause.set_icon (pause_icon) end toggle_play_pause is -- toggle `player' play pause do if player.is_stopped then player.stop if song_show then song_title_to_show.set_value (song_title) end play_pause.set_icon (pause_icon) else player.pause if player.is_paused then play_pause.set_icon (play_icon) song_title_to_show.set_value ("") else play_pause.set_icon (pause_icon) if song_show then song_title_to_show.set_value (song_title) end end end end toggle_mute is -- toggle `player' mute do player.mute if player.volume = 0 then mute.set_icon (nosound_icon) else mute.set_icon (sound_icon) end end feature {NONE} -- Sound control play_icon, pause_icon, stop_icon, next_icon, prev_icon, sound_icon, nosound_icon: EM_BITMAP play_pause, stop, next, prev, mute : BUTTON check_next_song is -- checks if next song is played local current_song: STRING do current_song := player.song_title_cut if not (song_title.is_equal (current_song)) then -- set new song_title song_title := current_song if song_show then song_title_to_show.set_value (current_song) end end end enable_song_title_showing is -- enable song title showing do song_title_to_show.set_value (song_title) song_show := True end disable_song_title_showing is -- disable to show the song title do song_title_to_show.set_value ("") song_show := False end song_title: STRING song_title_to_show: EM_STRING -- song_title that is currently showed song_show: BOOLEAN -- intidates whether to show the song init_player_gui is -- create the gui (prev, play/pause, stop, next, mute) local x_coord: INTEGER do bitmap_factory.create_bitmap_from_image ("./image/play.png") check todo_proper_error_handling: bitmap_factory.last_bitmap /= Void end play_icon := bitmap_factory.last_bitmap bitmap_factory.create_bitmap_from_image ("./image/pause.png") check todo_proper_error_handling: bitmap_factory.last_bitmap /= Void end pause_icon := bitmap_factory.last_bitmap bitmap_factory.create_bitmap_from_image ("./image/stop.png") check todo_proper_error_handling: bitmap_factory.last_bitmap /= Void end stop_icon := bitmap_factory.last_bitmap bitmap_factory.create_bitmap_from_image ("./image/prev.png") check todo_proper_error_handling: bitmap_factory.last_bitmap /= Void end prev_icon := bitmap_factory.last_bitmap bitmap_factory.create_bitmap_from_image ("./image/next.png") check todo_proper_error_handling: bitmap_factory.last_bitmap /= Void end next_icon := bitmap_factory.last_bitmap bitmap_factory.create_bitmap_from_image ("./image/sound.png") check todo_proper_error_handling: bitmap_factory.last_bitmap /= Void end sound_icon := bitmap_factory.last_bitmap bitmap_factory.create_bitmap_from_image ("./image/nosound.png") check todo_proper_error_handling: bitmap_factory.last_bitmap /= Void end nosound_icon := bitmap_factory.last_bitmap create play_pause.make_with_icon (pause_icon, event_loop) create stop.make_with_icon (stop_icon, event_loop) create next.make_with_icon (next_icon, event_loop) create prev.make_with_icon (prev_icon, event_loop) create mute.make_with_icon (sound_icon, event_loop) play_pause.toggle_change_color_on_toggle_active mute.toggle_change_color_on_toggle_active main_container.extend (play_pause) main_container.extend (stop) main_container.extend (next) main_container.extend (prev) main_container.extend (mute) x_coord := width - mute.width mute.set_x_y (x_coord, y_coord) x_coord := x_coord - next.width next.set_x_y (x_coord, y_coord) x_coord := x_coord - stop.width stop.set_x_y (x_coord, y_coord) x_coord := x_coord - play_pause.width play_pause.set_x_y (x_coord, y_coord) x_coord := x_coord - prev.width prev.set_x_y (x_coord, y_coord) prev.button_clicked_event.subscribe (agent toggle_previous) play_pause.button_clicked_event.subscribe (agent toggle_play_pause) stop.button_clicked_event.subscribe (agent toggle_stop) next.button_clicked_event.subscribe (agent toggle_next) mute.button_clicked_event.subscribe (agent toggle_mute) end feature -- access initialize_loaded is -- initialize this psw when things are already loaded local border : EM_POLYLINE -- this is the small frame to show the user where the puzzle should go pts_list : LINKED_LIST[EM_VECTOR_2D] -- array of points, needed to initialize the border free_width : INTEGER -- local variable to calculate the free space on left side do create main_container.make make_scene -- set the background background_color := uc_light_color -- cutter is already made, workspaces too, only to_field needs some updating active_space := puzzle image := cutter.last_image image.set_x_y(width-puzzle.image_width-10,10) -- move the puzzle a bit away from the border main_container.extend (active_space) -- and finally put it into the container free_width := width - puzzle.image_width - 30 puzzle.set_parts_in_row (free_width// (puzzle.part_width.max(puzzle.part_height)+10)) workspace1.set_parts_in_row (free_width// (puzzle.part_width.max(puzzle.part_height)+10)) workspace2.set_parts_in_row (free_width// (puzzle.part_width.max(puzzle.part_height)+10)) -- prepare everything to hold the solution to_field.set_x_y(width-puzzle.image_width-10,10) -- create the container where the parts should go if correctly placed main_container.extend (to_field) -- and put it into the container -- draw the border to let the user know where he should place the result create pts_list.make pts_list.extend (create {EM_VECTOR_2D}.make (width-puzzle.image_width-10, 10)) pts_list.extend (create {EM_VECTOR_2D}.make (width-10,10)) pts_list.extend (create {EM_VECTOR_2D}.make (width-10,10+puzzle.image_height)) pts_list.extend (create {EM_VECTOR_2D}.make (width-puzzle.image_width-10,10+puzzle.image_height)) pts_list.extend (create {EM_VECTOR_2D}.make (width-puzzle.image_width-10, 10)) create border.make_from_list (pts_list) border.set_line_color (create {EM_COLOR}.make_black) main_container.extend (border) -- start sound -- player.set_event_loop (event_loop) -- player.play -- player.pause if player.is_empty then create song_title_to_show.make (player.song_title_cut, uc_gui_elements_default_font) song_title_to_show.set_x_y (5, height - song_title_to_show.height - 5) main_container.extend (song_title_to_show) create song_title.make_from_string (player.song_title_cut) event_loop.update_event.subscribe (agent check_next_song) else create song_title_to_show.make (" ", uc_gui_elements_default_font) create song_title.make_empty end -- songs are shown song_show := True end set_from_space (fs: UC_FROM_SPACE) is -- set puzzle to fs require fs_not_Void: fs /= Void do --puzzle.copy (fs) FUNKTIONIERT SO NICHT puzzle := fs end set_to_space (ts: UC_TO_SPACE) is -- set to_field to ts require ts_not_Void: ts /= Void do --to_field.copy (ts) to_field := ts end set_workspaces (workspace_1: UC_WORKSPACE; workspace_2: UC_WORKSPACE) is -- set both workspaces require not_Void: workspace_1 /= Void and workspace_2 /= Void do --workspace1.copy (workspace_1) workspace1 := workspace_1 --workspace2.copy (workspace_2) workspace2 := workspace_2 end set_image_file_name (a_filename: STRING) is -- set image_file_name to a_filename require a_filename_not_Void: a_filename /= Void do create image_file_name.make_from_string (a_filename) end set_number_of_parts (nop: INTEGER) is -- set the number of parts do number_of_parts := nop end feature {MENU} -- menu features -- set_next_scene(ns: EM_SCENE) is -- -- set the next scene -- do -- next_scene := ns -- end restart_event_loop is -- restart the event loop do create event_loop.make_poll end is_initialized: BOOLEAN -- is this puzzle_start_window already initialized? pause_force: BOOLEAN -- true if player.pause is manually set by the user set_initialized (b: BOOLEAN) is -- set is_initialized to b do is_initialized := b end end