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; }
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(); }
public void Resize(int x, int y) { var newSize = (x, y); if (newSize != size) { size = newSize; doRegenerate = true; } }
public void Unload() { LoadState = LoadStates.NotLoaded; Size = new Int2(); }