Ejemplo n.º 1
0
Archivo: Game.cs Proyecto: Vtek/Pulsar
        /// <summary>
        /// Run this instance.
        /// </summary>
        public void Run()
        {
            if (IsRunning)
            {
                throw new InvalidOperationException("Game is running");
            }

            WindowService = (IWindowService)PulsarHost.Instance.Kernel.GetService(typeof(IWindowService));

            if (WindowService == null)
            {
                throw new InvalidOperationException("Window service unavaible");
            }

            IsExiting               = false;
            WindowService.Created  += RenderWindowCreated;
            WindowService.Creating += RenderWindowCreating;

            if (!WindowService.IsCreated)
            {
                WindowService.Create();
            }

            //WindowService.Window.SetView(new View(new FloatRect(0, 0, 1280, 720)));//TODO change this line when camera manager will be ready and contain a camera for the virtual resolution

            Initialize();

            IsRunning = true;

            while (IsRunning && !IsExiting)
            {
                Tick();
            }

            //Environment.Exit(1);//Allways exit the application
        }