コード例 #1
0
        public void LoadTileset(Texture2D texture)
        {
            Tileset         = new Tileset("splittertileset", EditorEngine.Instance.World.TilesetFactory);
            Tileset.Texture = new TileableTexture(texture);

            int xt = texture.Width >> 4;
            int yt = texture.Height >> 4;

            hscrollbar.Maximum = xt << 4;
            vscrollbar.Maximum = yt << 4;

            Tileset.Texture.Columns = texture.Width >> 4;
            Tileset.Texture.Rows    = texture.Height >> 4;

            Tileset.GenerateTiles();

            Random rand = new Random();

            //Reset points
            for (int i = 0; i < points.Length; i++)
            {
                points[i].Clear();
            }

            //Scramble colors
            ScrambleColors();
        }