예제 #1
0
        private void OnDraw()
        {
            IDrawingSession ds        = this.swapChain.CreateDrawingSession();
            var             eventArgs = new AnimatedDrawEventArgs(ds, null);

            this.Draw?.Invoke(this, eventArgs);

            ds.Close();
        }
예제 #2
0
        public static T CreateGame <T>(IDrawingSession dc, IKeyboard keyboard, IMouse mouse)
            where T : Game, new()
        {
            var game = new T
            {
                spriteBatch = dc,
                Keyboard    = keyboard,
                Mouse       = mouse
            };

            game.curGame = game;
            return(game);
        }
예제 #3
0
        public void Run()
        {
            while (!this.isClosed)
            {
                if (this.isVisible)
                {
                    this.platformWindow.ProcessEvents();

                    using (IDrawingSession ds = this.graphicsDevice.CreateDrawingSession())
                    {
                        ds.Clear(Colors.Black);
                        ds.DrawText("Hello GameFramework", new Vector2(0, 0), Colors.White);
                    }

                    this.graphicsDevice.Present();
                }
                else
                {
                    this.platformWindow.ProcessEvents();
                }
            }
        }
예제 #4
0
 private void Draw(GameTime gameTime, IDrawingSession drawingSession)
 {
     this.game.Draw(gameTime, drawingSession);
 }
예제 #5
0
 public AnimatedDrawEventArgs(IDrawingSession drawingSession, GameTime gameTime)
 {
     this.DrawingSession = drawingSession;
     this.TimingInfo     = gameTime;
 }
예제 #6
0
 public virtual void Draw(GameTime gameTime, IDrawingSession drawingSession)
 {
 }
예제 #7
0
 private AnimatedDrawEventArgs CreateDrawEventArgs(IDrawingSession drawingSession, bool isRunningSlowly)
 {
     return(new AnimatedDrawEventArgs(drawingSession, new GameTime {
         IsRunningSlowly = isRunningSlowly
     }));
 }