A Smoll game engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.3 KiB

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(100f, 0.25f));
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, -12);
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();