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,...) |
GL2D Static Class.
static void EZGL2D.GL2D.BlendMode | ( | BLEND_MODE | mode ) | [static] |
Sets the default blending/blitting mode.
mode | enums for blending see example files. |
static void EZGL2D.GL2D.Box | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2 | ||
) | [static] |
Draws a Box.
x1,y1 | Top-Left coordinate of the box. |
x2,y2 | Bottom-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.
x1,y1 | Top-Left coordinate of the box. |
x2,y2 | Bottom-Right coordinate of the box. |
static void EZGL2D.GL2D.EnableAntialias | ( | bool | flag ) | [static] |
Enables or disables AA depending on the switch.
flag | true == enable; false(0) == disable. |
static void EZGL2D.GL2D.Line | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2 | ||
) | [static] |
Draws a Line.
x1,y1 | Start point of the line. |
x2,y2 | End 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,...)
filename | filename of the TGA file to load ie. "ships.png". |
filtermode | TextureMinFilter.Linear, TextureMinFilter.Nearest, etc. |
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,...)
filename | filename of the image file to load ie. "ships.png". |
numframes | number of frames in a spriteset. |
texcoords | Texture Packer auto-generated array of UV coords. |
filtermode | TextureMinFilter.Linear, TextureMinFilter.Nearest, etc. |
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,...)
filename | filename of the image file to load ie. "ships.png". |
tileWidth | Width of each tile in the texture. |
tileHeight | Height of each tile in the texture. |
filtermode | TextureMinFilter.Linear, TextureMinFilter.Nearest, etc. |
static void EZGL2D.GL2D.PutPixel | ( | int | x, |
int | y | ||
) | [static] |
Draws a Pixel.
x | X position of the pixel. |
y | Y position of the pixel. |
static void EZGL2D.GL2D.Screen2D | ( | int | width, |
int | height | ||
) | [static] |
Initializes GL in 2D mode.
width | width of the window. |
height | height of the window. |
static void EZGL2D.GL2D.SetColor | ( | float | r, |
float | g, | ||
float | b, | ||
float | a | ||
) | [static] |
Draws a Pixel.
r | Red channel of the color. |
g | Green channel of the color. |
b | Blue channel of the color. |
a | Alpha channel of the color. |
static void EZGL2D.GL2D.Sprite | ( | int | x, |
int | y, | ||
int | flipmode, | ||
SpriteGL | sprite | ||
) | [static] |
Draws a Sprite.
x | X position of the sprite. |
y | Y position of the sprite. |
flipmode | mode for flipping (see FLIP_MODE constants). |
sprite | a glImage. |
static void EZGL2D.GL2D.SpriteOnLine | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | thickness, | ||
SpriteGL | sprite | ||
) | [static] |
Draws a textured line.
x1,y1 | Start point of the line. |
x2,y2 | End point of the line. |
thickness | Thickness of the line. |
sprite | a 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.
x | X position of the sprite center. |
y | Y position of the sprite center. |
angle | Angle(in degrees) to rotate the sprite. |
scaleX | X-Axis scale value (1.0f is normal). |
scaleY | Y-Axis scale value (1.0f is normal). |
flipmode | mode for flipping (see FLIP_MODE constants). |
sprite | a glImage. |
static void EZGL2D.GL2D.Triangle | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | x3, | ||
int | y3 | ||
) | [static] |
Draws a Triangle.
x1,y1 | Vertex 1 of the triangle. |
x2,y2 | Vertex 2 of the triangle. |
x3,y3 | Vertex 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.
x1,y1 | Vertex 1 of the triangle. |
x2,y2 | Vertex 2 of the triangle. |
x3,y3 | Vertex 3 of the triangle. |