/// <summary> /// Begin rendering to the texture. /// </summary> public static void BeginTexture(Texture tex) { EndUse(); NewStack(); targetStack.Push(tex); Use(); }
public override void Render() { if (tex == null || tex.Width != Draw.Width || tex.Height != Draw.Height) tex = new Texture(Draw.Width, Draw.Height); Draw.BeginTexture(tex); base.Render(); Draw.EndTexture(); tex.RemoveAlpha(); Draw.Save(); Draw.Scale(2); Draw.Align(0.5, 0.5); tex.Render(); if (back != null) { Draw.Color(1, 1, 1, t); back.Render(); } Draw.Load(); var cam = new Camera(20); Draw.Save(); cam.Apply(); Draw.Translate(cam.FromWH(Mouse.Position, Draw.Width, Draw.Height)); Draw.Align(0.5, 0.5); cursor.Render(); Draw.Load(); }
public override void Render() { var tex = new Texture(Draw.Width, Draw.Height); Draw.BeginTexture(tex); world.Render(); Draw.EndTexture(); Draw.Save(); Draw.Scale(2); Draw.Align(0.5, 0.5); //Draw.Color(0.5, 0.5, 0.5); tex.Render(); Draw.Color(1, 1, 1, 0.5); Draw.Quad(); Draw.Load(); base.Render(); Draw.Save(); new Camera(10).Apply(); buttons.Render(); Draw.Translate(new Vec2(0, 2) + Vec2.Rotate(Vec2.OrtX, App.Time) / 10); Draw.Scale(8, 1.5); Draw.Align(0.5, 0); logo.Render(); Draw.Load(); }
public AnimatedTexture Add(Texture tex, double time) { Textures.Add(new Tuple<Texture, double>(tex, time)); CurrentTexture = Textures.GetEnumerator(); CurrentTexture.MoveNext(); TotalTime += time; return this; }
public Texture MakeTexture(string text) { var size = helpGfx.MeasureString(text, Font).ToSize(); var bitmap = new Bitmap(size.Width, size.Height); var gfx = Graphics.FromImage(bitmap); gfx.Clear(System.Drawing.Color.FromArgb(0, 0xff, 0xff, 0xff)); gfx.TextRenderingHint = Smooth ? System.Drawing.Text.TextRenderingHint.AntiAlias : System.Drawing.Text.TextRenderingHint.SingleBitPerPixel; gfx.DrawString(text, Font, Brushes.White, 0, 0); var tex = new Texture(1, 1, Smooth); tex.Set(bitmap); return tex; }
public Texture Copy() { var tex = new Texture(this.Smooth); tex.Set(this.ToBitmap()); return tex; }
public AnimatedTexture(Texture tex) { Textures.Add(new Tuple<Texture, double>(tex, 0)); CurrentTexture = Textures.GetEnumerator(); CurrentTexture.MoveNext(); }
/// <summary> /// Set a uniform texture variable. /// </summary> /// <param name="name">Variable name.</param> /// <param name="texture">Texture value.</param> public void SetTexture(string name, Texture texture) { uniforms[Loc(name)] = new UniformTexture { tex = texture.tex }; }
static Misc() { UnknownTexture = new Texture(Resource.Stream("Misc/unknown_texture.png")); UnknownTexture.Wrap = Texture.WrapMode.Repeat; }
public TexturePart(Texture baseTexture, Vec2 origin, Vec2 size) { Base = baseTexture; Origin = origin; Size = size; }
public TexturePart(Texture baseTexture, double x, double y, double sx, double sy) : this(baseTexture, new Vec2(x, y), new Vec2(sx, sy)) { }