graphiX.c is a lightweight 2D graphics library implemented in C, designed to provide basic graphics rendering capabilities and event handling without relying on external graphics libraries. It allows you to create windows, handle keyboard and mouse input, and draw basic shapes and lines.
- Event Handling: Keyboard and mouse input handling
- Basic Drawing Capabilities:
- Draw lines
- Draw rectangles
- Draw circles
- Draw polygon of any side
- Fill areas with color
- Sprites rendering
- Customizable: Easily extendable for more advanced graphics operations
- A C compiler (GCC recommended)
- Windows: Windows SDK
-
Clone the repository:
git clone https://github.com/Kraken57/graphiX.c.git cd mango
-
Compile the project:
1. Install ![Xming](https://sourceforge.net/projects/xming/) 2. Install feh `sudo apt install feh` 3. Run `export DISPLAY=:0` in the terminal 4. Open this repo solution in Visual Studio 2022 5. Click on Local Window Debugger 6. run `feh <file_name.ppm>` 7. Your file will be visible
#include "mangoc_graphics.h"
int main() {
// Initialize the window and graphics
initialize_window();
// Main event loop
while (running) {
handle_events();
draw();
}
// Clean up
cleanup();
return 0;
}
mangoc_draw_line(pixels, WIDTH, HEIGHT, 100, 100, 200, 200, 0xFFFFFFFF);
mangoc_draw_rectangle(pixels, WIDTH, HEIGHT, 50, 50, 150, 100, 0xFF0000FF);
mangoc_draw_circle(pixels, WIDTH, HEIGHT, 100, 100, 50, 0xFFFF00FF);
mangoc_fill(pixels, WIDTH, HEIGHT, 0x00FF00FF);