/// <summary> /// Creates a new GameObject with a default animation/ /// </summary> /// <param name="animation">The default animation. The animation will have its <see cref="Surfaces.AnimatedSurface.Name"/> property changesd to "default".</param> public GameObject(AnimatedSurface animation) { renderer = new Renderers.SurfaceRenderer(); font = animation.Font; animation.Name = "default"; Animation = animation; Animations.Add("default", animation); }
/// <summary> /// Creates a new Scene from an existing <see cref="LayeredSurface"/>. /// </summary> /// <param name="surface">The surface for the scene.</param> /// <param name="renderer">The renderer for the surface.</param> public Scene(ISurface surface, Renderers.ISurfaceRenderer renderer) { Surface = new SurfaceEditor(surface); SurfaceRenderer = renderer; Objects = new List <GameObject>(); Zones = new List <Zone>(); Hotspots = new List <Hotspot>(); }
/// <summary> /// Creates a new GameObject. /// </summary> public GameObject(int width, int height, Font font) { renderer = new Renderers.SurfaceRenderer(); this.font = font; Animation = new AnimatedSurface("default", width, height, Global.FontDefault); animation.CreateFrame(); Animations.Add("default", animation); }
/// <summary> /// Loads scene from a file. /// </summary> /// <param name="file">The source file.</param> /// <param name="surface">The surface for the scene.</param> /// <param name="renderer">The renderer used to draw the surface.</param> /// <returns></returns> public static Scene Load(string file, ISurface surface, Renderers.ISurfaceRenderer renderer) { var scene = (Scene)Serializer.Load <SerializedTypes.SceneSerialized>(file); scene.Surface.TextSurface = surface; scene.SurfaceRenderer = renderer; scene.OnCalculateRenderPosition(); return(scene); }