|
SimpleGFX
1.0
Simple Graphics Library for C Programming Education
|
Implementation of the simple graphics library. More...
Functions | |
| void | gfx_circle (int cx, int cy, int r) |
| Draw a circle outline. More... | |
| void | gfx_clear () |
| Clear the entire graphics window to white. More... | |
| void | gfx_close () |
| Close the graphics window and free resources. More... | |
| void | gfx_delay (int ms) |
| Pause program execution for specified milliseconds. More... | |
| void | gfx_drawtext (int x, int y, const char *text) |
| Draw text at the specified position. More... | |
| int | gfx_init (int w, int h) |
| Initialize the graphics window with specified dimensions. More... | |
| void | gfx_line (int x1, int y1, int x2, int y2) |
| Draw a line between two points. More... | |
| void | gfx_present () |
| Display all drawn graphics on the screen. More... | |
| void | gfx_putpixel (int x, int y) |
| Draw a single black pixel at the specified coordinates. More... | |
| void | gfx_putpixel_color (int x, int y, unsigned char r, unsigned char g, unsigned char b) |
| Draw a single pixel with custom RGB color. More... | |
| void | gfx_rect (int x, int y, int w, int h) |
| Draw a rectangle outline. More... | |
| static LRESULT CALLBACK | WndProc (HWND h, UINT m, WPARAM w, LPARAM l) |
Variables | |
| static HBITMAP | backBmp |
| static HDC | backDC |
| static HWND | hwnd |
| static int | winH |
| static int | winW |
Implementation of the simple graphics library.
Cross-platform graphics implementation:
The library automatically compiles the correct version based on platform.
| void gfx_circle | ( | int | cx, |
| int | cy, | ||
| int | r | ||
| ) |
Draw a circle outline.
Draws only the border of a circle, not filled.
| cx | X-coordinate of the circle center |
| cy | Y-coordinate of the circle center |
| r | Radius of the circle in pixels |
| void gfx_clear | ( | ) |
Clear the entire graphics window to white.
Erases everything on the screen and fills it with white color.
| void gfx_close | ( | ) |
| void gfx_delay | ( | int | ms | ) |
Pause program execution for specified milliseconds.
Useful for keeping the window open or creating animations.
| ms | Delay duration in milliseconds (1000 ms = 1 second) |
| void gfx_drawtext | ( | int | x, |
| int | y, | ||
| const char * | text | ||
| ) |
Draw text at the specified position.
Renders text using the default system font in black color.
| x | X-coordinate where text starts |
| y | Y-coordinate of the text baseline |
| text | The null-terminated string to draw |
| int gfx_init | ( | int | width, |
| int | height | ||
| ) |
Initialize the graphics window with specified dimensions.
Creates a graphics window where you can draw shapes and pixels. Must be called before any other graphics functions.
| width | Window width in pixels |
| height | Window height in pixels |
| void gfx_line | ( | int | x1, |
| int | y1, | ||
| int | x2, | ||
| int | y2 | ||
| ) |
Draw a line between two points.
Draws a straight line connecting point (x1, y1) to point (x2, y2).
| x1 | X-coordinate of the start point |
| y1 | Y-coordinate of the start point |
| x2 | X-coordinate of the end point |
| y2 | Y-coordinate of the end point |
| void gfx_present | ( | ) |
Display all drawn graphics on the screen.
Call this after drawing operations to make them visible. This updates the window with everything you've drawn since the last present.
| void gfx_putpixel | ( | int | x, |
| int | y | ||
| ) |
Draw a single black pixel at the specified coordinates.
| x | X-coordinate of the pixel (0 = left edge) |
| y | Y-coordinate of the pixel (0 = top edge) |
| void gfx_putpixel_color | ( | int | x, |
| int | y, | ||
| unsigned char | r, | ||
| unsigned char | g, | ||
| unsigned char | b | ||
| ) |
Draw a single pixel with custom RGB color.
Allows you to specify any color using Red, Green, Blue components. Each component ranges from 0 (none) to 255 (full intensity).
| x | X-coordinate of the pixel |
| y | Y-coordinate of the pixel |
| r | Red component (0-255) |
| g | Green component (0-255) |
| b | Blue component (0-255) |
| void gfx_rect | ( | int | x, |
| int | y, | ||
| int | w, | ||
| int | h | ||
| ) |
Draw a rectangle outline.
Draws only the border of a rectangle, not filled.
| x | X-coordinate of the top-left corner |
| y | Y-coordinate of the top-left corner |
| w | Width of the rectangle in pixels |
| h | Height of the rectangle in pixels |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |