示例#1
0
 static void Main(string[] args)
 {
     using (Solarsystem game = new Solarsystem())
     {
         game.Run();
     }
 }
示例#2
0
        public static Texture2D GetScreenshot(Solarsystem g)
        {
            int w = g.GraphicsDevice.PresentationParameters.BackBufferWidth;
            int h = g.GraphicsDevice.PresentationParameters.BackBufferHeight;

            //force a frame to be drawn (otherwise back buffer is empty)
            g.Draw(new GameTime());

            //pull the picture from the buffer
            int[] backBuffer = new int[w * h];
            g.GraphicsDevice.GetBackBufferData(backBuffer);

            //copy into a texture
            Texture2D texture = new Texture2D(g.GraphicsDevice, w, h, false, g.GraphicsDevice.PresentationParameters.BackBufferFormat);

            texture.SetData(backBuffer);
            return(texture);
        }