Graphics | |
Structures | |
IMAGE_INFO | |
Variables | |
width | Contains the width of the image |
height | Contains the height of the image |
format | Contains the format of the image. |
data | Pointer to the image data. |
VIDEO_MODE | |
Functions | |
Quads | |
gfx_quads_begin | Begins a quad drawing session. |
gfx_quads_end | Ends a quad session. |
gfx_quads_setrotation | Sets the rotation to use when drawing a quad. |
gfx_quads_setsubset | Sets the uv coordinates to use. |
gfx_quads_setsubset_free | TODO |
gfx_quads_drawTL | Draws a quad by specifying the top-left point. |
gfx_quads_draw | Draws a quad by specifying the center point. |
gfx_quads_draw_freeform | Draws a quad by specifying the corner points. |
gfx_quads_text | TODO |
Lines | |
gfx_lines_begin | TODO |
gfx_lines_draw | TODO |
gfx_minimize | Minimizes the window. |
gfx_minimize | Maximizes the window. |
gfx_lines_end | TODO |
Text | |
gfx_text | TODO |
gfx_text_width | TODO |
gfx_text_color | TODO |
gfx_text_set_default_font | TODO |
Other | |
gfx_get_video_modes | Fetches a list of all the available video modes. |
gfx_load_png | Loads a PNG image from disk. |
gfx_load_texture | Loads a texture from a file. |
gfx_load_texture_raw | Loads a texture from memory. |
gfx_texture_set | Sets the active texture. |
gfx_unload_texture | Unloads a texture. |
gfx_clear | Clears the screen with the specified color. |
gfx_screenaspect | Returns the aspect ratio between width and height. |
gfx_screenwidth | Returns the screen width. |
gfx_screenheight | Returns the screen height. |
gfx_mapscreen | Specifies the coordinate system for the screen. |
gfx_blend_normal | Set the active blending mode to normal (src, 1-src). |
gfx_blend_additive | Set the active blending mode to additive (src, one). |
gfx_blend_none | Disables blending |
gfx_setcolorvertex | Sets the color of a vertex. |
gfx_setcolor | Sets the color of all the vertices. |
gfx_getscreen | TODO |
gfx_memory_usage | TODO |
gfx_screenshot | TODO |
gfx_screenshot_direct | TODO |
gfx_clip_enable | TODO |
gfx_clip_disable | TODO |
int format
Contains the format of the image. See Image Formats for more information.
Quads | |
gfx_quads_begin | Begins a quad drawing session. |
gfx_quads_end | Ends a quad session. |
gfx_quads_setrotation | Sets the rotation to use when drawing a quad. |
gfx_quads_setsubset | Sets the uv coordinates to use. |
gfx_quads_setsubset_free | TODO |
gfx_quads_drawTL | Draws a quad by specifying the top-left point. |
gfx_quads_draw | Draws a quad by specifying the center point. |
gfx_quads_draw_freeform | Draws a quad by specifying the corner points. |
gfx_quads_text | TODO |
Lines | |
gfx_lines_begin | TODO |
gfx_lines_draw | TODO |
gfx_minimize | Minimizes the window. |
gfx_minimize | Maximizes the window. |
gfx_lines_end | TODO |
Text | |
gfx_text | TODO |
gfx_text_width | TODO |
gfx_text_color | TODO |
gfx_text_set_default_font | TODO |
Other | |
gfx_get_video_modes | Fetches a list of all the available video modes. |
gfx_load_png | Loads a PNG image from disk. |
gfx_load_texture | Loads a texture from a file. |
gfx_load_texture_raw | Loads a texture from memory. |
gfx_texture_set | Sets the active texture. |
gfx_unload_texture | Unloads a texture. |
gfx_clear | Clears the screen with the specified color. |
gfx_screenaspect | Returns the aspect ratio between width and height. |
gfx_screenwidth | Returns the screen width. |
gfx_screenheight | Returns the screen height. |
gfx_mapscreen | Specifies the coordinate system for the screen. |
gfx_blend_normal | Set the active blending mode to normal (src, 1-src). |
gfx_blend_additive | Set the active blending mode to additive (src, one). |
gfx_blend_none | Disables blending |
gfx_setcolorvertex | Sets the color of a vertex. |
gfx_setcolor | Sets the color of all the vertices. |
gfx_getscreen | TODO |
gfx_memory_usage | TODO |
gfx_screenshot | TODO |
gfx_screenshot_direct | TODO |
gfx_clip_enable | TODO |
gfx_clip_disable | TODO |
void gfx_quads_begin()
Begins a quad drawing session.
This functions resets the rotation, color and subset. End the session by using gfx_quads_end. You can’t change texture or blending mode during a session.
void gfx_quads_setrotation( float angle )
Sets the rotation to use when drawing a quad.
angle | Angle in radians. |
The angle is reset when gfx_quads_begin is called.
void gfx_quads_setsubset( float tl_u, float tl_v, float br_u, float br_v )
Sets the uv coordinates to use.
tl_u | Top-left U value. |
tl_v | Top-left V value. |
br_u | Bottom-right U value. |
br_v | Bottom-right V value. |
O,0 is top-left of the texture and 1,1 is bottom-right. The color is reset when gfx_quads_begin is called.
void gfx_quads_drawTL( float x, float y, float width, float height )
Draws a quad by specifying the top-left point.
x | X coordinate of the top-left corner. |
y | Y coordinate of the top-left corner. |
width | Width of the quad. |
height | Height of the quad. |
Rotation still occurs from the center of the quad. You must call gfx_quads_begin before calling this function.
<gfx_quads_draw, gfx_quads_draw_freeform>
void gfx_quads_draw( float x, float y, float w, float h )
Draws a quad by specifying the center point.
x | X coordinate of the center. |
y | Y coordinate of the center. |
width | Width of the quad. |
height | Height of the quad. |
You must call gfx_quads_begin before calling this function.
<gfx_quads_drawTL, gfx_quads_draw_freeform>
void gfx_quads_draw_freeform( float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3 )
Draws a quad by specifying the corner points.
x0, y0 | Coordinates of the upper left corner. |
x1, y1 | Coordinates of the upper right corner. |
x2, y2 | Coordinates of the lower left corner. // TODO: DOUBLE CHECK!!! |
x3, y3 | Coordinates of the lower right corner. // TODO: DOUBLE CHECK!!! |
<gfx_quads_draw, gfx_quads_drawTL>
int gfx_get_video_modes( VIDEO_MODE * list, int maxcount )
Fetches a list of all the available video modes.
list | An array to recive the modes. Must be able to contain maxcount number of modes. |
maxcount | The maximum number of modes to fetch. |
The number of video modes that was fetched.
int gfx_load_png( IMAGE_INFO * img, const char * filename )
Loads a PNG image from disk.
img | Pointer to an structure to be filled out with the image information. |
filename | Filename of the image to load. |
Returns non-zero on success and zero on error.
The caller are responsible for cleaning up the allocated memory in the IMAGE_INFO structure.
int gfx_load_texture( const char * filename, int store_format, int flags )
Loads a texture from a file. TGA and PNG supported.
filename | Null terminated string to the file to load. |
store_format | What format to store on gfx card as. |
flags | controls how the texture is uploaded |
An ID to the texture. -1 on failure.
<gfx_unload_texture, gfx_load_png>
int gfx_load_texture_raw( int w, int h, int format, const void * data, int store_format, int flags )
Loads a texture from memory.
w | Width of the texture. |
h | Height of the texture. |
data | Pointer to the pixel data. |
format | Format of the pixel data. |
store_format | The format to store the texture on the graphics card. |
flags | controls how the texture is uploaded |
An ID to the texture. -1 on failure.
The pixel data should be in RGBA format with 8 bit per component. So the total size of the data should be w*h*4.
int gfx_unload_texture( int id )
Unloads a texture.
id | ID to the texture to unload. |
<gfx_load_texture_tga>, gfx_load_texture_raw
NOT IMPLEMENTED
void gfx_blend_normal()
Set the active blending mode to normal (src, 1-src).
This must be used before calling gfx_quads_begin. This is equal to glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA).
<gfx_blend_additive,gfx_blend_none>
void gfx_blend_additive()
Set the active blending mode to additive (src, one).
This must be used before calling gfx_quads_begin. This is equal to glBlendFunc(GL_SRC_ALPHA, GL_ONE).
<gfx_blend_normal,gfx_blend_none>
void gfx_blend_none()
Disables blending
This must be used before calling gfx_quads_begin.
<gfx_blend_normal,gfx_blend_additive>
void gfx_setcolorvertex( int i, float r, float g, float b, float a )
Sets the color of a vertex.
i | Index to the vertex. |
r | Red value. |
g | Green value. |
b | Blue value. |
a | Alpha value. |
The color values are from 0.0 to 1.0. The color is reset when gfx_quads_begin is called.
void gfx_setcolor( float r, float g, float b, float a )
Sets the color of all the vertices.
r | Red value. |
g | Green value. |
b | Blue value. |
a | Alpha value. |
The color values are from 0.0 to 1.0. The color is reset when gfx_quads_begin is called.
Contains the width of the image
int width
Contains the height of the image
int height
Contains the format of the image.
int format
Pointer to the image data.
void *data
Begins a quad drawing session.
void gfx_quads_begin()
Ends a quad session.
void gfx_quads_end()
Sets the rotation to use when drawing a quad.
void gfx_quads_setrotation( float angle )
Sets the uv coordinates to use.
void gfx_quads_setsubset( float tl_u, float tl_v, float br_u, float br_v )
TODO
void gfx_quads_setsubset_free( float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3 )
Draws a quad by specifying the top-left point.
void gfx_quads_drawTL( float x, float y, float width, float height )
Draws a quad by specifying the center point.
void gfx_quads_draw( float x, float y, float w, float h )
Draws a quad by specifying the corner points.
void gfx_quads_draw_freeform( float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3 )
TODO
void gfx_quads_text( float x, float y, float size, const char * text )
TODO
void gfx_lines_begin()
TODO
void gfx_lines_draw( float x0, float y0, float x1, float y1 )
Minimizes the window.
void gfx_minimize()
TODO
void gfx_lines_end()
TODO
void gfx_text( void * font, float x, float y, float size, const char * text, int max_width )
TODO
float gfx_text_width( void * font, float size, const char * text, int length )
TODO
void gfx_text_color( float r, float g, float b, float a )
TODO
void gfx_text_set_default_font( void * font )
Fetches a list of all the available video modes.
int gfx_get_video_modes( VIDEO_MODE * list, int maxcount )
Loads a PNG image from disk.
int gfx_load_png( IMAGE_INFO * img, const char * filename )
Loads a texture from a file.
int gfx_load_texture( const char * filename, int store_format, int flags )
Loads a texture from memory.
int gfx_load_texture_raw( int w, int h, int format, const void * data, int store_format, int flags )
Sets the active texture.
void gfx_texture_set( int id )
Unloads a texture.
int gfx_unload_texture( int id )
Clears the screen with the specified color.
void gfx_clear( float r, float g, float b )
Returns the aspect ratio between width and height.
float gfx_screenaspect()
Returns the screen width.
int gfx_screenwidth()
Returns the screen height.
int gfx_screenheight()
Specifies the coordinate system for the screen.
void gfx_mapscreen( float tl_x, float tl_y, float br_x, float br_y )
Set the active blending mode to normal (src, 1-src).
void gfx_blend_normal()
Set the active blending mode to additive (src, one).
void gfx_blend_additive()
Disables blending
void gfx_blend_none()
Sets the color of a vertex.
void gfx_setcolorvertex( int i, float r, float g, float b, float a )
Sets the color of all the vertices.
void gfx_setcolor( float r, float g, float b, float a )
TODO
void gfx_getscreen( float * tl_x, float * tl_y, float * br_x, float * br_y )
TODO
int gfx_memory_usage()
TODO
void gfx_screenshot()
TODO
void gfx_screenshot_direct( const char * filename )
TODO
void gfx_clip_enable( int x, int y, int w, int h )
TODO
void gfx_clip_disable()