Classes | Public Types | Static Public Member Functions

EZGL2D.GL2D Class Reference

GL2D Static Class. More...

List of all members.

Classes

class  SpriteGL
 Struct for our GL-Based Images
This is our struct to hold our image attributes. You don't need to worry about this most of the time. More...

Public Types

enum  BLEND_MODE {
  GL2D_TRANS = 0, GL2D_SOLID, GL2D_BLENDED, GL2D_GLOW,
  GL2D_ALPHA
}
 

Enums for controlling how blending works.

More...

Static Public Member Functions

static void Begin2D ()
 Sets up OpenGL for 2d rendering.
Call this before drawing any of GL2D's drawing or sprite functions.
static void End2D ()
 Issue this after drawing 2d so that we don't mess the matrix stack.
The compliment of glBegin2D().
static void Screen2D (int width, int height)
 Initializes GL in 2D mode.
static void Close ()
 Cleans up EZGL2D. Call this at program end. Automatic texture management.
static void BlendMode (BLEND_MODE mode)
 Sets the default blending/blitting mode.
static void ClearScreen ()
 Clears the GL2D screen buffer.
static void SetColor (float r, float g, float b, float a)
 Draws a Pixel.
static void EnableAntialias (bool flag)
 Enables or disables AA depending on the switch.
static void PutPixel (int x, int y)
 Draws a Pixel.
static void Line (int x1, int y1, int x2, int y2)
 Draws a Line.
static void Box (int x1, int y1, int x2, int y2)
 Draws a Box.
static void BoxFilled (int x1, int y1, int x2, int y2)
 Draws a Box filled with a single color.
static void Triangle (int x1, int y1, int x2, int y2, int x3, int y3)
 Draws a Triangle.
static void TriangleFilled (int x1, int y1, int x2, int y2, int x3, int y3)
 Draws a filled Triangle.
static void Sprite (int x, int y, int flipmode, SpriteGL sprite)
 Draws a Sprite.
static void SpriteRotateScale (int x, int y, float angle, float scaleX, float scaleY, int flipmode, SpriteGL sprite)
 Draws a Center Rotated Axis-Exclusive Scaled Sprite.
static void SpriteOnLine (int x1, int y1, int x2, int y2, int thickness, SpriteGL sprite)
 Draws a textured line.
static SpriteGL LoadSprite (string filename, int filtermode)
 Loads an image file(prefer PNGs) directly to a SpriteGL object
Image file needs to be have power of 2 dimension(2, 4, 8,.... 2048,...)
static SpriteGL[] LoadSpriteSet (string filename, int numframes, int[] texcoords, int filtermode)
 Initializes our spriteset with Texture Packer generated UV coordinates
Very safe and easy to use.. Image file needs to be have power of 2 dimension(2, 4, 8,.... 2048,...)
static SpriteGL[] LoadTileSet (string filename, int tileWidth, int tileHeight, int filtermode)
 Initializes our Tileset.
Can only be used when tiles in a tilset are of the same dimensions. Image file needs to be have power of 2 dimension(2, 4, 8,.... 2048,...)

Detailed Description

GL2D Static Class.


Member Enumeration Documentation

Enums for controlling how blending works.

Enumerator:
GL2D_TRANS 

Transparent blit

GL2D_SOLID 

Solid blit

GL2D_BLENDED 

Alpha Blended blit

GL2D_GLOW 

Additive Blended blit

GL2D_ALPHA 

Alpha Transparent blit


Member Function Documentation

static void EZGL2D.GL2D.BlendMode ( BLEND_MODE  mode ) [static]

Sets the default blending/blitting mode.

Parameters:
modeenums for blending see example files.
static void EZGL2D.GL2D.Box ( int  x1,
int  y1,
int  x2,
int  y2 
) [static]

Draws a Box.

Parameters:
x1,y1Top-Left coordinate of the box.
x2,y2Bottom-Right coordinate of the box.
static void EZGL2D.GL2D.BoxFilled ( int  x1,
int  y1,
int  x2,
int  y2 
) [static]

Draws a Box filled with a single color.

Parameters:
x1,y1Top-Left coordinate of the box.
x2,y2Bottom-Right coordinate of the box.
static void EZGL2D.GL2D.EnableAntialias ( bool  flag ) [static]

Enables or disables AA depending on the switch.

Parameters:
flagtrue == enable; false(0) == disable.
static void EZGL2D.GL2D.Line ( int  x1,
int  y1,
int  x2,
int  y2 
) [static]

Draws a Line.

