indexing description: "user choose if play a game with his own parameters or a fixed modus game" author: "Markus Neidhart and UC Team" date: "$Date$" revision: "$Revision$" class SELECT_GAME inherit MENU redefine initialize_scene end feature -- Initialize initialize_scene is -- Initialize the scene local bitmap: EM_BITMAP title: EM_STRING i,y: INTEGER do Precursor -- Build the menu entries create menu_entries.make (1, 3) menu_entries.put (create {EM_STRING}.make ("Pre-defined", normal_font), 1) menu_entries.put (create {EM_STRING}.make ("User-defined", normal_font), 2) menu_entries.put (create {EM_STRING}.make ("Back", normal_font), 3) y := 350 from i := 1 until i > menu_entries.count loop menu_entries.item (i).set_x_y (512 - menu_entries.item (i).width // 2, y) y := y + menu_entries.item (i).height i := i + 1 end -- Build the background bitmap_factory.create_empty_bitmap (width, height) check todo_proper_error_handling: bitmap_factory.last_bitmap /= Void end bitmap := bitmap_factory.last_bitmap bitmap.fill (uc_background_color) bitmap.set_x_y (1, 1) scene.extend (bitmap) -- Build the title create title.make ("Choose your puzzle!", normal_font) scene.extend (title) title.set_x_y ((width - title.width) // 2, 10) selected_nr := 1 menu_entries.item (selected_nr).set_font (select_font) add_menu_entries_to_scene end feature {NONE} -- Event handler on_select is -- Set the `next_scene' according to `selected_nr' here local menu: MENU n: NEW_GAME pg: PREDEFINED_GAME do if selected_nr = 1 then -- predefined mode create pg pg.set_last_scene (Current) next_scene := pg elseif selected_nr = 2 then -- user-defined mode create n n.set_last_scene (Current) next_scene := n elseif selected_nr = 3 then -- Back menu ?= last_scene menu.set_next_scene (Void) menu.restart_event_loop menu.empty_main_container next_scene := menu end end end -- class SELECT_GAME