minui 0.3.2

A minimalist Rust framework for TUIs and terminal games.
Documentation
//! Game loop utilities for timing and state management (planned feature).
//!
//! This module provides utilities for managing game timing, frame rates, and the
//! separation of update and render logic. It helps create smooth, consistent
//! game experiences regardless of hardware performance.
//!
//! ## Planned Features
//!
//! - **Fixed Timestep**: Consistent physics updates independent of frame rate
//! - **Delta Time**: Frame-independent movement and animation
//! - **Frame Rate Control**: Target FPS management and limiting
//! - **State Management**: Game state transitions and management
//! - **Performance Monitoring**: FPS counting and performance metrics
//!
//! ## Future API Design
//!
//! ```rust,ignore
//! use minui::game::game_loop::{GameLoop, FixedTimestep, DeltaTime};
//! use std::time::Duration;
//!
//! // Fixed timestep game loop (good for deterministic games)
//! let mut game_loop = GameLoop::new()
//!     .with_fixed_timestep(Duration::from_millis(16)) // 60 FPS
//!     .with_max_catchup_frames(5); // Prevent spiral of death
//!
//! game_loop.run(|timestep, input| {
//!     match timestep {
//!         FixedTimestep::Update => {
//!             // Fixed-rate game logic updates
//!             update_physics();
//!             update_ai();
//!             handle_collisions();
//!         }
//!         FixedTimestep::Render => {
//!             // Variable-rate rendering
//!             render_game(window)?;
//!         }
//!     }
//!     Ok(())
//! })?;
//!
//! // Delta time game loop (good for smooth animation)
//! let mut smooth_loop = GameLoop::new()
//!     .with_target_fps(60.0)
//!     .with_delta_time(true);
//!
//! smooth_loop.run(|delta: DeltaTime, input| {
//!     // Update with delta time for smooth movement
//!     player.position.x += player.velocity.x * delta.as_secs_f32();
//!     player.position.y += player.velocity.y * delta.as_secs_f32();
//!     
//!     render_game(window)?;
//!     Ok(())
//! })?;
//! ```
//!
//! ## Game State Management
//!
//! ```rust,ignore
//! use minui::game::game_loop::{StateManager, GameState};
//!
//! enum MyGameState {
//!     MainMenu,
//!     Playing,
//!     Paused,
//!     GameOver,
//! }
//!
//! let mut state_manager = StateManager::new(MyGameState::MainMenu);
//!
//! // State transitions
//! state_manager.transition_to(MyGameState::Playing);
//!
//! // State-specific updates
//! match state_manager.current() {
//!     MyGameState::Playing => {
//!         update_gameplay(delta_time);
//!         if player.health <= 0 {
//!             state_manager.transition_to(MyGameState::GameOver);
//!         }
//!     }
//!     MyGameState::Paused => {
//!         // Don't update game logic, just render pause screen
//!     }
//!     _ => {}
//! }
//! ```
//!
//! ## Performance Monitoring
//!
//! ```rust,ignore
//! use minui::game::game_loop::PerformanceMonitor;
//!
//! let mut monitor = PerformanceMonitor::new();
//!
//! // In game loop
//! monitor.frame_start();
//! 
//! // Game logic here
//! update_game();
//! render_game();
//! 
//! monitor.frame_end();
//!
//! // Check performance
//! if monitor.current_fps() < 30.0 {
//!     println!("Warning: Low FPS detected: {:.1}", monitor.current_fps());
//! }
//! ```

// TODO: Implement game loop utilities
// This will include fixed timestep, delta time, state management, and performance monitoring