Parameters:
x1,y1Start point of the line.
x2,y2End point of the line.
static SpriteGL EZGL2D.GL2D.LoadSprite ( string  filename,
int  filtermode 
) [static]

Loads an image file(prefer PNGs) directly to a SpriteGL object
Image file needs to be have power of 2 dimension(2, 4, 8,.... 2048,...)

Parameters:
filenamefilename of the TGA file to load ie. "ships.png".
filtermodeTextureMinFilter.Linear, TextureMinFilter.Nearest, etc.
Returns:
SpriteGL that can be directly used by the sprite routines.
static SpriteGL [] EZGL2D.GL2D.LoadSpriteSet ( string  filename,
int  numframes,
int[]  texcoords,
int  filtermode 
) [static]

Initializes our spriteset with Texture Packer generated UV coordinates
Very safe and easy to use.. Image file needs to be have power of 2 dimension(2, 4, 8,.... 2048,...)

Parameters:
filenamefilename of the image file to load ie. "ships.png".
numframesnumber of frames in a spriteset.
texcoordsTexture Packer auto-generated array of UV coords.
filtermodeTextureMinFilter.Linear, TextureMinFilter.Nearest, etc.
Returns:
SpriteGL array that can be directly used by the sprite routines.
static SpriteGL [] EZGL2D.GL2D.LoadTileSet ( string  filename,
int  tileWidth,
int  tileHeight,
int  filtermode 
) [static]

Initializes our Tileset.
Can only be used when tiles in a tilset are of the same dimensions. Image file needs to be have power of 2 dimension(2, 4, 8,.... 2048,...)

Parameters:
filenamefilename of the image file to load ie. "ships.png".
tileWidthWidth of each tile in the texture.
tileHeightHeight of each tile in the texture.
filtermodeTextureMinFilter.Linear, TextureMinFilter.Nearest, etc.
Returns:
SpriteGL array that can be directly used by the sprite routines.
static void EZGL2D.GL2D.PutPixel ( int  x,
int  y 
) [static]

Draws a Pixel.

Parameters:
xX position of the pixel.
yY position of the pixel.
static void EZGL2D.GL2D.Screen2D ( int  width,
int  height 
) [static]

Initializes GL in 2D mode.

Parameters:
widthwidth of the window.
heightheight of the window.
static void EZGL2D.GL2D.SetColor ( float  r,
float  g,
float  b,
float  a 
) [static]

Draws a Pixel.

Parameters:
rRed channel of the color.
gGreen channel of the color.
bBlue channel of the color.
aAlpha channel of the color.
static void EZGL2D.GL2D.Sprite ( int  x,
int  y,
int  flipmode,
SpriteGL  sprite 
) [static]

Draws a Sprite.

Parameters:
xX position of the sprite.
yY position of the sprite.
flipmodemode for flipping (see FLIP_MODE constants).
spritea glImage.
static void EZGL2D.GL2D.SpriteOnLine ( int  x1,
int  y1,
int  x2,
int  y2,
int  thickness,
SpriteGL  sprite 
) [static]

Draws a textured line.

Parameters:
x1,y1Start point of the line.
x2,y2End point of the line.
thicknessThickness of the line.
spritea glImage used to texture the line.
static void EZGL2D.GL2D.SpriteRotateScale ( int  x,
int  y,
float  angle,
float  scaleX,
float  scaleY,
int  flipmode,
SpriteGL  sprite 
) [static]

Draws a Center Rotated Axis-Exclusive Scaled Sprite.

Parameters:
xX position of the sprite center.
yY position of the sprite center.
angleAngle(in degrees) to rotate the sprite.
scaleXX-Axis scale value (1.0f is normal).
scaleYY-Axis scale value (1.0f is normal).
flipmodemode for flipping (see FLIP_MODE constants).
spritea glImage.
static void EZGL2D.GL2D.Triangle ( int  x1,
int  y1,
int  x2,
int  y2,
int  x3,
int  y3 
) [static]

Draws a Triangle.

Parameters:
x1,y1Vertex 1 of the triangle.
x2,y2Vertex 2 of the triangle.
x3,y3Vertex 3 of the triangle.
static void EZGL2D.GL2D.TriangleFilled ( int  x1,
int  y1,
int  x2,
int  y2,
int  x3,
int  y3 
) [static]

Draws a filled Triangle.

Parameters:
x1,y1Vertex 1 of the triangle.
x2,y2Vertex 2 of the triangle.
x3,y3Vertex 3 of the triangle.

The documentation for this class was generated from the following file: