Texture Functions

1.Quick Glance

Texture Functions are used to get data on a texture, render it under certain conditions or more. As of Version 1.1x all Texture related functions’ scope are under the main GPE engine class.

 

2.Texture Functions

ImageObject GPE.get_texture_object( int textureId )

Retrieves the HTML5 Image object assigned to a texture. Although, usage of this function will be rare. Feel free to checkout all of the interesting properties and meta data of an image object here.

Scope: GPE

Return type : ImageObject

Parameters:

  • int textureId – an integer of a texture(aka tex_grass). If undefined, null or non-number based this function returns IS_NULL.

 

int GPE.get_texture_width( int textureId )

Returns the width of a GPE texture resource.

Scope: GPE

Return type : int

Parameters:

  • int textureId – an integer of a texture(aka tex_grass). If undefined, null or non-number based this function returns 0.

 

int  GPE.get_texture_height( int textureId )

Returns the height of a GPE texture resource.

Scope: GPE

Return type : ImageObject

Parameters:

  • int textureId – an interger of a texture(aka tex_grass). If undefined, null or non-number based this function returns 0.

 

int  GPE.render_texture( int texureIdIn, int  xDraw, int yDraw)

Renders a given texture at (xDraw, yDraw)

Scope: GPE

Return type : void

Parameters:

  • int textureId – an interger of a texture(aka tex_grass). If undefined, null or non-number based this function this function does nothing.
  • int xDraw – The x-coordinate of where to draw the texture on the screen relative to the game’s camera.
  • int yDraw – The x-coordinate of where to draw the texture on the screen relative to the game’s camera.

 

int  GPE.render_texture_scaled( int texureIdIn,  int xDraw,  int yDraw,  int width, int height)

Renders a given texture at (xDraw, yDraw) scaled to a new width and height

Scope: GPE

Return type : void

Parameters:

  • int textureId – an interger of a texture(aka tex_grass). If undefined, null or non-number based this function this function does nothing.
  • xDraw – The x-coordinate of where to draw the texture on the screen relative to the game’s camera.
  • yDraw – The x-coordinate of where to draw the texture on the screen relative to the game’s camera.
  • width – the new width to resize the texture to on render.
  • height – the new height to resize the texture to on render.

 

int  GPE.render_texture_clipped(int texureIdIn,  int xDraw, int yDraw,  GPERect clipBox)

Renders a given texture at (xDraw, yDraw)

Scope: GPE

Return type : void

Parameters:

  • int textureId – an interger of a texture(aka tex_grass). If undefined, null or non-number based this function this function does nothing.
  • int xDraw – The x-coordinate of where to draw the texture on the screen relative to the game’s camera.int
  • int yDraw – The x-coordinate of where to draw the texture on the screen relative to the game’s camera.
  • GPERect clipBox – a GPE Rectangle of where to draw only  a section of the texture(similar to drawing a sprite frame or a tile from a tilesheet image).

Suggest Edit