use sevenx_engine::*;
struct PlatformDemo {
platform_info: PlatformInfo,
time: f32,
}
impl GameState for PlatformDemo {
fn new() -> Self {
let platform_info = PlatformInfo::detect();
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;
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]) {
let color = match self.platform_info.platform {
Platform::Windows => [0, 120, 215, 255], Platform::Linux => [255, 165, 0, 255], Platform::MacOS => [128, 128, 128, 255], Platform::Android => [164, 198, 57, 255], _ => [50, 50, 50, 255],
};
for pixel in frame_buffer.chunks_exact_mut(4) {
pixel.copy_from_slice(&color);
}
let mut prims = Primitives2D::new(frame_buffer, 800, 600);
let title = format!("SevenX Engine - {}", self.platform_info.platform.name());
prims.draw_rect_filled(10, 10, 400, 200, [0, 0, 0, 200]);
let pulse = ((self.time * 2.0).sin() * 20.0 + 30.0) as i32;
prims.draw_circle_filled(400, 300, pulse, [255, 255, 255, 100]);
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() {
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>();
}