Example #1
0
        public GameTexture CreateTexture(string key, string path)
        {
            lock (locker)
            {
                if (textures.ContainsKey(key))
                {
                    return(textures[key]);
                }

                try
                {
                    D3D9.ImageInformation info = new D3D9.ImageInformation();

                    D3D9.Texture d3d9Texture = D3D9.Texture.FromFile(d3d9Device, path, D3D9.D3DX.DefaultNonPowerOf2, D3D9.D3DX.DefaultNonPowerOf2, 0,
                                                                     D3D9.Usage.None, D3D9.Format.Unknown, D3D9.Pool.Managed, D3D9.Filter.None, D3D9.Filter.None, 0, out info);

                    GameTexture texture = new GameTexture(d3d9Texture, info);

                    textures.Add(key, texture);
                    return(texture);
                }
                catch (SharpDXException)
                {
                    MessageBox.Show($"이미지 로딩에 실패했습니다. \n {path} 경로를 다시 확인해주세요.", "Texture Load Failed");
                    return(null);
                }
            }
        }
Example #2
0
 public GameTexture(D3D9.Texture texture, D3D9.ImageInformation info)
 {
     Texture = texture;
     Info    = info;
 }