# NodGL Documentation **NodGL** is ModuOS's powerful graphics library for creating games and graphical applications! ## 📚 Documentation ### For Beginners Start here if you're new to graphics programming: 1. **[Getting Started](Getting-Started.md)** - Your first NodGL program 2. **[Drawing Shapes](Drawing-Shapes.md)** - Rectangles, circles, lines, and more 3. **[Using Textures](Using-Textures.md)** - Images, sprites, and backbuffers 4. **[Handling Input](Handling-Input.md)** - Mouse and keyboard controls 5. **[Simple Examples](Simple-Examples.md)** - Complete programs to learn from ### Game Development Want to make games? Check out **[Blit Engine](../Blit-Engine.md)** - a complete game framework built on NodGL! Blit Engine is located in `EXTERNAL/Blit/` and includes: - Complete 2D game framework - Entity/sprite management - BlitStudio visual editor - Example games ### Advanced Topics For experienced developers: - **[NodGL API Reference](../NodGL-API.md)** - Complete function documentation - **[Performance Tips](Performance-Tips.md)** - Make your programs faster - **[3D Graphics](3D-Graphics.md)** - Basic 3D rendering techniques ## 🎮 What Can You Make? - **Games** - Platformers, shooters, puzzle games - **Graphics demos** - Fractals, animations, visualizations - **GUI applications** - Calculators, paint programs, file browsers - **Educational programs** - Interactive tutorials, simulations ## 🚀 Quick Start ```c #include "NodGL.h" #include "libc.h" int md_main(long argc, char **argv) { // Create graphics device NodGL_Device device; NodGL_Context ctx; NodGL_CreateDevice(NodGL_FEATURE_LEVEL_1_0, &device, &ctx, NULL); // Clear screen to blue NodGL_ClearContext(ctx, NodGL_CLEAR_COLOR, 0xFF0000FF, 1.0f, 0); // Draw a red square NodGL_FillRectContext(ctx, 100, 100, 200, 200, 0xFFFF0000); // Show it NodGL_PresentContext(ctx, 1); // Wait for (volatile int i = 0; i < 5000000; i++); // Cleanup NodGL_ReleaseDevice(device); return 0; } ``` ## 💡 Key Concepts ### Device & Context - **Device** - Represents your graphics hardware - **Context** - Where you issue drawing commands ### Colors Colors use ARGB format: `0xAARRGGBB` - `0xFFFF0000` = Red - `0xFF00FF00` = Green - `0xFF0000FF` = Blue ### Frame Loop Most programs follow this pattern: ```c while (running) { // 1. Handle input // 2. Update game logic // 3. Clear screen // 4. Draw everything // 5. Present frame } ``` ## 🎯 Learning Path **Absolute Beginner** (no graphics experience): 1. Read [Getting Started](Getting-Started.md) 2. Type out Example 1 from [Simple Examples](Simple-Examples.md) 3. Modify the colors and positions 4. Try [Drawing Shapes](Drawing-Shapes.md) **Some C Experience**: 1. Skim [Getting Started](Getting-Started.md) 2. Read [Handling Input](Handling-Input.md) 3. Build the Pong game from [Simple Examples](Simple-Examples.md) 4. Start with the [Game Engine](Game-Engine.md) **Experienced Programmer**: 1. Check [NodGL API Reference](../NodGL-API.md) 2. Look at [Game Engine](Game-Engine.md) source code 3. Read [Performance Tips](Performance-Tips.md) 4. Build something awesome! ## 📖 Additional Resources - **Source Code** - All examples are in `/userland/` directory - **Header File** - `NodGL.h` has all function signatures - **Library** - `lib_NodGL.c` contains the implementation ## 🤝 Community Share your NodGL creations! Check out what others have made: - Snake game (`snakegfx.c`) - Minesweeper (`minesgfx.c`) - Calculator (`calcgfx.c`) - Paint program (`paintgfx.c`) ## ⚡ Features - **Hardware Acceleration** - Uses GPU when available - **Simple API** - Easy to learn, hard to mess up - **Fast** - Optimized for performance - **Flexible** - From simple shapes to complex 3D - **Well Documented** - Lots of examples and guides Start your journey: [Getting Started →](Getting-Started.md)