🛡️ V-Shield - Platform Layer + Sync Primitives
Platform detection + synchronization primitives for the Ry-Dit game engine.
📦 Qué incluye
| Módulo | Descripción |
|---|---|
platform |
Detección automática de OS (Linux, Windows, macOS, Android, iOS, WASM) |
sync |
Primitivas de sincronización (Mutex, RwLock, Barrier, Condvar) |
platform_sync |
Sincronización de renderizado (X11, OpenGL, Auto) |
graphics |
Colores RyDit + init de ventana (feature graphics, usa raylib) |
🚀 Quick Start
use ;
use ;
use PlatformSync;
// Platform detection
let p = current_platform;
println!;
// Config defaults por plataforma
let config = for_current;
// Sync primitives (thread-safe)
let data = new;
let cache = new;
// Platform sync para renderizado (al final de cada frame)
let mut sync = new;
// sync.sync();
🔧 Features
| Feature | Descripción | Dependencias extra | Tamaño |
|---|---|---|---|
native (default) |
std::sync para Linux/Windows/macOS |
Ninguna | 0 KB |
wasm |
Fallback para WASM (Barrier, Condvar) | Ninguna | 0 KB |
graphics (default) |
Colores raylib + init_window() |
raylib | ~50 KB |
async-tokio |
Wrappers async (tokio::sync) |
tokio (solo sync) |
~80 KB |
rt-linux |
Linux real-time (pendiente) | rtsc | ~20 KB |
Uso sin graphics (más liviano)
[]
= { = "0.2", = false, = ["native"] }
Uso con async
[]
= { = "0.2", = ["native", "async-tokio"] }
use ;
📱 Para Termux/Android
Funciona sin cambios en Termux. Dependencias de sistema necesarias:
🏗️ Arquitectura
v-shield/
├── src/
│ ├── lib.rs # Public API + re-exports
│ ├── platform/
│ │ └── mod.rs # Platform detection + PlatformConfig
│ ├── platform_sync.rs # Render sync (X11/OpenGL)
│ └── sync/
│ ├── mod.rs # Sync module + Barrier/Condvar fallbacks
│ ├── mutex.rs # Mutex wrapper (std or tokio)
│ └── rwlock.rs # RwLock wrapper (std or tokio)
📊 Tests
# 22 unit tests + 4 doc tests = 26 passing ✅
🔄 Integración con otros crates
ry-gfx (graphics)
use ;
// PlatformSync viene de v-shield (re-export)
ry-stream (networking)
use Mutex; // Thread-safe Mutex para clientes
use StreamServer;
🎯 Filosofía
Low-End First: Funciona en un Redmi Note 8 con Adreno 610.
- Sin features pesados por defecto
tokiosolo con featuresync(~80KB), NO runtime fullraylibes opcional (featuregraphics)- Zero dependencias extra en modo
native
📝 Changelog
v0.2.0 (actual)
- ✅ Platform detection (Linux, Windows, macOS, Android, iOS, WASM)
- ✅ Sync primitives (Mutex, RwLock, Barrier, Condvar)
- ✅ Platform Sync migrado de ry-gfx (ahora centralizado)
- ✅ Features configurables (native, wasm, graphics, async-tokio)
- ✅ 26 tests pasando
v0.1.0
- Colores raylib + ColorRyDit enum
init_window()wrapper