Module GraphicFuncs

Global graphics functions.

Tables

LuaImageResource The LuaImageResource refers to a PGE Engine specific type, consisting of the data of a loaded image file as OpenGL texture.

Loading of image files

Graphics.loadImage (filename) Loads a texture into the memory from image file.

Drawing on screen

Graphics.drawImage (texture, xPos, yPos) Draws the texture for a frame.
Graphics.drawImage (texture, xPos, yPos, opacity) Draws the texture for a frame, with an opacity from 0.0 to 1.0.
Graphics.drawImage (texture, xPos, yPos, sourceX, sourceY, width, height) Draws a part of the texture for a frame.
Graphics.drawImage (texture, xPos, yPos, sourceX, sourceY, width, height, opacity) Draws a part of the texture for a frame, with an opacity from 0.0 to 1.0.

Drawing on screen with prioritizing

Graphics.drawImageWP (texture, xPos, yPos, zValue) Draws the texture for a frame with prioritizing.
Graphics.drawImageWP (texture, xPos, yPos, opacity, zValue) Draws the texture for a frame with prioritizing, with an opacity from 0.0 to 1.0.
Graphics.drawImageWP (texture, xPos, yPos, sourceX, sourceY, width, height, zValue) Draws a part of the texture for a frame with prioritizing.
Graphics.drawImageWP (texture, xPos, yPos, sourceX, sourceY, width, height, opacity, zValue) Draws a part of the texture for a frame with prioritizing, with an opacity from 0.0 to 1.0.

Drawing on scene

Graphics.drawImageToScene (texture, xPos, yPos) Draws the texture for a frame by scene world coordinates.
Graphics.drawImageToScene (texture, xPos, yPos, opacity) Draws the texture for a frame by scene world coordinates, with an opacity from 0.0 to 1.0.
Graphics.drawImageToScene (texture, xPos, yPos, sourceX, sourceY, width, height) Draws a part of the texture for a frame by scene world coordinates.
Graphics.drawImageToScene (texture, xPos, yPos, sourceX, sourceY, width, height, opacity) Draws a part of the texture for a frame by scene world coordinates, with an opacity from 0.0 to 1.0.

Drawing on scene with prioritizing

Graphics.drawImageToSceneWP (texture, xPos, yPos, zValue) Draws the texture for a frame by scene world coordinates with prioritizing.
Graphics.drawImageToSceneWP (texture, xPos, yPos, opacity, zValue) Draws the texture for a frame by scene world coordinates with prioritizing, with an opacity from 0.0 to 1.0.
Graphics.drawImageToSceneWP (texture, xPos, yPos, sourceX, sourceY, width, height, zValue) Draws a part of the texture for a frame by scene world coordinates with prioritizing.
Graphics.drawImageToSceneWP (texture, xPos, yPos, sourceX, sourceY, width, height, opacity, zValue) Draws a part of the texture for a frame by scene world coordinates with prioritizing, with an opacity from 0.0 to 1.0.

Alignment functions

Graphics.alignToHCenter (x, width) Aligns horizontal position of object of width to center with offset.
Graphics.alignToVCenter (y, height) Aligns vertical position of object of height to center with offset.


Tables

LuaImageResource
The LuaImageResource refers to a PGE Engine specific type, consisting of the data of a loaded image file as OpenGL texture.

Fields:

  • w int Width of texture [Read-Only]
  • h int Height of texture [Read-Only]
  • texture uint Index of OpenGL texture [Read-Only]

Loading of image files

Graphics.loadImage (filename)
Loads a texture into the memory from image file.

Parameters:

  • filename string The filename of the image file relative to the custom folder. Can be also a absolute path.

Returns:

    LuaImageResource an image descritor of LuaImageResource type (PGE_Texture internally). When returned nil, an error has occouped.

Drawing on screen

Graphics.drawImage (texture, xPos, yPos)
Draws the texture for a frame.

Parameters:

  • texture LuaImageResource Texture resource to draw
  • xPos float X position on the screen coordinates
  • yPos float Y position on the screen coordinates
Graphics.drawImage (texture, xPos, yPos, opacity)
Draws the texture for a frame, with an opacity from 0.0 to 1.0.

