Example #1
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);
            };
        }
Example #2
0
        public static void Initialize(GameStartInfo gameStartInfo)
        {
            GameName = gameStartInfo.Name;

            IsExist = true;

            InitializeRuntime(gameStartInfo);

            Gui.Initialize();

            LogEmitter.Apply(LogLevel.Information, "[Initialize Game Systems Finish] from [GameSystems]");
        }
Example #3
0
        public static void Initialize(GameStartInfo gameStartInfo)
        {
            GameName = gameStartInfo.GameName;

            BehaviorSystems = new List <BehaviorSystem>();

            IsExist = true;

            SystemScene = new GameScene("SystemScene");

            InitializeRuntime(gameStartInfo);

            //add system
            AddBehaviorSystem(AssetSystem     = new AssetSystem());
            AddBehaviorSystem(LogicGuiSystem  = new LogicGuiSystem());
            AddBehaviorSystem(VisualGuiSystem = new VisualGuiSystem(GpuDevice, new Rectangle <int>(0, 0, EngineWindow.Size.Width, EngineWindow.Size.Height)));

            EngineWindow.AddEventListener(LogicGuiSystem);

            LogEmitter.Apply(LogLevel.Information, "[Initialize GameSystems Finish] from [GameSystems]");
        }
Example #4
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);
        }