indexing description: "[ EM_GOOF_OBJECT is the root object for EM_GOOF. ]" date: "$Date$" revision: "$Revision$" class EM_GOOF_OBJECT create make feature -- Initialization premake is -- Premake 'rotatable' -- Must be followed by a real 'make' (or 'make_multiple_picture' in case of rotatable) do premade := true end make(img: EM_BITMAP x: DOUBLE y: DOUBLE phs: EM_GOOF_PHYSICS) is -- Make goof_object require image_not_void: img /= void phs_not_void: phs /= void do image := img physics := phs create position.make(x,y) visible := true create image_position.make(-image.width/2,-image.height/2) premade := false end feature {EM_GOOF_LEVEL_SCENE, EM_GOOF_OBJECT, EM_GOOF_PHYSICS, EM_GOOF_FORCE, EM_GOOF_LOADER_NODE_PROCESSOR} -- Properties physics: EM_GOOF_PHYSICS -- Physics 'parent' image: EM_BITMAP -- Image of this object visible: BOOLEAN -- Is this object visible? position: EM_VECTOR_2D -- Current position image_position: EM_VECTOR_2D -- Image positiion correcture (typically= -height/2, -width/2) feature -- Properties -- Needs added visibility because it is used in preconditions of redefined features (in descendants). -- Cannot redefine attribute in descendants because repeated inheritance doesn't work with attributes. premade: BOOLEAN -- Is this 'object' premade and not yet really made feature {EM_GOOF_OBJECT, EM_GOOF_PHYSICS} -- Processing process(time_length: DOUBLE) is -- Process this object require not_premade: not premade do -- Nothing todo as this object is static end feature {EM_GOOF_OBJECT, EM_GOOF_PHYSICS} -- Drawing draw(screen: EM_VIDEO_SURFACE at: EM_VECTOR_2D at_angle: DOUBLE) is -- Draw object require not_premade: not premade is_screen: screen /= void local pos_copy: EM_VECTOR_2D do pos_copy := position.rotation(position.zero, at_angle) image.set_x_y((pos_copy.x+at.x+image_position.x).rounded, (pos_copy.y+at.y+image_position.y).rounded) screen.draw_object(image) end invariant has_image: premade or image /= void has_position: premade or position /= void end