using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using System.Collections.Generic; using Pacman_refactored.Classes; using Pacman_refactored.Enums; using Pacman_refactored.Classes.Entity; using Pacman_refactored.Classes.UI; using Pacman_refactored.Classes.Food; namespace Pacman_refactored { public class Game1 : Game { private GraphicsDeviceManager _graphics; private SpriteBatch _spriteBatch; // Static fields public static GameState GameState; public static Vector2 ScreenSize; /// /// Size of one game cell. /// public static int CellSize; /// /// Default speed of all game objects. /// public static float Speed; // Static game objects public Map Map; // Dynamic game onjects public Pacman Pacman; public List Foods; public List Ghosts; // UI public MainMenu MainMenu; public GameOverMenu GameOverMenu; public Hud Hud; public Game1() { _graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; IsMouseVisible = false; GameState = GameState.Menu; ScreenSize = new Vector2(660, 850); CellSize = 24; Map = new Map(); Pacman = new Pacman(Speed, CellSize); Foods = new List(); Ghosts = new List(); MainMenu = new MainMenu(ScreenSize); GameOverMenu = new GameOverMenu(ScreenSize); Hud = new Hud(ScreenSize); } protected override void Initialize() { // Set screen size. _graphics.PreferredBackBufferWidth = (int)ScreenSize.X; _graphics.PreferredBackBufferHeight = (int)ScreenSize.Y; _graphics.ApplyChanges(); // Map.Load(); base.Initialize(); } protected override void LoadContent() { _spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here } protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) Exit(); // TODO: Add your update logic here base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); // TODO: Add your drawing code here base.Draw(gameTime); } } }