Exemplo n.º 1
0
        public static void RunLoop()
        {
            while (IsExist is true)
            {
                //update time
                Time.Update();

                SystemScene?.Update(Time.DeltaSeconds);
                MainScene?.Update(Time.DeltaSeconds);

                BehaviorSystems.ForEach((system) => UpdateBehaviorSystem(system));

                if (EngineWindow != null && EngineWindow.IsExisted != false)
                {
                    EngineWindow.Update(Time.DeltaSeconds);
                }

                if (EngineWindow != null && EngineWindow.IsExisted == false)
                {
                    IsExist = false;
                }

                PresentRender.BeginDraw();
                BehaviorSystems.ForEach((system) => system.Present(PresentRender));
                PresentRender.EndDraw(false);
            }
        }
Exemplo n.º 2
0
 internal static void Present(PresentRender render)
 {
     render.Mask(Canvas, new Rectangle(
                     left: 0, top: 0,
                     right: GameSystems.EngineWindow.Size.Width,
                     bottom: GameSystems.EngineWindow.Size.Height));
 }
Exemplo n.º 3
0
        private static void InitializeRuntime(GameStartInfo gameStartInfo)
        {
            if (gameStartInfo.Adapter == null)
            {
                var adapters = GpuAdapter.EnumerateGraphicsAdapter();

                LogEmitter.Assert(adapters.Count > 0, LogLevel.Error, "[Initialize Graphics Device Failed without Support Adapter] from [GameSystems]");

                GpuDevice = new GpuDevice(adapters[0]);
            }
            else
            {
                GpuDevice = new GpuDevice(gameStartInfo.Adapter);
            }

            EngineWindow = new EngineWindow(
                gameStartInfo.WindowName,
                gameStartInfo.IconName,
                gameStartInfo.WindowSize);
            EngineWindow.Show();

            PresentRender = new PresentRender(GpuDevice, EngineWindow.Handle, EngineWindow.Size);

            //init resize event
            EngineWindow.OnSizeChangeEvent += (sender, eventArg) =>
            {
                PresentRender.ReSize(eventArg.After);
                VisualGuiSystem.Area = new Rectangle <int>(0, 0, eventArg.After.Width, eventArg.After.Height);
            };
        }
Exemplo n.º 4
0
        public static void RunLoop()
        {
            while (IsExist is true)
            {
                //update time
                Time.Update();

                if (EngineWindow != null && EngineWindow.IsExisted != false)
                {
                    EngineWindow.Update(Time.DeltaSeconds);
                }

                if (EngineWindow != null && EngineWindow.IsExisted == false)
                {
                    IsExist = false;
                }

                //update time
                InputListener.Update();
                Gui.Update(Time.DeltaSeconds);

                //draw time
                Gui.Draw();

                //present time
                PresentRender.BeginDraw();

                Gui.Present(PresentRender);

                PresentRender.EndDraw(false);

                InputListener.Clear();
            }
        }
Exemplo n.º 5
0
        private static void InitializeRuntime(GameStartInfo gameStartInfo)
        {
            if (gameStartInfo.Adapter == null)
            {
                var adapters = GpuAdapter.EnumerateGraphicsAdapter();

                LogEmitter.Assert(adapters.Count > 0, LogLevel.Error, "[Initialize Graphics Device Failed without Support Adapter] from [GameSystems]");

                GpuDevice = new GpuDevice(adapters[0]);
            }
            else
            {
                GpuDevice = new GpuDevice(gameStartInfo.Adapter);
            }

            EngineWindow = new EngineWindow(
                gameStartInfo.Window.Name,
                gameStartInfo.Window.Icon,
                gameStartInfo.Window.Size);
            EngineWindow.Show();

            PresentRender = new PresentRender(GpuDevice, EngineWindow.Handle, EngineWindow.Size);
        }
Exemplo n.º 6
0
 protected internal virtual void Present(PresentRender render)
 {
 }
Exemplo n.º 7
0
 protected internal override void Present(PresentRender render)
 {
     render.Mask(mCanvas, Area, 1.0f);
 }