indexing description: "[ Game finished screen ]" date: "$Date$" revision: "$Revision$" class BB_GAME_FINISHED inherit BB_MENU EM_SHARED_SUBSYSTEMS export {NONE} all end create make feature -- Initialization make (a_score: INTEGER; a_level_set: STRING) is -- create game over screen require a_level_set /= Void local menu_button: BB_MENU_BUTTON a_label: EM_LABEL subtitle_y: INTEGER do init_menu score := a_score level_set := a_level_set.out video_subsystem.show_cursor stop_sound (Sound_invulnerable) play_music ("./bgm/menu.ogg") -- create congratulation label create a_label.make_from_text ("Congratulation") a_label.set_font (create {EM_TTF_FONT}.make_from_ttf_file ("./fonts/moo.ttf", 60)) a_label.set_foreground_color (create {EM_COLOR}.make_white) a_label.resize_to_optimal_dimension a_label.set_position (bb_window_width // 2 - a_label.width // 2, 200) add_widget(a_label) subtitle_y := a_label.y + a_label.height + 30 -- create "subtitle" if bb_settings.difficulty.is_equal ("Foolproof") then create a_label.make_from_text ("You did it on foolproof. But are you really a fool?") elseif bb_settings.difficulty.is_equal ("Easy") then create a_label.make_from_text ("Easy... well... that's not much. Try it on normal") elseif bb_settings.difficulty.is_equal ("Normal") then create a_label.make_from_text ("That was not bad, but it wasn't good either. Can you do it on hard too?") elseif bb_settings.difficulty.is_equal ("Hard") then create a_label.make_from_text ("Wow! You finished the game on hard. How good are you really? Are you insane?") elseif bb_settings.difficulty.is_equal ("Insane") then create a_label.make_from_text ("Either you cheated in some way, or you are a Brick Breaker god!") else create a_label.make_from_text ("Something is not really correct, but you finished the game") end a_label.set_font (standard_ttf_fonts.bitstream_vera_sans (20)) a_label.set_foreground_color (create {EM_COLOR}.make_white) a_label.resize_to_optimal_dimension a_label.set_position (bb_window_width // 2 - a_label.width // 2, subtitle_y) add_widget (a_label) create menu_button.make ("Ok") menu_button.set_position (bb_window_width // 2 - menu_button.width // 2, 450) menu_button.pressed_event.subscribe (agent back_button_pressed) add_button (menu_button) set_selected_menu_item (1) end feature -- Events back_button_pressed is -- Handle keyboard events do if level_set.is_equal ("original") then set_next_scene (create {BB_LOCAL_HIGHSCORE}.make_with_new_entry (score)) else set_next_scene (create {BB_SINGLEPLAYER}.make) end start_next_scene end feature {NONE} -- Implementation score: INTEGER -- score which was reached level_set: STRING -- level set which was used end