Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// The main XNA Draw method
- protected override void Draw(GameTime gameTime)
- {
- //GraphicsDevice.Clear(Color.Green);
- GraphicsDevice.SetRenderTarget(null);
- GraphicsDevice.Clear(Color.Green);
- // TODO: Add your drawing code here
- //COLE: comment either of the areas out to not draw one or the other.
- // The flow of Draw() goes Draw > UpdateSurface > then finishes Draw.
- // A few things in there are commented out, for your convenience, they just drew strings
- //draw the message area.
- messageArea.Draw();
- //draw the testArea
- testArea.Draw();
- //GraphicsDevice.Clear(Color.Green);
- //draw the gui.
- //Orchid.DrawGUI(masterGuiElementList, gameTime);
- base.Draw(gameTime);
- }
- ////THe MessageArea draw code
- public override void Draw()
- {
- //draw border
- //base.Draw();
- //updates the messagearea surface, with the correct SetRenderTarget value
- //because you need to begin the spritebatch AFTER you've set the RT to what you want
- UpdateSurface();
- //draws the new surface stuff to the back buffer
- //spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied);
- spriteBatch.Begin();
- spriteBatch.Draw(this.surface, this.rect, this.backgroundColor);
- spriteBatch.End();
- }
- public override void UpdateSurface()
- {
- //change the renderTarger (pygame surface)
- graphicsDevice.SetRenderTarget(this.surface);
- //clear it, like normal
- graphicsDevice.Clear(Color.Thistle);
- //updates the int[] for the indexes of the messages to draw
- //UpdateActiveMessages();
- //draw messages on surface
- //DrawMessages();
- //then reset the drawing surface to null, backbuffer.
- graphicsDevice.SetRenderTarget(null);
- //graphicsDevice.Clear(gameBG);
- //return surface;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement