AxiosEngine-old 

AxiosEngine-old Mercurial Source Tree


Root/axios/Engine/AxiosEngineFactory.cs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Collections.Generic;
 
namespace Axios.Engine.Factories
{
    public class Texture2DFactory
    {
        public static Texture2D CreateFromList(List<Texture2D> textures, int width, int height)
        {
            if (textures.Count <= 0)
                return (Texture2D)null;
            Texture2D texture2D1 = new Texture2D(textures[0].GraphicsDevice, width, height);
            Color[] data1 = new Color[width * height];
            texture2D1.GetData<Color>(data1);
            Rectangle rectangle = new Rectangle(0, 0, textures[0].Width, textures[0].Height);
            foreach (Texture2D texture2D2 in textures)
            {
                Color[] data2 = new Color[texture2D2.Width * texture2D2.Height];
                texture2D2.GetData<Color>(data2);
                texture2D1.SetData<Color>(0, new Rectangle?(rectangle), data2, 0, texture2D2.Width * texture2D2.Height);
                rectangle.X += texture2D2.Width;
                if (rectangle.X >= width)
                {
                    rectangle.X = 0;
                    rectangle.Y += texture2D2.Height;
                }
            }
            return texture2D1;
        }
    }
}
Source at commit tip created 10 years 1 month ago.
By Nathan Adams, Adding prompt class to generate rounded square for text display

Archive Download this file

Page rendered in 0.91446s using 11 queries.