use carousel::{ core::{ Game, State, settings::{ ClockSettings, DebugSettings, DrawSettings, PhysicsSettings, Settings, StageSettings, WindowSettings, }, }, draw::color::Color, stage::basic::{Position, Shape, ShapeKind}, }; struct MyGame { a: f32, } impl Game for MyGame { fn start(&mut self, ctxt: &mut carousel::core::ctxt::Ctxt) { let _ = ctxt .world .entity() .with(Position(360, 240)) .with(Shape(ShapeKind::Circle(10.0), Color::GREEN)) .spawn(); } fn update(&mut self, ctxt: &mut carousel::core::ctxt::Ctxt) { let center_x = 360.0; let center_y = 240.0; let radius = 100.0; let x = center_x + self.a.cos() * radius; let y = center_y + self.a.sin() * radius; ctxt.world .query() .with::() .perform() .iter() .for_each(|e| { *ctxt.world.get_mut::(*e).unwrap() = Position(x.round() as i32, y.round() as i32); }); self.a += 0.05; } } fn main() { let game = MyGame { a: 0f32 }; let mut state = State::new( game, Settings::new( ClockSettings::new(30.0), WindowSettings::new("Hello, world", 720, 480), StageSettings::new(DrawSettings::new(Color::WHITE)), PhysicsSettings::default(), DebugSettings, ), ); state.start_game(); }