Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Scene creation (load content on game class)
- /// <summary>
- /// LoadContent will be called once per game and is the place to load
- /// all of your content.
- /// </summary>
- protected override void LoadContent()
- {
- // Create a new SpriteBatch, which can be used to draw textures.
- spriteBatch = new SpriteBatch(GraphicsDevice);
- _scenes.Add(
- new Scene()
- {
- Objects = new List<GameObject>()
- {
- (GameObject)new Button(Content.Load<Texture2D>("GUI/buttonDesaturated"),Content.Load<Texture2D>("GUI/buttonDesaturatedDown"),Content.Load<Texture2D>("GUI/buttonDesaturatedHover"))
- {
- ButtonColor = Color.Red,
- text = "Test",
- font = Content.Load<SpriteFont>("GUI/Font"),
- TextColor = Color.Black,
- Position = new Vector2(70,100)
- }
- }
- });
- _curSceneIndex = 0;
- }
- //button class draw event (draws sprite in base, then draws text on top)
- public override void Draw(SpriteBatch spriteBatch, GameTime delta)
- {
- base.Draw(spriteBatch, delta);
- spriteBatch.DrawString(font, text, Position, _curTextColor);
- }
- //sprite class draw event
- /// <summary>
- /// Draw event for this sprite.
- /// </summary>
- /// <param name="spriteBatch"></param>
- /// <param name="delta"></param>
- public override void Draw(SpriteBatch spriteBatch, GameTime delta)
- {
- if (DrawSprite)
- spriteBatch.Draw(Texture, (Rectangle)GetRectangle(), null, Color, Rotation, Origin, Flip, LayerDepth);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement