public HWSurfaceInstance(ScriptEngine parent, string filename) : base(parent.Object.InstancePrototype) { using (Texture tex = new Texture(filename)) { _width = tex.Size.X; _height = tex.Size.Y; _tex = new RenderTexture(_width, _height); _myBatch = new SpriteBatch(_tex); _myBatch.SetBlendMode(BlendMode.None); _myBatch.Add(tex, 0, 0); _myBatch.Flush(); Update(); } Init(); }
public void DrawText(SpriteBatch batch, double x, double y, string text) { CheckUpdate(); FloatRect dest = new FloatRect((float)x, (float)y, 0, (float)_height); for (var i = 0; i < text.Length; ++i) { IntRect src = _atlas.Sources[text[i]]; dest.Width = src.Width; dest.Height = src.Height; batch.Add(_atlas.Texture, src, dest, _color); dest.Left += src.Width; } }