Setup & Cleanup
void gfx_close()
Close the graphics window and free resources.
Definition: simplegfx.c:120
int gfx_init(int width, int height)
Initialize the graphics window with specified dimensions.
Definition: simplegfx.c:34
Display Control
void gfx_present()
Display all drawn graphics on the screen.
Definition: simplegfx.c:108
void gfx_delay(int ms)
Pause program execution for specified milliseconds.
Definition: simplegfx.c:115
void gfx_clear()
Clear the entire graphics window to white.
Definition: simplegfx.c:67
Drawing Pixels
void gfx_putpixel(int x, int y)
Draw a single black pixel at the specified coordinates.
Definition: simplegfx.c:72
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.
Definition: simplegfx.c:77
Drawing Shapes
void gfx_line(
int x1,
int y1,
int x2,
int y2);
void gfx_rect(
int x,
int y,
int w,
int h);
void gfx_circle(int cx, int cy, int r)
Draw a circle outline.
Definition: simplegfx.c:96
void gfx_line(int x1, int y1, int x2, int y2)
Draw a line between two points.
Definition: simplegfx.c:85
void gfx_rect(int x, int y, int w, int h)
Draw a rectangle outline.
Definition: simplegfx.c:91
Text
void gfx_drawtext(int x, int y, const char *text)
Draw text at the specified position.
Definition: simplegfx.c:101
Typical Program Structure
return 1;
return 0;
}
int main()
Definition: simple.c:35
Simple cross-platform graphics library for C programming education.
Color Examples
Coordinates
- Origin (0, 0) is at the top-left corner
- X increases going right →
- Y increases going down ↓
(0,0) ────────→ X
│
│
↓
Y
Common Patterns
Animation Loop
for (int frame = 0; frame < 100; frame++) {
}
Filled Circle (Manual)
for (int y = cy - r; y <= cy + r; y++) {
for (int x = cx - r; x <= cx + r; x++) {
int dx = x - cx;
int dy = y - cy;
if (dx*dx + dy*dy <= r*r) {
}
}
}
Grid Pattern
for (int y = 0; y < height; y += 10) {
for (int x = 0; x < width; x += 10) {
}
}
📚 Full Documentation
This quick reference covers the basics. For comprehensive documentation:
View Source Documentation
Generate HTML Documentation
Beautiful, searchable HTML documentation with examples, parameter descriptions, and modern styling:
# 1. First-time setup (download CSS theme)
cd doxygen
bash setup-doxygen.sh
# 2. Generate docs (from doxygen folder)
doxygen Doxyfile
# 3. View in browser
cd ..
xdg-open docs/html/index.html # Linux
open docs/html/index.html # Mac
start docs\html\index.html # Windows
See README.md - Generating API Documentation for more details.
SimpleGFX v1.0 - Simple Graphics Library for C Programming Education Made with ❤️ for students learning C