Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Main Draw in Game class
- protected override void Draw(GameTime gameTime)
- {
- GraphicsDevice.Clear(Color.Black);
- switch(GameState)
- {
- case GameState.Menu: /*MenuDraw*/ break;
- case GameState.Game: DrawGame(); break;
- //etc
- }
- base.Draw(gameTime);
- }
- //DrawGame()
- private void DrawGame()
- {
- spriteBatch.Begin(/*some parameters*/);
- for (int i = 0; i < GameObjects.Count; ++i)
- {
- //GameObjects is a List of game's objects
- //GameObject is an abstract class, which other things inherit
- //It has basic things, like Update and Draw functions
- GameObjects[i].Draw(spriteBatch);
- }
- spriteBatch.End();
- }
- //Player inherits GameObject
- public class Player : GameObject
- {
- //Overriding Update from GameObject
- public override void Update()
- {
- //Update Player
- }
- //Overriding Update from GameObject
- public override void Draw(SpriteBatch batch)
- {
- //Draw Player
- //eg batch.Draw(Position, Texture, Color.White);
- }
- }
Add Comment
Please, Sign In to add comment