public void Image(Subtexture subtex, Vector2 position, Color color, bool washed = false) { SetTexture(subtex.Texture); Quad(position + subtex.DrawCoords[0], position + subtex.DrawCoords[1], position + subtex.DrawCoords[2], position + subtex.DrawCoords[3], subtex.TexCoords[0], subtex.TexCoords[1], subtex.TexCoords[2], subtex.TexCoords[3], color, washed); }
public Character(char unicode, Subtexture image, Vector2 offset, float advance) { Unicode = unicode; Image = image; Offset = offset; Advance = advance; }
public void Image(Subtexture subtex, Rect clip, Vector2 position, Vector2 scale, Vector2 origin, float rotation, Color color, bool washed = false) { var(source, frame) = subtex.GetClip(clip); var tex = subtex.Texture; var was = MatrixStack; MatrixStack = Transform2D.CreateMatrix(position, origin, scale, rotation) * MatrixStack; // pos float px0 = -frame.X, px1 = -frame.X + source.Width, py0 = -frame.Y, py1 = -frame.Y + source.Height; // tex-coords float tx0 = 0, tx1 = 0, ty0 = 0, ty1 = 0; if (tex != null) { tx0 = source.MinX / tex.Width; tx1 = source.MaxX / tex.Width; ty0 = source.MinY / tex.Width; ty1 = source.MaxY / tex.Width; } SetTexture(subtex.Texture); Quad( new Vector2(px0, py0), new Vector2(px1, py0), new Vector2(px1, py1), new Vector2(px0, py1), new Vector2(tx0, ty0), new Vector2(tx1, ty0), new Vector2(tx1, ty1), new Vector2(tx0, ty1), color, washed); MatrixStack = was; }
public Atlas(Packer packer, bool premultiply = false) { var output = packer.Pack(); if (output != null) { foreach (var page in output.Pages) { if (premultiply) { page.Premultiply(); } Pages.Add(new Texture(page)); } foreach (var entry in output.Entries.Values) { var texture = Pages[entry.Page]; var subtexture = new Subtexture(texture, entry.Source, entry.Frame); Subtextures.Add(entry.Name, subtexture); } } }
public void Image(Subtexture subtex, Vector2 position, Vector2 scale, Vector2 origin, float rotation, Color color, bool washed = false) { var was = MatrixStack; MatrixStack = Transform2D.CreateMatrix(position, origin, scale, rotation) * MatrixStack; SetTexture(subtex.Texture); Quad( subtex.DrawCoords[0], subtex.DrawCoords[1], subtex.DrawCoords[2], subtex.DrawCoords[3], subtex.TexCoords[0], subtex.TexCoords[1], subtex.TexCoords[2], subtex.TexCoords[3], color, washed); MatrixStack = was; }