public override void _Ready() { sprite = new Sprite(); image = new Image(); texture = new ImageTexture(); noise = new OpenSimplexNoise() { Octaves = Octaves }; var viewportSize = GetViewportRect().Size; imageSize = viewportSize / Factor; imageSize = new Vector2((int)imageSize.x, (int)imageSize.y); image.Create((int)imageSize.x, (int)imageSize.y, false, Image.Format.Rgba8); // Generate GenerateNoiseTexture(); // Create texture texture.CreateFromImage(image); // Prepare sprite sprite.Texture = texture; sprite.Position = viewportSize / 2; sprite.Scale = new Vector2(Factor, Factor); AddChild(sprite); }
/** * Construct a new Surface from the given image resource */ public Surface(string Resourcepath) { texture = TextureManager.Get(Resourcepath); texture.Ref(); width = texture.ImageWidth; height = texture.ImageHeight; Left = 0; Top = 0; Right = texture.UVRight; Bottom = texture.UVBottom; }
/// <summary>Construct a new Surface from the given image resource</summary> public Surface(string Resourcepath) { texture = TextureManager.Get(Resourcepath); texture.Ref(); width = texture.ImageWidth; height = texture.ImageHeight; Left = 0; Top = 0; Right = texture.UVRight; Bottom = texture.UVBottom; }
public Surface(Surface other) { texture = other.texture; texture.Ref(); width = other.width; height = other.height; Left = other.Left; Top = other.Top; Right = other.Right; Bottom = other.Bottom; }
public Surface(string Resourcepath, float x, float y, float w, float h) { texture = TextureManager.Get(Resourcepath); texture.Ref(); width = w; height = h; Left = x / texture.Width; Top = y / texture.Height; Right = (x+w) / texture.Width; Bottom = (y+h) / texture.Height; }
public Surface(string Resourcepath, float x, float y, float w, float h) { texture = TextureManager.Get(Resourcepath); texture.Ref(); width = w; height = h; Left = x / texture.Width; Top = y / texture.Height; Right = (x + w) / texture.Width; Bottom = (y + h) / texture.Height; }
public void Dispose() { texture.UnRef(); texture = null; }