Advertisement
TankorSmash

for SO

Aug 24th, 2012
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.19 KB | None | 0 0
  1.  
  2. /// The main XNA Draw method
  3.  
  4.         protected override void Draw(GameTime gameTime)
  5.         {
  6.             //GraphicsDevice.Clear(Color.Green);
  7.             GraphicsDevice.SetRenderTarget(null);
  8.             GraphicsDevice.Clear(Color.Green);
  9.             // TODO: Add your drawing code here
  10.  
  11.             //COLE: comment either of the areas out to not draw one or the other.
  12.             // The flow of Draw() goes Draw > UpdateSurface >  then finishes Draw.
  13.             // A few things in there are commented out, for your convenience, they just drew strings
  14.  
  15.             //draw the message area.
  16.             messageArea.Draw();
  17.             //draw the testArea
  18.             testArea.Draw();
  19.  
  20.             //GraphicsDevice.Clear(Color.Green);
  21.  
  22.             //draw the gui.
  23.             //Orchid.DrawGUI(masterGuiElementList, gameTime);
  24.  
  25.  
  26.             base.Draw(gameTime);
  27.         }
  28.  
  29. ////THe MessageArea draw code
  30.  
  31.  
  32.         public override void Draw()
  33.         {
  34.             //draw border
  35.             //base.Draw();
  36.            
  37.             //updates the messagearea surface, with the correct SetRenderTarget value
  38.             //because you need to begin the spritebatch AFTER you've set the RT to what you want
  39.             UpdateSurface();
  40.  
  41.             //draws the new surface stuff to the back buffer
  42.             //spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied);
  43.             spriteBatch.Begin();
  44.             spriteBatch.Draw(this.surface, this.rect, this.backgroundColor);
  45.             spriteBatch.End();
  46.  
  47.         }
  48.  
  49.         public override void UpdateSurface()
  50.         {
  51.  
  52.             //change the renderTarger (pygame surface)
  53.             graphicsDevice.SetRenderTarget(this.surface);
  54.             //clear it, like normal
  55.             graphicsDevice.Clear(Color.Thistle);
  56.  
  57.             //updates the int[] for the indexes of the messages to draw
  58.             //UpdateActiveMessages();
  59.  
  60.             //draw messages on surface
  61.             //DrawMessages();
  62.  
  63.             //then reset the drawing surface to null, backbuffer.
  64.             graphicsDevice.SetRenderTarget(null);
  65.  
  66.             //graphicsDevice.Clear(gameBG);
  67.  
  68.             //return surface;
  69.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement