示例#1
0
        static void Main(string[] args)
        {
            var logger = LoggerFactory.GetLogger();

            logger.Information("===== Запуск =====");

            using (IGraphicsService graphicsService = new GraphicsService(logger))
            {
                if (graphicsService.TryInitialize())
                {
                    var blockMoveEngine = new GameEntityUpdateEngine();
                    var gameEngine      = new GameEngine(graphicsService, blockMoveEngine, logger);

                    gameEngine.CreateNew();

                    try
                    {
                        var quit = false;

                        while (!quit)
                        {
                            while (SDL2.SDL.SDL_PollEvent(out SDL2.SDL.SDL_Event sdlEvent) != 0)
                            {
                                if (sdlEvent.type == SDL2.SDL.SDL_EventType.SDL_QUIT)
                                {
                                    quit = true;
                                    break;
                                }
                            }

                            gameEngine.Update();
                        }
                    }
                    finally
                    {
                        blockMoveEngine = null;
                    }
                }
            }

            logger.Information("===== Останов =====");
        }