indexing description: "[ Options Menu ]" date: "$Date$" revision: "$Revision$" class BB_OPTIONS inherit BB_MENU redefine start_next_scene end SHARED_BB_SETTINGS EM_SHARED_SUBSYSTEMS export {NONE} all end BB_SHARED_AUDIO export {NONE} all end create make feature -- Initialization make is -- create widgets local button: BB_MENU_BUTTON a_label: EM_LABEL do init_menu bb_settings.create_all_widgets -- create menu items create button.make ("OK") button.set_position (300, 500) button.pressed_event.subscribe (agent ok_button_pressed) add_button (button) create button.make ("Cancel") button.set_position (450,500) button.pressed_event.subscribe (agent back_button_pressed) add_button (button) -- create sfx volume sliding bar bb_settings.widget_sfx_volume.set_position (400, 185) bb_settings.widget_sfx_volume.set_dimension (200, 50) add_widget (bb_settings.widget_sfx_volume) create sfx_volume_label.make_from_text ("Effect Volume") sfx_volume_label.set_font (Standard_ttf_fonts.bitstream_vera_sans_bold (20)) sfx_volume_label.set_foreground_color (create {EM_COLOR}.make_white) sfx_volume_label.set_position (200, 200) sfx_volume_label.set_dimension (200, 20) add_widget (sfx_volume_label) -- create music volume sliding bar bb_settings.widget_music_volume.set_position (400, 235) bb_settings.widget_music_volume.set_dimension (200, 50) add_widget (bb_settings.widget_music_volume) create music_volume_label.make_from_text ("Music Volume") music_volume_label.set_font (Standard_ttf_fonts.bitstream_vera_sans_bold (20)) music_volume_label.set_foreground_color (create {EM_COLOR}.make_white) music_volume_label.set_position (200, 250) music_volume_label.set_dimension (200, 20) add_widget (music_volume_label) -- create difficulty selection bb_settings.widget_difficulty.set_position (400, 300) bb_settings.widget_difficulty.set_dimension (200, 20) add_widget (bb_settings.widget_difficulty) create difficulty_label.make_from_text ("Difficulty") difficulty_label.set_font (Standard_ttf_fonts.bitstream_vera_sans_bold (20)) difficulty_label.set_foreground_color (create {EM_COLOR}.make_white) difficulty_label.set_position (200, 300) difficulty_label.set_dimension (200, 20) add_widget (difficulty_label) -- create fullscreen selection bb_settings.widget_fullscreen.set_position (400, 350) bb_settings.widget_fullscreen.set_dimension (200, 20) add_widget (bb_settings.widget_fullscreen) create fullscreen_label.make_from_text ("Fullscreen") fullscreen_label.set_font (Standard_ttf_fonts.bitstream_vera_sans_bold (20)) fullscreen_label.set_foreground_color (create {EM_COLOR}.make_white) fullscreen_label.set_position (200, 350) fullscreen_label.set_dimension (200, 20) add_widget (fullscreen_label) create a_label.make_from_text ("(game restart necessary)") a_label.set_font (Standard_ttf_fonts.bitstream_vera_sans (16)) a_label.set_foreground_color (create {EM_COLOR}.make_white) a_label.set_position (450, 350) a_label.resize_to_optimal_dimension add_widget (a_label) -- create device selection bb_settings.widget_device.set_position (400, 400) bb_settings.widget_device.set_dimension (200, 20) add_widget (bb_settings.widget_device) create input_device_label.make_from_text ("Input Device") input_device_label.set_font (Standard_ttf_fonts.bitstream_vera_sans_bold (20)) input_device_label.set_foreground_color (create {EM_COLOR}.make_white) input_device_label.set_position (200, 400) input_device_label.set_dimension (200, 20) add_widget (input_device_label) end start_next_scene is -- free all widgets and switch to the next scene do bb_settings.free_all_widgets Precursor end feature -- Events ok_button_pressed is -- ok button pressed do bb_settings.apply_all_settings bb_settings.write_user_settings sound_player.set_volume (bb_settings.sfx_volume) music_player.set_volume (bb_settings.music_volume) set_next_scene (create {BB_MAINMENU}.make) start_next_scene end back_button_pressed is -- back button pressed do set_next_scene (create {BB_MAINMENU}.make) start_next_scene end feature {NONE} -- Implementation difficulty_label: EM_LABEL input_device_label: EM_LABEL fullscreen_label: EM_LABEL sfx_volume_label: EM_LABEL music_volume_label: EM_LABEL end