indexing description: "[ Deferred Highscore class ]" date: "$Date$" revision: "$Revision$" deferred class BB_HIGHSCORE inherit BB_MENU BB_SHARED_HIGHSCORE feature -- Initialization add_highscore_list is -- add highscore list widgets require highscore_list /= Void local a_label: EM_LABEL i: INTEGER do create a_label.make_from_text ("Rank") a_label.set_font (highscore_font_bold) a_label.set_position (rank_x_end - highscore_font.string_width ("Rank"), title_y) a_label.resize_to_optimal_dimension add_widget (a_label) create a_label.make_from_text ("Name") a_label.set_font (highscore_font_bold) a_label.set_position (name_x, title_y) a_label.resize_to_optimal_dimension add_widget (a_label) create a_label.make_from_text ("Score") a_label.set_font (highscore_font_bold) a_label.set_position (score_x_end - highscore_font.string_width ("Score"), title_y) a_label.resize_to_optimal_dimension add_widget (a_label) create a_label.make_from_text ("Difficulty") a_label.set_font (highscore_font_bold) a_label.set_position (difficulty_x, title_y) a_label.resize_to_optimal_dimension add_widget (a_label) from highscore_list.start i := 1 until i > number_of_entries or highscore_list.after loop create a_label.make_from_text (i.out + ".") a_label.set_font (highscore_font) a_label.set_position (rank_x_end - highscore_font.string_width (i.out + "."), title_y + i * line_spacing) a_label.resize_to_optimal_dimension add_widget (a_label) create a_label.make_from_text (highscore_list.item_for_iteration.name) a_label.set_font (highscore_font) a_label.set_position (name_x, title_y + i * line_spacing) a_label.resize_to_optimal_dimension add_widget (a_label) create a_label.make_from_text (highscore_list.item_for_iteration.score.out) a_label.set_font (highscore_font) a_label.set_position (score_x_end - highscore_font.string_width (highscore_list.item_for_iteration.score.out), title_y + i * line_spacing) a_label.resize_to_optimal_dimension add_widget (a_label) create a_label.make_from_text (highscore_list.item_for_iteration.item ("difficulty")) a_label.set_font (highscore_font) a_label.set_position (difficulty_x, title_y + i * line_spacing) a_label.resize_to_optimal_dimension add_widget (a_label) highscore_list.forth i := i + 1 end end feature -- Events back_button_pressed is -- back button pressed do set_next_scene (create {BB_MAINMENU}.make) start_next_scene end feature -- Attrbutes highscore_list: DS_LINKED_LIST [EM_HIGHSCORE_ENTRY] -- highscore list feature {NONE} -- Implementation Line_spacing: INTEGER is 30 -- distance between 2 entries Rank_x_end: INTEGER is 200 -- x coordinate of the rank's right end Name_x: INTEGER is 220 -- x coordinate of name Score_x_end: INTEGER is 500 -- x coordinate of scores right end Difficulty_x: INTEGER is 520 -- x coordinate of difficulty Title_y: INTEGER is 175 -- y coordinate of column titles Number_of_entries: INTEGER is 10 -- number of highscore entries Highscore_font: EM_COLOR_TTF_FONT is -- font for highscore entries once create Result.make_from_ttf_font (standard_ttf_fonts.bitstream_vera_sans (20)) Result.set_color (create {EM_COLOR}.make_white) ensure Result /= Void end Highscore_font_bold: EM_COLOR_TTF_FONT is -- font for highscore entries once create Result.make_from_ttf_font (standard_ttf_fonts.bitstream_vera_sans_bold (20)) Result.set_color (create {EM_COLOR}.make_white) ensure Result /= Void end end