- using Raylib_cs;
- using Smoll;
- using Smoll.Ex1;
- using Smoll.Ex2;
-
- Raylib.InitWindow(800, 600, "Smoll");
-
- Layer layer = new Layer();
- Layer debugLayer = new Layer(Layer.DrawMode.Debug);
-
- Engine engine = new Engine();
- engine.AttachModule(new Smoll.Ex2.RaylibAssetManagerModule());
- engine.AttachLayer(layer);
- engine.AttachLayer(debugLayer);
-
- /* */
-
- var player = new Entity(layer);
- debugLayer.Attach(player);
- player.Attach(new Transform2DComponent(128, 128, 0, 1));
- player.Attach(new CrosshairGizmoComponent());
- player.Attach(new ExampleInputComponent(250f, 0.35f));
- player.Attach(new InertiaComponent(0.999f));
-
- var entity = new Entity(player);
- entity.Attach(new Transform2DComponent(-16, -16, 0, 4));
- var ship = new SpriteComponent("Ship.png");
- ship.zOrder = 1;
- entity.Attach(ship);
-
- var entity2 = new Entity(entity);
- entity2.Attach(new Transform2DComponent(5, -10, 0));
- entity2.Attach(new SpriteComponent("Laser.png"));
- var arrow = new ArrowComponent(2, 0);
- arrow.rawValue = new System.Numerics.Complex(0, -48);
- entity2.Attach(arrow);
- entity2.Attach(new ExampleShootingInputComponent());
-
- /* */
-
- while(!Raylib.WindowShouldClose()) {
- engine.Update();
- Raylib.BeginDrawing();
- Raylib.ClearBackground(Color.White);
- engine.Draw();
- Raylib.DrawFPS(0,0);
- Raylib.EndDrawing();
- GC.Collect(0);
- }
- Raylib.CloseWindow();
|