GrooveStomp's 3D Software Renderer
0.1.0
|
#include "SDL2/SDL.h"
Go to the source code of this file.
Macros | |
#define | GRAPHICS_VERSION "0.1.0" |
include guard | |
Functions | |
struct graphics * | GraphicsInit (char *title, int width, int height, int scale) |
Creates and initializes a new graphics object isntance. More... | |
void | GraphicsDeinit (struct graphics *graphics) |
De-initializes and frees memory for the given graphics object. More... | |
void | GraphicsBegin (struct graphics *graphics) |
Initializes the graphics subsystem for drawing routines. More... | |
void | GraphicsEnd (struct graphics *graphics) |
Prepares the graphics subsystem for presentation, then presents. More... | |
void | GraphicsClearScreen (struct graphics *graphics, unsigned int color) |
Sets all pixels in the screen to the given color. More... | |
void | GraphicsTriangleWireframe (struct graphics *graphics, struct triangle triangle, unsigned int color) |
Draw a triangle with the given set of x and y coordinates. More... | |
void | GraphicsTriangleSolid (struct graphics *graphics, struct triangle triangle, unsigned int color) |
Draw a triangle with the given set of x and y coordinates. More... | |
void | GraphicsTriangleTextured (struct graphics *graphics, struct triangle tri, struct texture *texture) |
Draw a textured triangle with the given set of x and y coordinates. More... | |
Drawing interface to the operating system.
void GraphicsBegin | ( | struct graphics * | graphics | ) |
Initializes the graphics subsystem for drawing routines.
Internally locks streaming texture for direct manipulation.
[in,out] | graphics | Graphics state to be manipulated |
void GraphicsClearScreen | ( | struct graphics * | graphics, |
unsigned int | color | ||
) |
Sets all pixels in the screen to the given color.
[in,out] | graphics | Graphics state to be manipulated |
[in] | color | 32-bit color with 8-bits per component: (R,G,B,A) |
void GraphicsDeinit | ( | struct graphics * | graphics | ) |
De-initializes and frees memory for the given graphics object.
[in,out] | graphics | The initialized opcode object to be cleaned and reclaimed |
void GraphicsEnd | ( | struct graphics * | graphics | ) |
Prepares the graphics subsystem for presentation, then presents.
Internally unlocks streaming texture then calls presentation routines.
[in,out] | graphics | Graphics state to be manipulated. |
struct graphics* GraphicsInit | ( | char * | title, |
int | width, | ||
int | height, | ||
int | scale | ||
) |
Creates and initializes a new graphics object isntance.
Scale can be specified as a non-negative number. This value is used to multiply both the width and the height and the pixel size of any drawing operations.
For example, specifying a scale of 2 would multiply the width by 2, the height by 2, and every pixel would be 2x2; so the total scale factor ends up being scale^2
[in] | title | The title displayed in the window titlebar |
[in] | width | Width of the display area of the window, in pixels |
[in] | height | Height of the display are of the window, in pixels |
[in] | scale | Size and rendering scale, natural number multiple |
void GraphicsTriangleSolid | ( | struct graphics * | graphics, |
struct triangle | triangle, | ||
unsigned int | color | ||
) |
Draw a triangle with the given set of x and y coordinates.
Fills the specified polygon with the given color.
[in,out] | graphics | Graphics state to be changed |
[in] | triangle | The triangle to draw |
[in] | color | What color the solid triangle should be rendered with |
void GraphicsTriangleTextured | ( | struct graphics * | graphics, |
struct triangle | tri, | ||
struct texture * | texture | ||
) |
Draw a textured triangle with the given set of x and y coordinates.
Fills the specified polygon with the given texture.
[in,out] | graphics | Graphics state to be changed |
[in] | tri | The triangle to draw |
[in] | texture | What texture to sample while drawing the solid triangle |
void GraphicsTriangleWireframe | ( | struct graphics * | graphics, |
struct triangle | triangle, | ||
unsigned int | color | ||
) |
Draw a triangle with the given set of x and y coordinates.
Only draws the lines, doesn't fill the polygon.
[in,out] | graphics | Graphics state to be changed |
[in] | triangle | The triangle to draw |
[in] | color | What color the wireframe should be rendered with |