Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
 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();
 }
Exemplo n.º 3
0
        public void Resize(int x, int y)
        {
            var newSize = (x, y);

            if (newSize != size)
            {
                size         = newSize;
                doRegenerate = true;
            }
        }
Exemplo n.º 4
0
 public void Unload()
 {
     LoadState = LoadStates.NotLoaded;
     Size      = new Int2();
 }