Exemple #1
0
        public FramedTexture(string tileset, Frame frame)
            : base(GeneralTextureManager.GetTexture(tileset))
        {
            this.frame = frame;

            this.tilesetSprite = new Sprite(this);
            this.tilesetSprite.TextureRect = frame.FrameRect;
        }
        private static void LoadTexture(string line)
        {
            string source = "FTM.LoadTexture()";
            string[] parts = line.Replace("ftexture:", "").Split(',');

            int x = ExceptionHelper.AssertIsInteger(parts[X], source);
            int y = ExceptionHelper.AssertIsInteger(parts[Y], source);
            int width = ExceptionHelper.AssertIsInteger(parts[HEIGHT], source);
            int height = ExceptionHelper.AssertIsInteger(parts[WIDTH], source);
            string name = parts[NAME];
            string tileset = parts[TILESET];

            Frame frame = new Frame(-1, -1, new SFML.Graphics.IntRect(x, y, width, height));

            AddTexture(name, tileset, frame);
        }
 public static void AddTexture(string name, string tileset, Frame frame)
 {
     ExceptionHelper.AssertIsNotInDictionary<FramedTexture>(textures, name, "FramedTextureManager.AddTexture()");
     textures.Add(name, new FramedTexture(tileset, frame));
 }