Parameters:

  • texture LuaImageResource Texture resource to draw
  • xPos float X position on the screen coordinates
  • yPos float Y position on the screen coordinates
  • opacity float Opacity level (value between 1.0 [non-transparent] and 0.0 [transparent])
Graphics.drawImage (texture, xPos, yPos, sourceX, sourceY, width, height)
Draws a part of the texture for a frame. Only a part of the pictures is drawn given by sourceX and sourceY with the specific width and height.

Parameters:

  • texture LuaImageResource Texture resource to draw
  • xPos float X position on the screen coordinates
  • yPos float Y position on the screen coordinates
  • sourceX float Source X position of a fragment on the texture
  • sourceY float Source Y position of a fragment on the texture
  • width float Width of a texture fragment
  • height float Height of a texture fragment
Graphics.drawImage (texture, xPos, yPos, sourceX, sourceY, width, height, opacity)
Draws a part of the texture for a frame, with an opacity from 0.0 to 1.0. Only a part of the pictures is drawn given by sourceX and sourceY with the specific width and height.

Parameters:

  • texture LuaImageResource Texture resource to draw
  • xPos float X position on the screen coordinates
  • yPos float Y position on the screen coordinates
  • sourceX float Source X position of a fragment on the texture
  • sourceY float Source Y position of a fragment on the texture
  • width float Width of a texture fragment
  • height float Height of a texture fragment
  • opacity float Opacity level (value between 1.0 [non-transparent] and 0.0 [transparent])

Drawing on screen with prioritizing

Graphics.drawImageWP (texture, xPos, yPos, zValue)
Draws the texture for a frame with prioritizing. The rendering of the image is prioritized by zValue priority

Parameters:

  • texture LuaImageResource Texture resource to draw
  • xPos float X position on the screen coordinates
  • yPos float Y position on the screen coordinates
  • zValue double A Z value, declares a render priority
Graphics.drawImageWP (texture, xPos, yPos, opacity, zValue)
Draws the texture for a frame with prioritizing, with an opacity from 0.0 to 1.0.

Parameters:

  • texture LuaImageResource Texture resource to draw
  • xPos float X position on the screen coordinates
  • yPos float Y position on the screen coordinates
  • opacity float Opacity level (value between 1.0 [non-transparent] and 0.0 [transparent])
  • zValue double A Z value, declares a render priority
Graphics.drawImageWP (texture, xPos, yPos, sourceX, sourceY, width, height, zValue)
Draws a part of the texture for a frame with prioritizing. Only a part of the pictures is drawn given by sourceX and sourceY with the specific width and height.

Parameters:

  • texture LuaImageResource Texture resource to draw
  • xPos float X position on the screen coordinates
  • yPos float Y position on the screen coordinates
  • sourceX float Source X position of a fragment on the texture
  • sourceY float Source Y position of a fragment on the texture
  • width float Width of a texture fragment
  • height float Height of a texture fragment
  • zValue double A Z value, declares a render priority
Graphics.drawImageWP (texture, xPos, yPos, sourceX, sourceY, width, height, opacity, zValue)
Draws a part of the texture for a frame with prioritizing, with an opacity from 0.0 to 1.0. Only a part of the pictures is drawn given by sourceX and sourceY with the specific width and height.

Parameters:

  • texture LuaImageResource Texture resource to draw
  • xPos float X position on the screen coordinates
  • yPos float Y position on the screen coordinates
  • sourceX float Source X position of a fragment on the texture
  • sourceY float Source Y position of a fragment on the texture
  • width float Width of a texture fragment
  • height float Height of a texture fragment
  • opacity float Opacity level (value between 1.0 [non-transparent] and 0.0 [transparent])
  • zValue double A Z value, declares a render priority

Drawing on scene

Graphics.drawImageToScene (texture, xPos, yPos)
Draws the texture for a frame by scene world coordinates.

Parameters:

  • texture LuaImageResource Texture resource to draw
  • xPos double X position on the level or world scene coordinates
  • yPos double Y position on the level or world scene coordinates
Graphics.drawImageToScene (texture, xPos, yPos, opacity)
Draws the texture for a frame by scene world coordinates, with an opacity from 0.0 to 1.0.

Parameters:

  • texture LuaImageResource Texture resource to draw
  • xPos double X position on the level or world scene coordinates
  • yPos double Y position on the level or world scene coordinates
  • opacity float Opacity level (value between 1.0 [non-transparent] and 0.0 [transparent])
