-
Notifications
You must be signed in to change notification settings - Fork 0
Graphics and Games
NtinosTheGamer2324 edited this page Mar 7, 2026
·
1 revision
ModuOS provides powerful graphics capabilities through two complementary systems:
NodGL is ModuOS's low-level graphics API for drawing and rendering.
- Direct GPU access and hardware acceleration
- Device/Context architecture (similar to modern graphics APIs)
- Full control over rendering pipeline
- Suitable for graphics applications, visualizations, and advanced rendering
- Building custom graphics applications
- Advanced rendering techniques
- Maximum control over graphics hardware
- Non-game graphics programs (paint apps, visualizers, etc.)
Topics Covered:
- Getting Started - Your first NodGL program
- Drawing Shapes - Rectangles, circles, lines
- Using Textures - Images and sprites
- Handling Input - Mouse and keyboard
- Simple Examples - Complete programs
- API Reference - Complete function list
StarEngine is a high-level 2D game framework built on top of NodGL.
- Complete game development framework
- Entity/sprite management system
- Built-in collision detection
- Easy input handling
- Perfect for beginners and rapid prototyping
- Making 2D games (arcade, platformer, puzzle, shooter, etc.)
- Learning game development
- Rapid prototyping
- Focus on gameplay, not graphics APIs
Topics Covered:
- Introduction - What is StarEngine?
- Getting Started - Your first game
- Core Concepts - Game loop, entities, sprites
- Tutorial: Catch the Stars - Step-by-step game
- Example Games - Complete game examples
- API Reference - All functions
- Build non-game graphics applications
- Have full control over rendering
- Learn low-level graphics programming
- Create custom rendering engines
- Make 2D games quickly
- Learn game development
- Focus on gameplay mechanics
- Avoid boilerplate code
| Feature | NodGL | StarEngine |
|---|---|---|
| Level | Low-level | High-level |
| Purpose | Graphics API | Game Framework |
| Learning Curve | Moderate | Easy |
| Setup Code | More | Minimal |
| Best For | Graphics apps | 2D games |
| Input Handling | Manual | Built-in |
| Collision | DIY | Built-in |
| Entities | Manual | Built-in |
#include "NodGL.h"
#include "libc.h"
int md_main(long argc, char **argv) {
NodGL_Device device;
NodGL_Context ctx;
NodGL_CreateDevice(NodGL_FEATURE_LEVEL_1_0, &device, &ctx, NULL);
NodGL_ClearContext(ctx, NodGL_CLEAR_COLOR, 0xFF000000, 1.0f, 0);
NodGL_FillRectContext(ctx, 100, 100, 200, 150, 0xFFFF0000);
NodGL_PresentContext(ctx, 1);
for (volatile int i = 0; i < 5000000; i++);
NodGL_ReleaseDevice(device);
return 0;
}#include "StarEngine.h"
#include "libc.h"
int md_main(long argc, char **argv) {
StarEngine engine;
star_engine_init(&engine);
Sprite *player = star_sprite_create_circle(&engine, 16, 0xFF00FF00);
int x = 100, y = 100;
while (star_engine_is_running(&engine)) {
star_engine_update_input(&engine);
if (star_key_down(&engine, KEY_W)) y -= 3;
if (star_key_down(&engine, KEY_S)) y += 3;
if (star_key_down(&engine, KEY_A)) x -= 3;
if (star_key_down(&engine, KEY_D)) x += 3;
star_engine_begin_frame(&engine, 0xFF000000);
star_sprite_draw(&engine, player, x, y);
star_engine_end_frame(&engine);
}
star_sprite_free(&engine, player);
star_engine_shutdown(&engine);
return 0;
}Located in userland/:
-
NodGL_demo.c- Feature showcase -
NodGL_triangle.c- 3D spinning cube -
dvdbounce.c- Bouncing DVD logo -
gfxtest.c- Graphics test program -
snakegfx.c- Snake game -
minesgfx.c- Minesweeper -
calcgfx.c- Calculator GUI
Located in userland/:
-
star_example_shooter.c- Space shooter -
star_example_pong.c- Pong game
- Read NodGL Getting Started
- Try NodGL Simple Examples
- Explore the NodGL example programs
- Read StarEngine Introduction
- Follow StarEngine Getting Started
- Build the Catch the Stars Tutorial
- Study StarEngine Example Games
┌─────────────────────────────────────┐
│ Your Application │
│ (Games, Graphics Programs) │
└──────────┬──────────────────────────┘
│
┌──────┴──────┐
│ │
┌───▼────┐ ┌───▼─────────┐
│NodGL │ │ StarEngine │ (Built on NodGL)
│Graphics│ │ Game │
│ API │ │ Framework │
└───┬────┘ └─────┬───────┘
│ │
└──────┬───────┘
│
┌──────▼──────┐
│ NodGL │
│ Graphics │
│ Backend │
└──────┬──────┘
│
┌──────▼──────┐
│ GPU/HW │
│Acceleration │
└─────────────┘
-
include/moduos/NodGL.h- NodGL API -
userland/StarEngine.h- StarEngine framework
-
userland/lib_NodGL.c- NodGL implementation -
userland/StarEngine.c- StarEngine implementation
-
wiki-repo/NodGL/- NodGL documentation -
wiki-repo/StarEngine/- StarEngine documentation
-
userland/NodGL_*.c- NodGL examples -
userland/star_example_*.c- StarEngine examples -
userland/*gfx.c- Various graphics programs
NodGL:
NodGL_FillRectContext(ctx, x, y, width, height, color);StarEngine:
star_draw_rect(&engine, x, y, width, height, color);NodGL:
int queue_fd = open("/dev/event0", 0);
event_t ev;
while (read(queue_fd, &ev, sizeof(ev)) == sizeof(ev)) {
if (ev.type == EVENT_KEYBOARD) {
// Handle key
}
}StarEngine:
star_engine_update_input(&engine);
if (star_key_down(&engine, KEY_W)) {
// Handle key
}NodGL:
int collides = (x1 < x2 + w2 && x1 + w1 > x2 &&
y1 < y2 + h2 && y1 + h1 > y2);StarEngine:
int collides = star_entity_collides(entity1, entity2);- NodGL Documentation - Complete NodGL guide
- StarEngine Documentation - Complete StarEngine guide
- System Architecture - ModuOS overview
- Contributing - Help improve ModuOS
Both NodGL and StarEngine are actively maintained as part of ModuOS.
Questions?
- Check the documentation wiki pages
- Examine the example programs
- Read the API references
Found a bug?
- Report issues following the Contributing Guide
Happy coding! Whether you're making games or graphics applications, ModuOS has you covered! 🎨🎮