Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Mar 8th, 2018 49 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. //Scene creation (load content on game class)
  2.        /// <summary>
  3.         /// LoadContent will be called once per game and is the place to load
  4.         /// all of your content.
  5.         /// </summary>
  6.         protected override void LoadContent()
  7.         {
  8.             // Create a new SpriteBatch, which can be used to draw textures.
  9.             spriteBatch = new SpriteBatch(GraphicsDevice);
  10.  
  11.             _scenes.Add(
  12.             new Scene()
  13.             {
  14.                 Objects = new List<GameObject>()
  15.                 {
  16.                    (GameObject)new Button(Content.Load<Texture2D>("GUI/buttonDesaturated"),Content.Load<Texture2D>("GUI/buttonDesaturatedDown"),Content.Load<Texture2D>("GUI/buttonDesaturatedHover"))
  17.                    {
  18.                        ButtonColor = Color.Red,
  19.                        text = "Test",
  20.                        font = Content.Load<SpriteFont>("GUI/Font"),
  21.                        TextColor = Color.Black,
  22.                        Position = new Vector2(70,100)
  23.                    }
  24.                 }
  25.             });
  26.  
  27.             _curSceneIndex = 0;
  28.            
  29.         }
  30.  
  31. //button class draw event (draws sprite in base, then draws text on top)
  32.  
  33.         public override void Draw(SpriteBatch spriteBatch, GameTime delta)
  34.         {
  35.             base.Draw(spriteBatch, delta);
  36.             spriteBatch.DrawString(font, text, Position, _curTextColor);
  37.         }
  38.  
  39.  
  40. //sprite class draw event
  41.         /// <summary>
  42.         /// Draw event for this sprite.
  43.         /// </summary>
  44.         /// <param name="spriteBatch"></param>
  45.         /// <param name="delta"></param>
  46.         public override void Draw(SpriteBatch spriteBatch, GameTime delta)
  47.         {
  48.             if (DrawSprite)
  49.                 spriteBatch.Draw(Texture, (Rectangle)GetRectangle(), null, Color, Rotation, Origin, Flip, LayerDepth);
  50.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top