public void AddSprite(Sprite sprite, Vector2 position, Vector2i size, string layer, Color4ub? color = null) { var ro = new RenderObject() { Sprite = sprite, Position = new Vector2[] { position }, Size = size, Color = color.HasValue ? color.Value : new Color4ub(255, 255, 255, 255) }; m_renderObjects[GetLayerId(layer)].Add(ro); }
public Sprite AddSprite(string name, Box2i coordinates) { var tw = (float)Texture.Size.X; var th = (float)Texture.Size.Y; var sprite = new Sprite( this, name, coordinates.Size, new Box2( coordinates.Position.X / tw, coordinates.Position.Y / th, coordinates.Size.X / tw, coordinates.Size.Y / th )); m_sprites.Add(sprite.Name, sprite); return sprite; }