Graphics.drawImageToScene (texture, xPos, yPos, sourceX, sourceY, width, height)
Draws a part of the texture for a frame by scene world coordinates. Only a part of the pictures is drawn given by sourceX and sourceY with the specific width and height.

Parameters:

  • texture LuaImageResource Texture resource to draw
  • xPos double X position on the level or world scene coordinates
  • yPos double Y position on the level or world scene coordinates
  • sourceX float Source X position of a fragment on the texture
  • sourceY float Source Y position of a fragment on the texture
  • width float Width of a texture fragment
  • height float Height of a texture fragment
Graphics.drawImageToScene (texture, xPos, yPos, sourceX, sourceY, width, height, opacity)
Draws a part of the texture for a frame by scene world coordinates, with an opacity from 0.0 to 1.0. Only a part of the pictures is drawn given by sourceX and sourceY with the specific width and height.

Parameters:

  • texture LuaImageResource Texture resource to draw
  • xPos double X position on the level or world scene coordinates
  • yPos double Y position on the level or world scene coordinates
  • sourceX float Source X position of a fragment on the texture
  • sourceY float Source Y position of a fragment on the texture
  • width float Width of a texture fragment
  • height float Height of a texture fragment
  • opacity float Opacity level (value between 1.0 [non-transparent] and 0.0 [transparent])

Drawing on scene with prioritizing

Graphics.drawImageToSceneWP (texture, xPos, yPos, zValue)
Draws the texture for a frame by scene world coordinates with prioritizing. The rendering of the image is prioritized by zValue priority

Parameters:

  • texture LuaImageResource Texture resource to draw
  • xPos double X position on the level or world scene coordinates
  • yPos double Y position on the level or world scene coordinates
  • zValue double A Z value, declares a render priority
Graphics.drawImageToSceneWP (texture, xPos, yPos, opacity, zValue)
Draws the texture for a frame by scene world coordinates with prioritizing, with an opacity from 0.0 to 1.0.

Parameters:

  • texture LuaImageResource Texture resource to draw
  • xPos double X position on the level or world scene coordinates
  • yPos double Y position on the level or world scene coordinates
  • opacity float Opacity level (value between 1.0 [non-transparent] and 0.0 [transparent])
  • zValue double A Z value, declares a render priority
Graphics.drawImageToSceneWP (texture, xPos, yPos, sourceX, sourceY, width, height, zValue)
Draws a part of the texture for a frame by scene world coordinates with prioritizing. Only a part of the pictures is drawn given by sourceX and sourceY with the specific width and height.

Parameters:

  • texture LuaImageResource Texture resource to draw
  • xPos double X position on the level or world scene coordinates
  • yPos double Y position on the level or world scene coordinates
  • sourceX float Source X position of a fragment on the texture
  • sourceY float Source Y position of a fragment on the texture
  • width float Width of a texture fragment
  • height float Height of a texture fragment
  • zValue double A Z value, declares a render priority
Graphics.drawImageToSceneWP (texture, xPos, yPos, sourceX, sourceY, width, height, opacity, zValue)
Draws a part of the texture for a frame by scene world coordinates with prioritizing, with an opacity from 0.0 to 1.0. Only a part of the pictures is drawn given by sourceX and sourceY with the specific width and height.

Parameters:

  • texture LuaImageResource Texture resource to draw
  • xPos double X position on the level or world scene coordinates
  • yPos double Y position on the level or world scene coordinates
  • sourceX float Source X position of a fragment on the texture
  • sourceY float Source Y position of a fragment on the texture
  • width float Width of a texture fragment
  • height float Height of a texture fragment
  • opacity float Opacity level (value between 1.0 [non-transparent] and 0.0 [transparent])
  • zValue double A Z value, declares a render priority

Alignment functions

Graphics.alignToHCenter (x, width)
Aligns horizontal position of object of width to center with offset.

Parameters:

  • x int X Offset of horizontal center position
  • width int Width of object

Returns:

    int Aligned X position of object
Graphics.alignToVCenter (y, height)
Aligns vertical position of object of height to center with offset.

Parameters:

  • y int Y Offset of vertical center position
  • height int Height of object

Returns:

    int Aligned Y position of object
generated by LDoc 1.4.6 Last updated 2017-08-21 02:20:32