public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache, Layer layer) { base.load(gameScreen, ref cache, layer); if (gameScreen.LoadRectangleItem(this)) { _body = BodyFactory.CreateRectangle(gameScreen.World, ConvertUnits.ToSimUnits(Width), ConvertUnits.ToSimUnits(Height), 1f); _body.Position = ConvertUnits.ToSimUnits(Position) + new Vector2(ConvertUnits.ToSimUnits(Width) / 2, ConvertUnits.ToSimUnits(Height) / 2); _body.UserData = this; } }
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache, Layer layer) { base.load(gameScreen, ref cache, layer); if (gameScreen.LoadCircleItem(this)) { _body = BodyFactory.CreateCircle(gameScreen.World, Radius, 1f); _body.Position = ConvertUnits.ToSimUnits(Position); _body.UserData = this; } }
public override void load(AxiosGameScreen gameScreen) { base.load(gameScreen); Vertices v = new Vertices(LayerItem.LocalPoints.Count); foreach (Vector2 vec in LayerItem.LocalPoints) v.Add(new Vector2(ConvertUnits.ToSimUnits(vec.X), ConvertUnits.ToSimUnits(vec.Y))); _body = BodyFactory.CreateLoopShape(gameScreen.World, v); _body.Position = ConvertUnits.ToSimUnits(this.LayerItem.Position); _body.UserData = this; }
/// <summary> /// Called by Level.FromFile(filename) on each Item after the deserialization process. /// Loads all assets needed by the TextureItem, especially the Texture2D. /// You must provide your own implementation. However, you can rely on all public fields being /// filled by the level deserialization process. /// </summary> public override void load(AxiosGameScreen gameScreen) { base.load(gameScreen); //throw new NotImplementedException(); //TODO: provide your own implementation of how a TextureItem loads its assets //for example: //this.texture = Texture2D.FromFile(<GraphicsDevice>, texture_filename); //or by using the Content Pipeline: /*if (!cache.ContainsKey(LayerItem.AssetName)) { cache[LayerItem.AssetName] = gameScreen.ScreenManager.Game.Content.Load<Texture2D>(LayerItem.AssetName); }*/ this.texture = gameScreen.ScreenManager.Game.Content.Load<Texture2D>(LayerItem.AssetName); //Visible = gameScreen.LoadTextureItem(this); //this.texture = cm.Load<Texture2D>(asset_name); }
public static Level FromFile(string filename, AxiosGameScreen gameScreen) { Dictionary<string, Texture2D> cache = new Dictionary<string, Texture2D>(); FileStream stream = System.IO.File.Open(filename, FileMode.Open); XmlSerializer serializer = new XmlSerializer(typeof(Level)); Level level = (Level)serializer.Deserialize(stream); stream.Close(); foreach (Layer layer in level.Layers) { foreach (Item item in layer.Items) { item.CustomProperties.RestoreItemAssociations(level); item.load(gameScreen, ref cache, layer); } } return level; }
public override void OnMouseUp(AxiosGameScreen gameScreen, InputState input) { base.OnMouseUp(gameScreen, input); this.Texture = _hovertexture; }
public override void OnMouseLeave(AxiosGameScreen gameScreen, InputState input) { base.OnMouseLeave(gameScreen, input); this.Texture = _normaltexture; }
public override void OnMouseDown(AxiosGameScreen gameScreen, InputState input) { base.OnMouseDown(gameScreen, input); this.Texture = _clicktexture; }
public override void LoadContent(AxiosGameScreen gameScreen) { base.LoadContent(gameScreen); }
public override void HandleCursor(AxiosGameScreen gameScreen, InputState input) { base.HandleCursor(gameScreen, input); }
/// <summary> /// Called by Level.FromFile(filename) on each Item after the deserialization process. /// Should be overriden and can be used to load anything needed by the Item (e.g. a texture). /// </summary> public virtual void load(AxiosGameScreen gameScreen) { }