A Smoll game engine
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

50 rindas
1.3 KiB

pirms 8 mēnešiem
pirms 8 mēnešiem
pirms 8 mēnešiem
pirms 8 mēnešiem
pirms 8 mēnešiem
pirms 8 mēnešiem
pirms 8 mēnešiem
pirms 8 mēnešiem
pirms 8 mēnešiem
pirms 8 mēnešiem
  1. using Raylib_cs;
  2. using Smoll;
  3. using Smoll.Ex1;
  4. using Smoll.Ex2;
  5. using Smoll.Ex3;
  6. Raylib.InitWindow(800, 600, "Smoll");
  7. Layer layer = new Layer();
  8. Layer debugLayer = new Layer(Layer.DrawMode.Debug);
  9. Engine engine = new Engine();
  10. engine.AttachModule(new Smoll.Ex2.RaylibAssetManagerModule());
  11. engine.AttachLayer(layer);
  12. engine.AttachLayer(debugLayer);
  13. /* */
  14. var player = new Entity(layer);
  15. debugLayer.Attach(player);
  16. player.Attach(new Transform2DComponent(128, 128, 0, 1));
  17. player.Attach(new CrosshairGizmoComponent());
  18. player.Attach(new ExampleInputComponent(250f, 0.35f));
  19. player.Attach(new InertiaComponent(0.999f));
  20. var entity = new Entity(player);
  21. entity.Attach(new Transform2DComponent(-16, -16, 0, 4));
  22. var ship = new SpriteComponent("Ship.png");
  23. ship.zOrder = 1;
  24. entity.Attach(ship);
  25. var entity2 = new Entity(entity);
  26. entity2.Attach(new Transform2DComponent(5, -10, 0));
  27. entity2.Attach(new SpriteComponent("Laser.png"));
  28. var arrow = new ArrowComponent(2, 0);
  29. arrow.rawValue = new System.Numerics.Complex(0, -48);
  30. entity2.Attach(arrow);
  31. entity2.Attach(new ExampleShootingInputComponent());
  32. /* */
  33. while(!Raylib.WindowShouldClose()) {
  34. engine.Update();
  35. Raylib.BeginDrawing();
  36. Raylib.ClearBackground(Color.White);
  37. engine.Draw();
  38. Raylib.DrawFPS(0,0);
  39. Raylib.EndDrawing();
  40. GC.Collect(0);
  41. }
  42. Raylib.CloseWindow();