コード例 #1
0
ファイル: Texture.cs プロジェクト: kukuru3/Sargon
        public void StartLoad()
        {
            if (nativeTexture != null)
            {
                Unload();
            }

            LoadState = LoadStates.Loading;

            try {
                if (IsRenderTex)
                {
                    Path = "";
                    // render textures expect size already set here.
                    nativeTexture = new SFML.Graphics.Texture((uint)Size.X, (uint)Size.Y);
                }
                else
                {
                    nativeTexture = new SFML.Graphics.Texture(Path);
                }
                nativeTexture.Smooth   = true;
                nativeTexture.Repeated = true;
                Size = new Int2((int)nativeTexture.Size.X, (int)nativeTexture.Size.Y);
            } catch (Exception) { // pokemon exception catching :P
                LoadState = LoadStates.Failed;
            }
            LoadState = LoadStates.Active;
        }
コード例 #2
0
ファイル: Texture.cs プロジェクト: kukuru3/Sargon
 internal Texture(int width, int height, Ur.Color color)
 {
     this.Path                = "";
     this.nativeTexture       = null;
     this.nativeRenderTexture = new SFML.Graphics.RenderTexture((uint)width, (uint)height, false);
     this.nativeRenderTexture.Clear(color.ToSFMLColor());
     this.Size   = new Int2(width, height);
     IsRenderTex = true;
     StartLoad();
 }
コード例 #3
0
ファイル: TextureCanvas.cs プロジェクト: kukuru3/Sargon
        public void Resize(int x, int y)
        {
            var newSize = (x, y);

            if (newSize != size)
            {
                size         = newSize;
                doRegenerate = true;
            }
        }
コード例 #4
0
ファイル: Texture.cs プロジェクト: kukuru3/Sargon
 public void Unload()
 {
     LoadState = LoadStates.NotLoaded;
     Size      = new Int2();
 }