Exemple #1
0
 /// <summary>
 /// Begin rendering to the texture.
 /// </summary>
 public static void BeginTexture(Texture tex)
 {
     EndUse();
     NewStack();
     targetStack.Push(tex);
     Use();
 }
Exemple #2
0
        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();
        }
Exemple #3
0
        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();
        }
Exemple #4
0
 public AnimatedTexture Add(Texture tex, double time)
 {
     Textures.Add(new Tuple<Texture, double>(tex, time));
     CurrentTexture = Textures.GetEnumerator();
     CurrentTexture.MoveNext();
     TotalTime += time;
     return this;
 }
Exemple #5
0
 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;
 }
Exemple #6
0
 public Texture Copy()
 {
     var tex = new Texture(this.Smooth);
     tex.Set(this.ToBitmap());
     return tex;
 }
Exemple #7
0
 public AnimatedTexture(Texture tex)
 {
     Textures.Add(new Tuple<Texture, double>(tex, 0));
     CurrentTexture = Textures.GetEnumerator();
     CurrentTexture.MoveNext();
 }
Exemple #8
0
 /// <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 };
 }
Exemple #9
0
 static Misc()
 {
     UnknownTexture = new Texture(Resource.Stream("Misc/unknown_texture.png"));
     UnknownTexture.Wrap = Texture.WrapMode.Repeat;
 }
Exemple #10
0
 public TexturePart(Texture baseTexture, Vec2 origin, Vec2 size)
 {
     Base = baseTexture;
     Origin = origin;
     Size = size;
 }
Exemple #11
0
 public TexturePart(Texture baseTexture, double x, double y, double sx, double sy)
     : this(baseTexture, new Vec2(x, y), new Vec2(sx, sy))
 {
 }