nodesnim/nodescontrol/texture_rect

It provides a primitive display image.

Types

TextureRectObj = object of ControlRef
  texture*: GLuint
  texture_mode*: TextureMode
  texture_size*: Vector2Obj
  texture_anchor*: AnchorObj
  texture_filter*: ColorRef
TextureRectRef = ref TextureRectObj

Procs

proc TextureRect(name: string = "TextureRect"): TextureRectRef {...}{.raises: [],
    tags: [].}

Creates a new TextureRect.

Arguments:

  • name is a node name.

Example:

var texture = TextureRect("TextureRect")

Methods

method draw(self: TextureRectRef; w, h: GLfloat) {...}{.raises: [GLerror, Exception],
    tags: [RootEffect].}
This uses in the window.nim.
method duplicate(self: TextureRectRef): TextureRectRef {...}{.base, raises: [],
    tags: [].}
Duplicates TextureRect and create a new TextureRect.
method loadTexture(self: TextureRectRef; file: string) {...}{.base,
    raises: [GLerror, ResourceError], tags: [].}

Loads texture from file.

Arguments:

  • file is an image file path.
method setTexture(self: TextureRectRef; gltexture: GlTextureObj) {...}{.base,
    raises: [GLerror], tags: [].}

Changes texture.

Arguments:

  • gltexture is a texture, loaded via load(file, mode=GL_RGB).
method setTextureFilter(self: TextureRectRef; color: ColorRef) {...}{.base,
    raises: [], tags: [].}
Changes texture filter color.
method setTextureAnchor(self: TextureRectRef; anchor: AnchorObj) {...}{.base,
    raises: [], tags: [].}
Changes texture anchor.
method setTextureAnchor(self: TextureRectRef; x1, y1, x2, y2: float) {...}{.base,
    raises: [], tags: [].}

Changes texture anchor.

ARguments:

  • x1 and y1 is an anchor relative to TextureRect size.
  • x2 and y2 is an anchor relative to texture size.