public BezierDrawSystem(BezierRender render, Rectangle <int> area) : base("BezierDrawSystem")
        {
            RequireComponents.AddRequireComponentType <BezierComponent>();

            Area = area;

            mRender = render;

            mCanvas = new Image(
                new Size <int>(Area.Right - Area.Left, Area.Bottom - Area.Top),
                PixelFormat.RedBlueGreenAlpha8bit,
                mRender.GpuDevice);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            const int width  = 1920;
            const int height = 1080;

            var adapters = GalEngine.Runtime.Graphics.GpuAdapter.EnumerateGraphicsAdapter();

            GameSystems.Initialize(new GameStartInfo()
            {
                WindowName = "Bezier Render System",
                GameName   = "Bezier Render System",
                IconName   = null,
                WindowSize = new Size <int>(width, height),
                Adapter    = adapters[1]
            });

            BezierRender bezierRender = new BezierRender(GameSystems.GpuDevice);

            GameSystems.AddBehaviorSystem(
                new BezierFillSystem(bezierRender,
                                     new Rectangle <int>(0, 0, width, height)));

            /*GameSystems.AddBehaviorSystem(
             * new BezierDrawSystem(bezierRender,
             * new Rectangle<int>(0, 0, width, height)));*/

            GameSystems.MainScene = new GameScene("Main");

            Random random = new Random(0);

            Flower[] flowers = new Flower[500];

            for (int i = 0; i < flowers.Length; i++)
            {
                flowers[i] = new Flower(
                    new Position <float>(random.Next(0, width), random.Next(0, height)),
                    random.Next(100, 200));

                foreach (var leaf in flowers[i].Leaves)
                {
                    GameSystems.MainScene.AddGameObject(leaf);
                }
            }

            GameSystems.RunLoop();
        }