sevenx_engine 0.2.11

Engine de jogos 2D/3D completa com suporte Android, física, áudio, partículas, tilemap, UI, eventos e sistema 3D avançado com PBR.
Documentation
// Demo de detecção de plataforma e configuração automática
use sevenx_engine::*;

struct PlatformDemo {
    platform_info: PlatformInfo,
    time: f32,
}

impl GameState for PlatformDemo {
    fn new() -> Self {
        let platform_info = PlatformInfo::detect();
        
        // Imprime informações da plataforma
        platform_info.print_info();
        
        println!("\n=== Recommendations ===");
        println!("Graphics Quality: {}", platform_info.recommended_graphics_quality());
        let (w, h) = platform_info.recommended_resolution();
        println!("Resolution: {}x{}", w, h);
        
        println!("\n=== Feature Support ===");
        println!("3D: {}", if platform_info.supports_feature("3d") { "" } else { "⚠️" });
        println!("Shaders: {}", if platform_info.supports_feature("shaders") { "" } else { "⚠️" });
        println!("Post-Processing: {}", if platform_info.supports_feature("post_processing") { "" } else { "⚠️" });
        println!("Multiplayer: {}", if platform_info.supports_feature("multiplayer") { "" } else { "" });
        
        Self {
            platform_info,
            time: 0.0,
        }
    }

    fn update(&mut self, dt: f32, input: &InputHandler, _world: &mut World) {
        self.time += dt;

        // Mostra inputs disponíveis
        if self.platform_info.supports_keyboard {
            if input.is_key_pressed(KeyCode::Space) {
                println!("✅ Keyboard working!");
            }
        }

        if self.platform_info.supports_mouse {
            if input.is_mouse_button_pressed(MouseBtn::Left) {
                let (x, y) = input.get_mouse_position();
                println!("✅ Mouse working at ({}, {})", x, y);
            }
        }
    }

    fn draw(&mut self, _world: &World, frame_buffer: &mut [u8]) {
        // Limpa com cor baseada na plataforma
        let color = match self.platform_info.platform {
            Platform::Windows => [0, 120, 215, 255],    // Azul Windows
            Platform::Linux => [255, 165, 0, 255],      // Laranja Linux
            Platform::MacOS => [128, 128, 128, 255],    // Cinza macOS
            Platform::Android => [164, 198, 57, 255],   // Verde Android
            _ => [50, 50, 50, 255],
        };

        for pixel in frame_buffer.chunks_exact_mut(4) {
            pixel.copy_from_slice(&color);
        }

        // Desenha informações
        let mut prims = Primitives2D::new(frame_buffer, 800, 600);
        
        // Título
        let title = format!("SevenX Engine - {}", self.platform_info.platform.name());
        
        // Desenha retângulo de fundo para texto
        prims.draw_rect_filled(10, 10, 400, 200, [0, 0, 0, 200]);
        
        // Animação simples
        let pulse = ((self.time * 2.0).sin() * 20.0 + 30.0) as i32;
        prims.draw_circle_filled(400, 300, pulse, [255, 255, 255, 100]);
        
        // Indicadores de input
        let mut y = 250;
        if self.platform_info.supports_keyboard {
            prims.draw_rect_filled(350, y, 100, 30, [0, 255, 0, 255]);
            y += 40;
        }
        if self.platform_info.supports_mouse {
            prims.draw_rect_filled(350, y, 100, 30, [0, 255, 0, 255]);
            y += 40;
        }
        if self.platform_info.supports_touch {
            prims.draw_rect_filled(350, y, 100, 30, [0, 255, 0, 255]);
            y += 40;
        }
        if self.platform_info.supports_gamepad {
            prims.draw_rect_filled(350, y, 100, 30, [0, 255, 0, 255]);
        }
    }
}

fn main() {
    // Configuração automática baseada na plataforma
    let config = platform::auto_configure();
    
    println!("\n🚀 Starting SevenX Engine v0.2.8");
    println!("📦 Auto-configured for current platform\n");
    
    Engine::with_config(config).run::<PlatformDemo>();
}