indexing description: "[ A panel which displays an EM_GOOF_PHYSICS. ]" date: "$Date$" revision: "$Revision$" class EM_GOOF_PANEL inherit EM_DRAWABLE_PANEL redefine next_frame end EM_TIME_SINGLETON export {NONE} all end create make_from_dimension, make_from_physics, make_from_level_file feature {NONE} -- Initialisation make_from_physics (a_goof_physics: like goof_physics) is -- Initialise panel with `a_goof_physics'. do set_goof_physics (a_goof_physics) ensure goof_physics_set: goof_physics = a_goof_physics end make_from_level_file (a_filename: STRING) is -- Initilaise panel with level loaded from `a_filename'. require a_filename_not_void: a_filename /= Void local loader: EM_GOOF_LOADER_LEVEL_FILE do create loader.make_from_file (a_filename) set_goof_physics (loader.goof_level) end feature -- Access goof_physics: EM_GOOF_PHYSICS -- Physics which is displayed feature -- Element change set_goof_physics (a_goof_physics: like goof_physics) is -- Set `goof_physics' to `a_goof_physics'. do if goof_physics /= Void then container.delete (goof_physics) end goof_physics := a_goof_physics if goof_physics /= Void then container.put_first (goof_physics) end last_process := -1 ensure goof_physics_set: goof_physics = a_goof_physics end load_level_file (a_filename: STRING) is -- Load level from `a_filename'. require a_filename_not_void: a_filename /= Void local loader: EM_GOOF_LOADER_LEVEL_FILE do create loader.make_from_file (a_filename) set_goof_physics (loader.goof_level) end feature -- Miscellaneous next_frame is -- Handle frame change. local now: INTEGER do if last_process = -1 then last_process := time.ticks end now := Time.ticks goof_physics.process ((now-last_process).to_double / 1000) last_process := now set_changed end feature {NONE} -- Implementation last_process: INTEGER -- Last physics processing time end